aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/Shell/SymbolFile
AgeCommit message (Collapse)AuthorFilesLines
6 daysAdd support for DW_FORM_GNU_ref_alt and DW_FORM_GNU_strp_alt. (#176056)Greg Clayton2-0/+65
LLDB's DWARF parser didn't support parsing DW_FORM_GNU_ref_alt and DW_FORM_GNU_strp_alt forms which would cause any file loaded by LLDB to fail to parse any DWARF. Added support for parsing this information only, not for actually finding the debug info reference to an alternate file or a string in an alternate file. These extensions are used by DWZ files which are present in some linux distros, so it will be good for LLDB to just be able to parse these without emitting an error like: (lldb) b bar warning: (arm64) /tmp/a.out unsupported DW_FORM values: 0x1f20 0x1f21
7 days[lldb][NativePDB] Fix crash in debugger when PDB has bad type index value ↵Vladimir Gorsunov2-0/+301
(#166455) Fix crash when an inline site record in the PDB file contains type index which is out of bounds
2026-01-13Fix typos and spelling errors across codebase (#156270)Austin Jiang1-1/+1
Corrected various spelling mistakes such as 'occurred', 'receiver', 'initialized', 'length', and others in comments, variable names, function names, and documentation throughout the project. These changes improve code readability and maintain consistency in naming and documentation. Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2025-12-14[NFCI][lldb][test][asm] Enable AT&T syntax explicitly (#166770)Raul Tambre3-0/+3
Implementation files using the Intel syntax typically explicitly specify it. Do the same for the few files using AT&T syntax. This enables building LLVM with `-mllvm -x86-asm-syntax=intel` in one's Clang config files (i.e. a global preference for Intel syntax).
2025-12-14[LLDB][NativePDB] Create typedefs in structs (#169248)nerix2-19/+48
Typedef/using declarations in structs and classes were not created with the native PDB plugin. The following would only create `Foo` and `Foo::Bar`: ```cpp struct Foo { struct Bar {}; using Baz = Bar; using Int = int; }; ``` With this PR, they're created. One complication is that typedefs and nested types show up identical. The example from above gives: ``` 0x1006 | LF_FIELDLIST [size = 40, hash = 0x2E844] - LF_NESTTYPE [name = `Bar`, parent = 0x1002] - LF_NESTTYPE [name = `Baz`, parent = 0x1002] - LF_NESTTYPE [name = `Int`, parent = 0x0074 (int)] ``` To distinguish nested types and typedefs, we check if the parent of a type is equal to the current one (`parent(0x1002) == 0x1006`) and if the basename matches the nested type name.
2025-12-12[LLDB][NativePDB] Use original struct name when searching for constants ↵nerix2-3/+20
(#166845) We used to search for constants using the name we parsed. For C++, this would mean using the demangled struct name (from the unique name). This name is not always equal to the one used for the struct's name by the compiler. For example: ``` 0x105E | LF_STRUCTURE [size = 120, hash = 0xF38F] ``anonymous namespace'::Anonymous<A::B::C<void> >::D` unique name: `.?AUD@?$Anonymous@U?$C@X@B@A@@@?A0x8C295248@@` ``` We would use the unique name and get to `(anonymous namespace)::Anonymous<struct A::B::C<void>>::D`. Then, when finding the constant in the field list, we'd search for `(anonymous namespace)::Anonymous<struct A::B::C<void>>::D::StaticMember`. This wouldn't yield any results, because the constant will use the demangled name as given by the compiler. With this PR, we use the struct's name as given in the PDB and append the member name.
2025-12-01[LLDB][NativePDB] Look for PDBs in `target.debug-file-search-paths` (#169719)nerix1-0/+76
Similar to DWARF's DWO, we should look for PDBs in `target.debug-file-search-paths` if the PDB isn't at the original location or next to the executable. With this PR, the search order is as follows: 1. PDB path specified in the PE/COFF file 2. Next to the executable 3. In `target.debug-file-search-paths` This roughly matches [the order Visual Studio uses](https://learn.microsoft.com/en-us/visualstudio/debugger/specify-symbol-dot-pdb-and-source-files-in-the-visual-studio-debugger?view=vs-2022#where-the-debugger-looks-for-symbols), except that we don't have a project folder and don't support symbol servers. Closes #125355 (though I think this is already fixed in the native plugin).
2025-11-28[LLDB][PDB] Relax check for resolving breakpoint (#169932)nerix1-1/+1
The test was flaky, because it assumed that the breakpoint was always resolved before `r` was executed (https://github.com/llvm/llvm-project/pull/169728#issuecomment-3589799783). This PR removes the check for this order. It still checks that the breakpoint is resolved before it is hit.
2025-11-28[LLDB][PDB] Access object file through module (#169728)nerix1-0/+39
When a PDB is loaded through `target symbols add <pdb-path>`, its `m_objectfile_sp` is an `ObjectFilePDB` instead of `ObjectFilePECOFF` (the debugged module). In both the native and DIA plugin, some paths assumed that `m_objectfile_sp` is the debugged module. With this PR, they go through `m_objfile_sp->GetModule()->GetObjectFile()`. For the DIA plugin, this lead to an assertion failure (https://github.com/llvm/llvm-project/issues/169628#issuecomment-3582555277) and for both plugins, it meant that the symbol table wasn't loaded.
2025-11-17[lldb][test] Try to fix dwarf64 test on WindowsDavid Spickett1-1/+1
Think it's just a path slash difference. Fixes #167997.
2025-11-14[lldb] Add the ability to load DWARF64 .debug_str_offsets tables for DWARF32 ↵Greg Clayton3-0/+169
DWARF units in .dwp files in LLDB. (#167997) This patch is updating the reading capabilities of the LLDB DWARF parser for a llvm-dwp patch https://github.com/llvm/llvm-project/pull/167457 that will emit .dwp files where the compile units are DWARF32 and the .debug_str_offsets tables will be emitted as DWARF64 to allow .debug_str sections that exceed 4GB in size.
2025-11-13[LLDB] Use %clang_host instead of %clang in test (NFC)Adrian Prantl1-2/+2
2025-11-05[LLDB][NativePDB] Add non-overlapping fields in root struct (#166243)nerix1-4/+4
When anonymous unions are used in a struct or vice versa, their fields are merged into the parent record when using PDB. LLDB tries to recreate the original definition of the record _with_ the anonymous unions/structs. For tagged unions (like `std::optional`) where the tag followed the anonymous union, the result was suboptimal: ```cpp // input: struct Foo { union { Bar b; char c; }; bool tag; }; // reconstructed: struct Foo { union { Bar b; struct { char c; bool tag; }; }; }; ``` Once the algorithm is in some nested union, it can't get out. In the above case, we can get to the correct reconstructed record if we always add fields that don't overlap others in the root struct. So when we see `tag`, we'll see that it comes after all other fields, so it's possible to add it in the root `Foo`.
2025-10-31[LLDB][NativePDB] Estimate symbol sizes (#165727)nerix1-15/+15
In #165604, a test was skipped on Windows, because the native PDB plugin didn't set sizes on symbols. While the test isn't compiled with debug info, it's linked with `-gdwarf`, causing a PDB to be created on Windows. This PDB will only contain the public symbols (written by the linker) and section information. The symbols themselves don't have a size, however the DIA SDK sets a size for them. It seems like, for these data symbols, the size given from DIA is the distance to the next symbol (or the section end). This PR implements the naive approach for the native plugin. The main difference is in function/code symbols. There, DIA searches for a corresponding `S_GPROC32` which have a "code size" that is sometimes slightly smaller than the difference to the next symbol.
2025-10-30[NFCI][lldb][test] Fix mismatched C/C++ substitutions (#165773)Raul Tambre26-64/+64
Most of the cases were where a C++ file was being compiled with the C substitution. There were a few cases of the opposite though. LLDB seems to be the only real culprit in the LLVM codebase for these mismatches. Rest of the LLVM presumably sticks at least language-specific options in the common substitutions making the mistakes immediately apparent. I found these by using Clang frontend configuration files containing language-specific options for both C and C++ (e.g. `-std=c2y` and `-std=c++26`).
2025-10-29[LLDB] Use native PDB reader by default (#165363)nerix2-7/+7
All PDB tests now pass when compiled without DIA on Windows, so they pass with the native reader. With this PR, the default reader changes to the native reader. The plan is to eventually remove the DIA reader (see https://discourse.llvm.org/t/rfc-removing-the-dia-pdb-plugin-from-lldb/87827 and #114906). For now, DIA can be used by setting `plugin.symbol-file.pdb.reader` to `dia` or by setting `LLDB_USE_NATIVE_PDB_READER=0` (mostly undocumented, but used in tests).
2025-10-28[LLDB][PDB] Run `function-nested-block.test` with both plugins (#165364)nerix1-2/+4
This test passes with both plugins, but only ran with the DIA plugin. It was fixed with #161678, where I missed this test.
2025-10-27[LLDB][NativePDB] Create simple types from function arguments and return ↵nerix2-18/+17
types (#163621) When creating all types in a compilation unit, simple types (~> primitive and pointer types) that were only used in function arguments or return types weren't created as LLDB `Type`s. With this PR, they're created when creating the function/method types. This makes it possible to run the `SymbolFile/PDB/typedefs.test` with both plugins.
2025-10-21[LLDB][NativePDB] Require `target-windows` for `func-symbols.test` (#164406)nerix1-1/+1
The test builds files for Windows, so the target has to be required. I didn't add this in #163733. Fixes the failure from https://github.com/llvm/llvm-project/pull/163733#issuecomment-3426275296.
2025-10-21[LLDB][PDB] Run `pointers.test` with both plugins (#163623)nerix1-18/+24
The `pointers.test` was only run with the DIA plugin. I made the following changes: - Remove the check for the function type. The types of the function are different in the plugins: ``` Native: Type{0x00010084} , size = 0, compiler_type = 0x00000209aff60060 int (int) __attribute__((thiscall)) DIA: Type{0x0000000a} , name = "f", decl = PointerTypeTest.cpp:8, compiler_type = 0x0000020bc22356c0 int (int) __attribute__((thiscall)) ``` In DIA, each function gets its own type with a name and decl. In the native plugin, only one unnamed type is created per signature. This matches DWARF. - The check for the `struct ST` fields was split, because the order of members and methods is swapped between the plugins. In DIA, the member is first and in the native plugin the method is first. We still check that both are in the struct. - The type names for the local variables are different. The native plugin includes <code>\`extern "C" main'::\`2'::ST</code> which I added as an allowed prefix. This comes from the mangled name of the struct `ST` - `.?AUST@?1??main@@9@`. - The location of local variables is different. DIA creates one static location (e.g. `DW_OP_breg6 ESI-52`) whereas the native plugin limits the location to the block (e.g. `[0x0040100d, 0x00401038): DW_OP_breg6 ESI-52`). This gets printed on a second line and the `location` starts with `0x00000000:` - DIA adds a decl for each parameter (and local variable). However, this information is not contained in the PDB. I'm not sure how DIA calculates this. It's often wrong and assumes variables are declared earlier. For example, in this test ([PointerTypeTest.cpp](https://github.com/llvm/llvm-project/blob/2b135b931338a57c38d9c4a34ffdd59877ba82d6/lldb/test/Shell/SymbolFile/PDB/Inputs/PointerTypeTest.cpp)), it assumes that all local variables of `main` are created on line 4. The native plugin doesn't include this, so I made the check optional.
2025-10-21[LLDB][PDB] Split `func-symbols.test` between DIA and native (#163733)nerix2-1/+134
The test checks that functions have the correct type assigned. Because of the differences between the two PDB plugins, I split the test. DIA creates one named `Type` per function and uses identical UIDs for `Type` and `Function`, whereas native creates one unnamed type per signature and has different UIDs. The native test has the same input and checks the same functions. I also removed the `target-windows` requirement from the test, since it only uses `lldb-test`.
2025-10-15[LLDB][NativePDB] Consolidate simple types (#163209)nerix2-9/+24
This aligns the simple types created by the native plugin with the ones from DIA as well as LLVM and the original cvdump. - A few type names weren't handled when creating the LLDB `Type` name (e.g. `short`) - 64-bit integers were created as `(u)int64_t` and are now created as `(unsigned) long long` (matches DIA) - 128-bit integers (only supported by clang-cl) weren't created as types (they have `SimpleTypeKind::(U)Int128Oct`) - All complex types had the same name - now they have `_Complex <float-type>` Some types like `SimpleTypeKind::Float48` can't be tested because they can't be created in C++.
2025-10-13[LLDB][NativePDB] Use typedef compiler type for typedef types (#156250)nerix1-0/+127
Before this PR, the native PDB plugin would create the following LLDB `Type` for `using SomeTypedef = long`: ``` Type{0x00002e03} , name = "SomeTypedef", size = 4, compiler_type = 0x000002becd8d8620 long ``` with this PR, the following is created: ``` Type{0x00002e03} , name = "SomeTypedef", size = 4, compiler_type = 0x0000024d6a7e3c90 typedef SomeTypedef ``` This matches the behavior of the DIA PDB plugin and works towards making [`Shell/SymbolFile/PDB/typedefs.test`](https://github.com/llvm/llvm-project/blob/main/lldb/test/Shell/SymbolFile/PDB/typedefs.test) pass with the native plugin. I added a similar test to the `NativePDB` shell tests to capture the current state, which doesn't quite match that of DIA yet. I'll add some comments on what's missing on this PR, because I'm not fully sure what the correct output would be.
2025-10-07[LLDB] Require target-x86/x86_64 for MSVC C mangling test (#162335)nerix1-1/+1
Fixes the test failure from https://github.com/llvm/llvm-project/pull/161678#issuecomment-3377949862.
2025-10-07Reland "[LLDB][NativePDB] Create functions with mangled name" (#161678)nerix9-23/+75
Relands #149701 which was reverted in https://github.com/llvm/llvm-project/commit/185ae5cdc695248b58ae017508cc764c19bee5b7 because it broke demangling of Itanium symbols on i386. The last commit in this PR adds the fix for this (discussed in #160930). On x86 environments, the prefix of `__cdecl` functions will now be removed to match DWARF. I opened #161676 to discuss this for the other calling conventions.
2025-10-02[lldb] Add lld requirement to NativePDB test (#161731)Alex Langford1-1/+1
The cpp file fails to build without `lld-link`.
2025-09-29[lldb][DWARFASTParserClang] Simplify obsolete error condition for malformed ↵Michael Buch5-4/+427
array member type offsets (#160132) First time check was introduced in `fa3ab4599d717feedbb83e08e7f654913942520b` to work around a debug-info generation bug in Clang. This bug was fixed in Clang-4. The check has since been adjusted (first in `808ff186f6a6ba1fd38cc7e00697cd82f4afe540`, and then most recently in `370db9c62910195e664e82dde6f0adb3e255a4fd`). This check is getting quite convoluted, and all it does is turn an `array[1]` into an `array[0]` type when it is deemed correct. At this point the workaround probably never fires, apart from actually valid codegen. This patch removes the special conditions and emits the error specifically in those cases where we know the DWARF is malformed. Added some shell tests for the error case.
2025-09-25Revert "[LLDB][NativePDB] Create functions with mangled name (#149701)"Martin Storsjö8-24/+23
This reverts commit e98f34eb08b2bf7aed787e7f8a7cea9111f044c8. This broke demangling of Itanium symbols on i386.
2025-09-25[lldb][test] Make hex prefix optional in DWARF union types testDavid Spickett1-1/+1
Fixes #159401 On Windows there is no hex prefix, I suspect because somewhere we print a pointer. I'd prefer to fix that itself but can't get to a Windows machine at the moment. It's not important to the purpose of the test anyway.
2025-09-24Fix a bug where an error was emitted for GCC union types. (#159401)Greg Clayton1-0/+182
GCC doesn't add DW_AT_data_member_location attributes to the DW_TAG_member children of DW_TAG_union_type types. An error was being emitted incorrectly for these cases fr om the DWARFASTParserClang. This fixes that issue and adds a test.
2025-09-24[LLDB][NativePDB] Create functions with mangled name (#149701)nerix8-23/+24
Before, functions created using the NativePDB plugin would not know about their mangled name. This showed when printing a stacktrace. There, only the function name was shown. For https://github.com/llvm/llvm-project/issues/143149, the mangled function name is required to separate different parts. This PR adds that name if available. The Clang AST nodes also take in a mangled name, which was previously unset. I don't think this unblocks anything further, because Clang can mangle the function anyway.
2025-09-24[LLDB][PDB] Fix plugin warning message style (#160398)nerix1-3/+3
Makes the warning message conform to the [LLVM error and warning style](https://llvm.org/docs/CodingStandards.html#error-and-warning-messages) as mentioned in https://github.com/llvm/llvm-project/pull/160067#discussion_r2373391186.
2025-09-23[LLDB][PDB] Warn if DIA plugin is requested but not available (#160067)nerix2-6/+96
If LLDB was built without the DIA SDK and the DIA reader is explicitly requested (through `LLDB_USE_NATIVE_PDB_READER=0` or `settings set plugin.symbol-file.pdb.reader dia`), LLDB should print a warning, because it will use the native reader in any case (https://github.com/llvm/llvm-project/pull/159769#discussion_r2367316980). This PR adds the warning and a test when LLDB is not built with the SDK on Windows. I don't think any builder runs this configuration, as there are still five failing tests. I tested this locally with and without the SDK.
2025-09-23[LLDB][PDB] Run UDT layout test with native PDB too (#159769)nerix2-1/+130
This test was failing with the native plugin due to two reasons: 1. The static `C::abc` was printed as `(int) ::C::abc = 123` 2. The order of the base classes of [`C` (`List::Value`)](https://github.com/llvm/llvm-project/blob/b7e4edca3d56ec87f719c202f5397b245595f7cc/lldb/test/Shell/SymbolFile/PDB/Inputs/UdtLayoutTest.cpp#L30) is different between DIA and the native plugin. I don't know how the order in the DIA plugin is determined - it prints `B<0>`, `B<1>`, `B<2>`, `B<3>`, `A`. The native plugin follows the order of the bases in memory and prints `B<2>`, `B<3>`, `A`, `B<0>`, `B<1>` (last three are the virtual bases). <details><summary>Class layout of C</summary> ``` class C size(88): +--- 0 | +--- (base class B<2>) 0 | | {vbptr} 8 | | _a 9. | | _b (bitstart=3,nbits=6) 11 | | _c | +--- 15 | +--- (base class B<3>) 15 | | {vbptr} 23 | | _a 24. | | _b (bitstart=3,nbits=6) 26 | | _c | +--- | <alignment member> (size=2) 32 | _x 36 | _y 38 | _z | <alignment member> (size=1) | <alignment member> (size=2) +--- +--- (virtual base A) 40 | {vfptr} 48 | U _u | <alignment member> (size=4) +--- +--- (virtual base B<0>) 56 | {vbptr} 64 | _a 65. | _b (bitstart=3,nbits=6) 67 | _c +--- +--- (virtual base B<1>) 71 | {vbptr} 79 | _a 80. | _b (bitstart=3,nbits=6) 82 | _c +--- ``` </details> I split the tests for the plugins for better readability.
2025-09-18[LLDB][NativePDB] Add modifiers to modified type name (#159296)nerix2-22/+24
When creating LLDB types from `LF_MODIFIER` records, the type name of the modified type was used. This didn't include the modifiers (`const`/`volatile`/`__unaligned`). With this PR, they're included. The DIA plugin had a test for this. That test also assumed that function types had a name. I removed that check here, because function/procedure types themselves in PDB don't have a name: ``` 0x1015 | LF_ARGLIST [size = 20, hash = 0xBCB6] 0x0074 (int): `int` 0x1013: `int* __restrict` 0x1014: `int& __restrict` 0x1016 | LF_PROCEDURE [size = 16, hash = 0x3F611] return type = 0x0003 (void), # args = 3, param list = 0x1015 calling conv = cdecl, options = None ``` I assume DIA gets the name from the function symbol itself. In the native plugin, that name isn't included and multiple functions with the same signature will reuse one type, whereas DIA would create a new type for each function. The [Shell/SymbolFile/PDB/func-symbols.test](https://github.com/llvm/llvm-project/blob/b29c7ded31d81ca47aed0157c543c8b6a0f5866c/lldb/test/Shell/SymbolFile/PDB/func-symbols.test) also relies on this.
2025-09-15[LLDB][PDB] Require Windows for for testing PDB plugin-selection again (#158559)nerix1-1/+1
Amends #158284 and fixes the failure on `lldb-remote-linux-win` from https://github.com/llvm/llvm-project/pull/158284#issuecomment-3290154510. That builder is configured with the DIA SDK but builds for Linux, so the debug information will be DWARF, not PDB.
2025-09-13[LLDB] Require DIA SDK for testing the PDB plugin-selection setting (#158284)nerix1-1/+1
If LLDB is built without the DIA SDK enabled, then the native plugin is used regardless of `plugin.symbol-file.pdb.reader` or `LLDB_USE_NATIVE_PDB_READER`. This made the test fail on Windows when the DIA SDK was disabled (https://github.com/llvm/llvm-project/issues/114906#issuecomment-3241796062). This PR changes the requirement for the test from `target-windows` to `diasdk` (only used in this test).
2025-09-11[LLDB][NativePDB] Implement `AddSymbols` (#154121)nerix5-3/+98
This PR implements `SymbolFileNativePDB::AddSymbols` which adds public symbols to the symbol table. These symbols are found in the publics stream. It contains mangled names coupled with addresses. Addresses are a pair of (segment, offset). If I understood correctly, then the segment is the section ID from the COFF header. Sections are already [constructed](https://github.com/llvm/llvm-project/blob/c48ec7fb60b5e0b4100731d75f82ea63c0ec7b45/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp#L1048) using this 1-based index ([MS docs](https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#section-table-section-headers)). This allows us to use `section_list->FindSectionByID`.
2025-09-09[LLDB][NativePDB] Mark blocks as parsed after parsing (#157493)nerix1-12/+22
After parsing blocks in a function, the blocks should be marked as parsed for them to be dumped (see [Function::Dump](https://github.com/llvm/llvm-project/blob/e6aefbec782dbb57f72eb0ae399ed944fe49db2e/lldb/source/Symbol/Function.cpp#L446-L447)). As explained in https://github.com/llvm/llvm-project/issues/114906#issuecomment-3255016266, this happens (accidentally?) in the DIA plugin when parsing variables, because it calls `function.GetBlock(can_create=true)` which marks blocks as parsed. In the native plugin, this was never called, so blocks and variables were never included in the `lldb-test symbols` output. The `variables.test` for the DIA plugin tests this. One difference between the plugins is how they specify the location of local variables. This causes the output of the native plugin to be two lines per variable, whereas the DIA plugin has one line: ``` (native): 000002C4B7593020: Variable{0x1c800001}, name = "var_arg1", type = {0000000000000744} 0x000002C4B6CA7900 (int), scope = parameter, location = 0x00000000: [0x000000014000102c, 0x000000014000103e): DW_OP_breg7 RSP+8 ``` ``` (DIA): 000002778C827EE0: Variable{0x0000001b}, name = "var_arg1", type = {0000000000000005} 0x000002778C1FBAB0 (int), scope = parameter, decl = VariablesTest.cpp:32, location = DW_OP_breg7 RSP+8 ``` In the test, I filtered lines starting with spaces followed by `[0x`, so we can still use `CHECK-NEXT`. --- Another difference between the plugins is that DIA marks the `this` pointer as artificial (equivalent to DWARF). This is done if a variable's object kind is `ObjectPtr` ([source](https://github.com/llvm/llvm-project/blob/ab898f32c60689d1d47d0b6de66c30d3476994bb/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp#L1050)). As far as I know, there isn't anything in the debug info that says "this variable is the `this` pointer" other than the name/type of a variable and the type of the function.
2025-09-04[LLDB] Fix deterministic-build.cpp post #156931 (#156983)Aiden Grossman1-1/+1
This test was brokem by migrating to the lit internal shell due to a lack of env prefix for setting environment variables. This was fixed in prevented the breakpoint in the test from mapping to anything, causing the test to file. This patch restores the original line numbering.
2025-09-04[LLDB] Fix tests that fail when using internal shell. (#156931)cmtice2-3/+2
These tests were failing on darwin, because the internal shell needs environment var definitions to start with 'env'. This PR (hopefully) fixes that problem.
2025-09-04[LLDB][NativePDB] Find global variables in namespaces (#156736)nerix1-1/+2
To find global variables, `SymbolFileNativePDB` used to search the globals stream for the name passed to `FindGlobalVariables`. However, the symbols in the globals stream contain the fully qualified name and `FindGlobalVariables` only gets the basename. The approach here is similar to the one for types and functions. As we already search the globals stream for functions, we can cache the basenames for global variables there as well. This makes the `expressions.test` from the DIA PDB plugin pass with the native one (#114906).
2025-09-03[LLDB] Make internal shell the default for running LLDB lit tests. (#156729)cmtice1-2/+2
This patch updates the lld lit test config to use the internal shell by default. This has some performance advantages (~10-15%) and also produces nicer failure output. It also updates the two LLDB tests to not require shell (so that they run under the internal shell), after first verifying that they run and pass using the internal shell; and it fixes one test that was not passing under the internal shell.
2025-09-03[lldb][DWARFASTParserClang] Don't complete conflicting Objective-C++ types ↵Michael Buch1-0/+70
(#156681) This upstreams https://github.com/swiftlang/llvm-project/pull/10313. If we detect a situation where a forward declaration is C++ and the definition DIE is Objective-C, then just don't try to complete the type (it would crash otherwise). In the long term we might want to add support for completing such types. We've seen real world crashes when debugging WebKit and wxWidgets because of this. Both projects forward declare ObjC++ decls in the way shown in the test. rdar://145959981
2025-09-02[LLDB][NativePDB] Complete array member types in AST builder (#156370)nerix3-45/+114
2025-09-01[llldb][test] Mark a DWO test unsupported on Darwin and Windows (#156306)David Spickett1-0/+3
This uses split DWARF and from looking at other tests, it should not be running on Darwin or Windows. It does pass using the DIA PDB plugin but I think this is misleading because it's not actually testing the intended feature. When the native PDB plugin is used it fails because it cannot set a breakpoint. I don't see a point to running this test on Windows at all. Native PDB plugin test failures are being tracked in #114906.
2025-08-13[LLDB][NativePDB] Resolve declaration for tag types (#152579)nerix3-1/+73
Tag types like stucts or enums didn't have a declaration attached to them. The source locations are present in the IPI stream in `LF_UDT_MOD_SRC_LINE` records: ``` 0x101F | LF_UDT_MOD_SRC_LINE [size = 18, hash = 0x1C63] udt = 0x1058, mod = 3, file = 1, line = 0 0x2789 | LF_UDT_MOD_SRC_LINE [size = 18, hash = 0x1E5A] udt = 0x1253, mod = 35, file = 93, line = 17069 ``` The file is an ID in the string table `/names`: ``` ID | String 1 | '\<unknown>' 12 | 'D:\a\_work\1\s\src\ExternalAPIs\WindowsSDKInc\c\Include\10.0.22621.0\um\wingdi.h' 93 | 'D:\a\_work\1\s\src\ExternalAPIs\WindowsSDKInc\c\Include\10.0.22621.0\um\winnt.h' ``` Here, we're not interested in `mod`. This would indicate which module contributed the UDT. I was looking at Rustc's PDB and found that it uses `<unknown>` for some types, so I added a check for that. This makes two DIA PDB shell tests to work with the native PDB plugin. --------- Co-authored-by: Michael Buch <michaelbuch12@gmail.com>
2025-08-12Reland "[LLDB][NativePDB] Find functions by basename" ( #152295) (#153160)nerix1-6/+81
Relands #152295. Checking for the overloads did not account for them being out of order. For example, [the failed output](https://github.com/llvm/llvm-project/pull/152295#issuecomment-3177563247) contained the overloads, but out of order. The last commit here fixes that by using `-DAG`. --------- Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2025-08-11Revert "[LLDB][NativePDB] Find functions by basename" (#153131)Jonas Devlieghere1-81/+6
Reverts llvm/llvm-project#152295
2025-08-11[LLDB][NativePDB] Find functions by basename (#152295)nerix1-6/+81
This adds the ability for functions to be matched by their basename. Before, the globals were searched for the name. This works if the full name is available but fails for basenames. PDB only includes the full names of functions, so we need to cache all basenames. This is (again) very similar to [SymbolFilePDB](https://github.com/llvm/llvm-project/blob/b242150b075a8a720b00821682a9469258bbcd30/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp#L1291-L1383). There are two main differences: - We can't just access the parent of a function to determine that it's a member function - we need to check the type of the function, and its "this type". - SymbolFilePDB saved the full method name in the map. However, when searching for methods, only the basename is passed, so the function never found any methods. Fixes #51933. --------- Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>