[Lldb-commits] [lldb] 7bd8e37 - Reland "[lldb][Modules] Fix error handling of parseAndLoadModuleMapFile (#141220)"
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Thu May 29 04:06:59 PDT 2025
Author: Michael Buch
Date: 2025-05-29T12:06:29+01:00
New Revision: 7bd8e376fca22cac9593e93450a545573d3ff5f4
URL: https://github.com/llvm/llvm-project/commit/7bd8e376fca22cac9593e93450a545573d3ff5f4
DIFF: https://github.com/llvm/llvm-project/commit/7bd8e376fca22cac9593e93450a545573d3ff5f4.diff
LOG: Reland "[lldb][Modules] Fix error handling of parseAndLoadModuleMapFile (#141220)"
This reverts commit 57f3151a3144259f4e830fc43a1424e4c1f15985.
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.
Added:
Modified:
lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
lldb/test/API/lang/cpp/gmodules/template-with-same-arg/TestTemplateWithSameArg.py
lldb/test/API/lang/cpp/gmodules/template-with-same-arg/main.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index eb62cb618f254..c99ed9dd0a68d 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -330,7 +330,7 @@ bool ClangModulesDeclVendorImpl::AddModule(const SourceModule &module,
auto file = HS.lookupModuleMapFile(*dir, is_framework);
if (!file)
return error();
- if (!HS.parseAndLoadModuleMapFile(*file, is_system))
+ if (HS.parseAndLoadModuleMapFile(*file, is_system))
return error();
}
}
diff --git a/lldb/test/API/lang/cpp/gmodules/template-with-same-arg/TestTemplateWithSameArg.py b/lldb/test/API/lang/cpp/gmodules/template-with-same-arg/TestTemplateWithSameArg.py
index c3c0a707c0369..d40be55872eae 100644
--- a/lldb/test/API/lang/cpp/gmodules/template-with-same-arg/TestTemplateWithSameArg.py
+++ b/lldb/test/API/lang/cpp/gmodules/template-with-same-arg/TestTemplateWithSameArg.py
@@ -34,7 +34,7 @@ def setUp(self):
@add_test_categories(["gmodules"])
def test_same_template_arg(self):
- lldbutil.run_to_source_breakpoint(self, "Break here", self.main_source_file)
+ lldbutil.run_to_source_breakpoint(self, "return 0", self.main_source_file)
self.expect_expr(
"FromMod1",
@@ -58,7 +58,7 @@ def test_same_template_arg(self):
@add_test_categories(["gmodules"])
def test_duplicate_decls(self):
- lldbutil.run_to_source_breakpoint(self, "Break here", self.main_source_file)
+ lldbutil.run_to_source_breakpoint(self, "return 0", self.main_source_file)
self.expect_expr("(intptr_t)&FromMod1 + (intptr_t)&FromMod2")
diff --git a/lldb/test/API/lang/cpp/gmodules/template-with-same-arg/main.cpp b/lldb/test/API/lang/cpp/gmodules/template-with-same-arg/main.cpp
index 845e6b2c53432..1117b540f3ce0 100644
--- a/lldb/test/API/lang/cpp/gmodules/template-with-same-arg/main.cpp
+++ b/lldb/test/API/lang/cpp/gmodules/template-with-same-arg/main.cpp
@@ -1,8 +1,6 @@
#include "module1.h"
#include "module2.h"
-#include <cstdio>
-
int main() {
ClassInMod1 FromMod1;
ClassInMod2 FromMod2;
@@ -10,6 +8,5 @@ int main() {
FromMod1.VecInMod1.Member = 137;
FromMod2.VecInMod2.Member = 42;
- std::puts("Break here");
return 0;
}
More information about the lldb-commits
mailing list