Skip to content

Commit 7bd8e37

Browse files
committed
Reland "[lldb][Modules] Fix error handling of parseAndLoadModuleMapFile (#141220)"
This reverts commit 57f3151. LLDB was hitting an assert when compiling the `std` module. The `std` module was being pulled in because we use `#import <cstdio>` in the test to set a breakpoint on `puts`. That's redundant and to work around the crash we just remove that include. The underlying issue of compiling the `std` module still exists and I'll investigate that separately. The reason it started failing after the `ClangModulesDeclVendor` patch is that we would previously just fail to load the modulemap (and thus not load any of the modules). Now we do load the modulemap (and modules) when we prepare for parsing the expression.
1 parent f4e1ec5 commit 7bd8e37

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ bool ClangModulesDeclVendorImpl::AddModule(const SourceModule &module,
330330
auto file = HS.lookupModuleMapFile(*dir, is_framework);
331331
if (!file)
332332
return error();
333-
if (!HS.parseAndLoadModuleMapFile(*file, is_system))
333+
if (HS.parseAndLoadModuleMapFile(*file, is_system))
334334
return error();
335335
}
336336
}

lldb/test/API/lang/cpp/gmodules/template-with-same-arg/TestTemplateWithSameArg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def setUp(self):
3434

3535
@add_test_categories(["gmodules"])
3636
def test_same_template_arg(self):
37-
lldbutil.run_to_source_breakpoint(self, "Break here", self.main_source_file)
37+
lldbutil.run_to_source_breakpoint(self, "return 0", self.main_source_file)
3838

3939
self.expect_expr(
4040
"FromMod1",
@@ -58,7 +58,7 @@ def test_same_template_arg(self):
5858

5959
@add_test_categories(["gmodules"])
6060
def test_duplicate_decls(self):
61-
lldbutil.run_to_source_breakpoint(self, "Break here", self.main_source_file)
61+
lldbutil.run_to_source_breakpoint(self, "return 0", self.main_source_file)
6262

6363
self.expect_expr("(intptr_t)&FromMod1 + (intptr_t)&FromMod2")
6464

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
#include "module1.h"
22
#include "module2.h"
33

4-
#include <cstdio>
5-
64
int main() {
75
ClassInMod1 FromMod1;
86
ClassInMod2 FromMod2;
97

108
FromMod1.VecInMod1.Member = 137;
119
FromMod2.VecInMod2.Member = 42;
1210

13-
std::puts("Break here");
1411
return 0;
1512
}

0 commit comments

Comments
 (0)