summaryrefslogtreecommitdiff
path: root/lldb/test/API/lang/cpp/gmodules
AgeCommit message (Collapse)Author
2025-05-29Reland "[lldb][Modules] Fix error handling of parseAndLoadModuleMapFile ↵Michael Buch
(#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.
2024-03-04[lldb][test] Add test for chained PCH debugging (#83582)Michael Buch
Adds a test-case for debugging a program with a pch chain, that is, the main executable depends on a pch that itself included another pch. Currently clang doesn't emit the sekeleton CUs required for LLDB to track all types on the pch chain. Thus this test is XFAILed for now.
2024-02-29[lldb][ClangASTImporter] Import record layouts from origin if available (#83295)Michael Buch
Layout information for a record gets stored in the `ClangASTImporter` associated with the `DWARFASTParserClang` that originally parsed the record. LLDB sometimes moves clang types from one AST to another (in the reproducer the origin AST was a precompiled-header and the destination was the AST backing the executable). When clang then asks LLDB to `layoutRecordType`, it will do so with the help of the `ClangASTImporter` the type is associated with. If the type's origin is actually in a different LLDB module (and thus a different `DWARFASTParserClang` was used to set its layout info), we won't find the layout info in our local `ClangASTImporter`. In the reproducer this meant we would drop the alignment info of the origin type and misread a variable's contents with `frame var` and `expr`. There is logic in `ClangASTSource::layoutRecordType` to import an origin's layout info. This patch re-uses that infrastructure to import an origin's layout from one `ClangASTImporter` instance to another. rdar://123274144
2023-05-25[NFC][Py Reformat] Reformat python files in lldbJonas Devlieghere
This is an ongoing series of commits that are reformatting our Python code. Reformatting is done with `black` (23.1.0). If you end up having problems merging this commit because you have made changes to a python file, the best way to handle that is to run `git checkout --ours <yourfile>` and then reformat it with black. RFC: https://discourse.llvm.org/t/rfc-document-and-standardize-python-code-style Differential revision: https://reviews.llvm.org/D151460
2022-09-26[lldb][test] 2 - Add gmodules test category explicitly where previously done ↵Michael Buch
implicitly Since we don't compile with `gmodules` implicitly via debug-info test replication, we should mark all implicit `gmodules` tests with the appropriate category so the API tests get actually run as intended. Differential Revision: https://reviews.llvm.org/D134574
2022-09-16[clang][ASTImporter] DeclContext::localUncachedLookup: Continue lookup into ↵Michael Buch
decl chain when regular lookup fails The uncached lookup is mainly used in the ASTImporter/LLDB code-path where we're not allowed to load from external storage. When importing a FieldDecl with a DeclContext that had no external visible storage (but came from a Clang module or PCH) the above call to `lookup(Name)` the regular `DeclContext::lookup` fails because: 1. `DeclContext::buildLookup` doesn't set `LookupPtr` for decls that came from a module 2. LLDB doesn't use the `SharedImporterState` In such a case we would never continue with the "slow" path of iterating through the decl chain on the DeclContext. In some cases this means that ASTNodeImporter::VisitFieldDecl ends up importing a decl into the DeclContext a second time. The patch removes the short-circuit in the case where we don't find any decls via the regular lookup. **Tests** * Un-skip the failing LLDB API tests Differential Revision: https://reviews.llvm.org/D133945
2022-09-16[lldb][tests][gmodules] Test for expression evaluator crash for types ↵Michael Buch
referencing the same template The problem here is that the ASTImporter adds the template class member FieldDecl to the DeclContext twice. This happens because we don't construct a `LookupPtr` for decls that originate from modules and thus the ASTImporter never realizes that the FieldDecl has already been imported. These duplicate decls then break the assumption of the LayoutBuilder which expects only a single member decl to exist. The test will be fixed by a follow-up revision and is thus skipped for now. Differential Revision: https://reviews.llvm.org/D133944
2022-09-14[lldb][tests] Move C++ gmodules tests into new gmodules/ subdirectoryMichael Buch
This is in preparation for adding more gmodules tests. Differential Revision: https://reviews.llvm.org/D133876
2022-06-17[lldb][tests] Automatically call compute_mydir (NFC)Dave Lee
Eliminate boilerplate of having each test manually assign to `mydir` by calling `compute_mydir` in lldbtest.py. Differential Revision: https://reviews.llvm.org/D128077
2022-06-08[lldb] Add assertState function to the API test suiteJonas Devlieghere
Add a function to make it easier to debug a test failure caused by an unexpected state. Currently, tests are using assertEqual which results in a cryptic error message: "AssertionError: 5 != 10". Even when a test provides a message to make it clear why a particular state is expected, you still have to figure out which of the two was the expected state, and what the other value corresponds to. We have a function in lldbutil that helps you convert the state number into a user readable string. This patch adds a wrapper around assertEqual specifically for comparing states and reporting better error messages. The aforementioned error message now looks like this: "AssertionError: stopped (5) != exited (10)". If the user provided a message, that continues to get printed as well. Differential revision: https://reviews.llvm.org/D127355
2021-02-03[lldb] Convert more assertTrue to assertEqual (NFC)Dave Lee
Follow up to D95813, this converts multiline assertTrue to assertEqual. Differential Revision: https://reviews.llvm.org/D95899
2020-02-13[lldb] Replace assertTrue(a == b, "msg") with assertEquals(a, b, "msg") in ↵Raphael Isemann
the test suite Summary: The error message from the construct `assertTrue(a == b, "msg") ` are nearly always completely useless for actually debugging the issue. This patch is just replacing this construct (and similar ones like `assertTrue(a != b, ...)` with the proper call to assertEqual or assertNotEquals. This patch was mostly written by a shell script with some manual verification afterwards: ``` lang=python import sys def sanitize_line(line): if line.strip().startswith("self.assertTrue(") and " == " in line: line = line.replace("self.assertTrue(", "self.assertEquals(") line = line.replace(" == ", ", ", 1) if line.strip().startswith("self.assertTrue(") and " != " in line: line = line.replace("self.assertTrue(", "self.assertNotEqual(") line = line.replace(" != ", ", ", 1) return line for a in sys.argv[1:]: with open(a, "r") as f: lines = f.readlines() with open(a, "w") as f: for line in lines: f.write(sanitize_line(line)) ``` Reviewers: labath, JDevlieghere Reviewed By: labath Subscribers: abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D74475
2020-02-11[lldb][test] Remove symlink for API tests.Jordan Rupprecht
Summary: Moves lldbsuite tests to lldb/test/API. This is a largely mechanical change, moved with the following steps: ``` rm lldb/test/API/testcases mkdir -p lldb/test/API/{test_runner/test,tools/lldb-{server,vscode}} mv lldb/packages/Python/lldbsuite/test/test_runner/test lldb/test/API/test_runner for d in $(find lldb/packages/Python/lldbsuite/test/* -maxdepth 0 -type d | egrep -v "make|plugins|test_runner|tools"); do mv $d lldb/test/API; done for d in $(find lldb/packages/Python/lldbsuite/test/tools/lldb-vscode -maxdepth 1 -mindepth 1 | grep -v ".py"); do mv $d lldb/test/API/tools/lldb-vscode; done for d in $(find lldb/packages/Python/lldbsuite/test/tools/lldb-server -maxdepth 1 -mindepth 1 | egrep -v "gdbremote_testcase.py|lldbgdbserverutils.py|socket_packet_pump.py"); do mv $d lldb/test/API/tools/lldb-server; done ``` lldb/packages/Python/lldbsuite/__init__.py and lldb/test/API/lit.cfg.py were also updated with the new directory structure. Reviewers: labath, JDevlieghere Tags: #lldb Differential Revision: https://reviews.llvm.org/D71151