aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo
AgeCommit message (Collapse)AuthorFilesLines
4 days[DWARFVerifier] Verify that DW_AT_LLVM_stmt_sequence is set correctly (#152807)Peter Rong1-0/+80
Sometimes DW_AT_LLVM_stmt_sequence won't point to the correct offset. This feature helps us debug when/where it went wrong. Added a new test and manually tempered with the value to show the intended verification result. --------- Signed-off-by: Peter Rong <PeterRong@meta.com>
4 days[llvm-debuginfo-analyzer] Remove `LVScope::Children` container (#144750)Javier Lopez-Gomez1-41/+35
Remove the `LVScope::Children` container and use `llvm::concat()` instead to return a view over the types, symbols, and sub-scopes contained in a given `LVScope`. Fixes #69160.
10 days[llvm-debuginfo-analyzer] Add `--output-sort=(none|id)` option (#145761)Javier Lopez-Gomez1-3/+9
- The output for `--output-sort=id` matches `--output-sort=offset` for the available readers. Tests were updated accordingly. - For `--output-sort=none`, and per `LVReader::sortScopes()`, `LVScope::sort()` is called on the root scope. `LVScope::sort()` has no effect if `getSortFunction() == nullptr`, and thus the elements are currently traversed in the order in which they were initially added. This should change, however, after `LVScope::Children` is removed.
14 days[Dwarf] Support heterogeneous DW_{OP,AT}s needed for AMDGPU CFI (#153883)Scott Linder2-15/+60
These are defined in the user range until standard versions of them get adopted into dwarf, which is expected in DWARF6. Some of these amount to reservations currently as no code to use them is included. It would be very helpful to get them committed to avoid conflicts necessitating encoding changes while we are in the process of upstreaming. --------- Co-authored-by: Juan Martinez Fernandez <juamarti@amd.com> Co-authored-by: Emma Pilkington <Emma.Pilkington@amd.com>
2025-09-10[PDB] Add public symbol lookup by address (#157361)nerix1-0/+50
This adds a method on the `PublicsStream` to look up symbols using their address (segment + offset). It's largely a reimplementation of [`NearestSym`](https://github.com/microsoft/microsoft-pdb/blob/805655a28bd8198004be2ac27e6e0290121a5e89/PDB/dbi/gsi.cpp#L1492-L1581) from the reference. However, we don't return the nearest symbol, but the exact symbol. Still, in case of ICF, we return the symbol that's first in the address map. Users can then use the returned offset to read the next records to check if multiple symbols overlap, if desired. From #149701.
2025-09-08MC: Add Triple overloads for more MC constructors (#157321)Matt Arsenault1-7/+8
Avoids more Triple->string->Triple round trip. This is a continuation of f137c3d592e96330e450a8fd63ef7e8877fc1908
2025-08-29[llvm] Support building with c++23 (#154372)Kyle Krüger3-0/+12
closes #154331 This PR addresses all minimum changes needed to compile LLVM and MLIR with the c++23 standard. It is a work in progress and to be reviewed for better methods of handling the parts of the build broken by c++23.
2025-08-28Stateful variable-location annotations in Disassembler::PrintInstructions() ↵Abdullah Mohammad Amin1-60/+103
(follow-up to #147460) (#152887) **Context** Follow-up to [#147460](https://github.com/llvm/llvm-project/pull/147460), which added the ability to surface register-resident variable locations. This PR moves the annotation logic out of `Instruction::Dump()` and into `Disassembler::PrintInstructions()`, and adds lightweight state tracking so we only print changes at range starts and when variables go out of scope. --- ## What this does While iterating the instructions for a function, we maintain a “live variable map” keyed by `lldb::user_id_t` (the `Variable`’s ID) to remember each variable’s last emitted location string. For each instruction: - **New (or newly visible) variable** → print `name = <location>` once at the start of its DWARF location range, cache it. - **Location changed** (e.g., DWARF range switched to a different register/const) → print the updated mapping. - **Out of scope** (was tracked previously but not found for the current PC) → print `name = <undef>` and drop it. This produces **concise, stateful annotations** that highlight variable lifetime transitions without spamming every line. --- ## Why in `PrintInstructions()`? - Keeps `Instruction` stateless and avoids changing the `Instruction::Dump()` virtual API. - Makes it straightforward to diff state across instructions (`prev → current`) inside the single driver loop. --- ## How it works (high-level) 1. For the current PC, get in-scope variables via `StackFrame::GetInScopeVariableList(/*get_parent=*/true)`. 2. For each `Variable`, query `DWARFExpressionList::GetExpressionEntryAtAddress(func_load_addr, current_pc)` (added in #144238). 3. If the entry exists, call `DumpLocation(..., eDescriptionLevelBrief, abi)` to get a short, ABI-aware location string (e.g., `DW_OP_reg3 RBX → RBX`). 4. Compare against the last emitted location in the live map: - If not present → emit `name = <location>` and record it. - If different → emit updated mapping and record it. 5. After processing current in-scope variables, compute the set difference vs. the previous map and emit `name = <undef>` for any that disappeared. Internally: - We respect file↔load address translation already provided by `DWARFExpressionList`. - We reuse the ABI to map LLVM register numbers to arch register names. --- ## Example output (x86_64, simplified) ``` -> 0x55c6f5f6a140 <+0>: cmpl $0x2, %edi ; argc = RDI, argv = RSI 0x55c6f5f6a143 <+3>: jl 0x55c6f5f6a176 ; <+54> at d_original_example.c:6:3 0x55c6f5f6a145 <+5>: pushq %r15 0x55c6f5f6a147 <+7>: pushq %r14 0x55c6f5f6a149 <+9>: pushq %rbx 0x55c6f5f6a14a <+10>: movq %rsi, %rbx 0x55c6f5f6a14d <+13>: movl %edi, %r14d 0x55c6f5f6a150 <+16>: movl $0x1, %r15d ; argc = R14 0x55c6f5f6a156 <+22>: nopw %cs:(%rax,%rax) ; i = R15, argv = RBX 0x55c6f5f6a160 <+32>: movq (%rbx,%r15,8), %rdi 0x55c6f5f6a164 <+36>: callq 0x55c6f5f6a030 ; symbol stub for: puts 0x55c6f5f6a169 <+41>: incq %r15 0x55c6f5f6a16c <+44>: cmpq %r15, %r14 0x55c6f5f6a16f <+47>: jne 0x55c6f5f6a160 ; <+32> at d_original_example.c:5:10 0x55c6f5f6a171 <+49>: popq %rbx ; i = <undef> 0x55c6f5f6a172 <+50>: popq %r14 ; argv = RSI 0x55c6f5f6a174 <+52>: popq %r15 ; argc = RDI 0x55c6f5f6a176 <+54>: xorl %eax, %eax 0x55c6f5f6a178 <+56>: retq ``` Only transitions are shown: the start of a location, changes, and end-of-lifetime. --- ## Scope & limitations (by design) - Handles **simple locations** first (registers, const-in-register cases surfaced by `DumpLocation`). - **Memory/composite locations** are out of scope for this PR. - Annotations appear **only at range boundaries** (start/change/end) to minimize noise. - Output is **target-independent**; register names come from the target ABI. ## Implementation notes - All annotation printing now happens in `Disassembler::PrintInstructions()`. - Uses `std::unordered_map<lldb::user_id_t, std::string>` as the live map. - No persistent state across calls; the map is rebuilt while walking instruction by instruction. - **No changes** to the `Instruction` interface. --- ## Requested feedback - Placement and wording of the `<undef>` marker. - Whether we should optionally gate this behind a setting (currently always on when disassembling with an `ExecutionContext`). - Preference for immediate inclusion of tests vs. follow-up patch. --- Thanks for reviewing! Happy to adjust behavior/format based on feedback. --------- Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com> Co-authored-by: Adrian Prantl <adrian.prantl@gmail.com>
2025-08-27[llvm-debuginfo-analyzer] Fixed some DWARF related bugs (#153318)Adam Yang1-3/+7
This PR fixes two bugs in LogicalView: - `DW_AT_ranges` are not being read correctly - `DW_AT_high_pc` for scopes are treated as inclusive The test changes for llvm-debug-analyzer are mostly to address the DW_AT_high_pc change. There is a new test that further verifies the fixes.
2025-08-12[AMDGPU] Fixed llvm-debuginfo-analyzer for AMDGPU. (#145125)Adam Yang3-10/+18
Constructing Target triple with `ObjectFile::makeTriple` instead of just with `Arch` and leaving the rest unknown. Also creating the subtarget with the `CPU`. AMDGPU needs the full triple and `CPU` to disassemble correctly. To run a full test, also fixed a failure in `SIPreAllocateWWMRegs` with the `$noreg` operand in `DBG_VALUE`. --------- Co-authored-by: Matt Arsenault <arsenm2@gmail.com>
2025-08-07[DWARF] Speedup .gdb_index dumping (#151806)itrofimow1-7/+15
This patch drastically speed ups dumping .gdb_index for large indexes
2025-08-04[llvm] Use llvm::iterator_range::empty (NFC) (#151905)Kazu Hirata1-1/+1
2025-07-23[llvm] Remove unused includes (NFC) (#150265)Kazu Hirata2-5/+0
These are identified by misc-include-cleaner. I've filtered out those that break builds. Also, I'm staying away from llvm-config.h, config.h, and Compiler.h, which likely cause platform- or compiler-specific build failures.
2025-07-18[DebugInfo] Use llvm::remove_if (NFC) (#149543)Kazu Hirata1-1/+1
We can pass a range to llvm::remove_if.
2025-07-14[llvm] Remove unused includes (NFC) (#148768)Kazu Hirata1-4/+0
These are identified by misc-include-cleaner. I've filtered out those that break builds. Also, I'm staying away from llvm-config.h, config.h, and Compiler.h, which likely cause platform- or compiler-specific build failures.
2025-07-08[NFC] Separate UnwindTable from DebugFrame into a different type (#142521)AmirHossein PashaeeHir5-486/+579
By separating the Unwind table into a different file, this functionality can be a part of the DWARF library with no dependency on MC, which makes it usable in the MC layer. This is a continuation of [PR#14520](https://github.com/llvm/llvm-project/pull/142520).
2025-07-06[DebugInfo] [DWARF] Fix C to CMake comment (#147199)Guy David1-2/+2
This comment affects the actual dependency resolver, causing builds to randomly fail.
2025-07-03[DebugInfo] Remove an unnecessary cast (NFC) (#146809)Kazu Hirata1-1/+1
Mem is already of uint8_t *.
2025-06-28[DebugInfo] Remove an unnecessary cast (NFC) (#146217)Kazu Hirata1-1/+1
2025-06-27[llvm] Remove unused includes (NFC) (#146199)Kazu Hirata2-2/+0
These are identified by misc-include-cleaner. I've filtered out those that break builds. Also, I'm staying away from llvm-config.h, config.h, and Compiler.h, which likely cause platform- or compiler-specific build failures.
2025-06-27Reapply "[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#… ↵Sterling-Augustine14-702/+604
(#145959) (#146112) Reapply "[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#… (#145959) This reapplies cbf781f0bdf2f680abbe784faedeefd6f84c246e, with fixes for the shared-library build and the unconventional sanitizer-runtime build. Original Description: This is the culmination of a series of changes described in [1]. Although somewhat large by line count, it is almost entirely mechanical, creating a new library in DebugInfo/DWARF/LowLevel. This new library has very minimal dependencies, allowing it to be used from more places than the normal DebugInfo/DWARF library--in particular from MC. 1. https://discourse.llvm.org/t/rfc-debuginfo-dwarf-refactor-into-to-lower-and-higher-level-libraries/86665/2
2025-06-26Revert "[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#… ↵Sterling-Augustine13-602/+701
(#145959) …145081)" This reverts commit cbf781f0bdf2f680abbe784faedeefd6f84c246e. Breaks a couple of buildbots.
2025-06-26[NFC][DebugInfo][DWARF] Create new low-level dwarf library (#145081)Sterling-Augustine13-701/+602
This is the culmination of a series of changes described in [1]. Although somewhat large by line count, it is almost entirely mechanical, creating a new library in DebugInfo/DWARF/LowLevel. This new library has very minimal dependencies, allowing it to be used from more places than the normal DebugInfo/DWARF library--in particular from MC. I am happy to put it in another location, or to structure it differently if that makes sense. Some have suggested in BinaryFormat, but it is not a great fit there. But if that makes more sense to the reviewers, I can do that. Another possibility would be to use pass-through headers to allow clients who don't care to depend only on DebugInfo/DWARF. This would be a much less invasive change, and perhaps easier for clients. But also a system that hides details. Either way, I'm open. 1. https://discourse.llvm.org/t/rfc-debuginfo-dwarf-refactor-into-to-lower-and-higher-level-libraries/86665/2
2025-06-26[llvm] Use llvm::interleaved (NFC) (#145839)Kazu Hirata1-7/+2
Note that llvm::interleaved constructs a string with the elements from a given range with a given separator.
2025-06-26[llvm-debuginfo-analyzer] Fix crash with WebAssembly dead code (#141616)Carlos Alberto Enciso1-4/+11
https://github.com/llvm/llvm-project/issues/136772 Incorrect handling of 'tombstone' value for WebAssembly. llvm-debuginfo-analyzer already uses the tombstone approach to identify dead code. Currently, the tombstone value is evaluated as std::numeric_limits<uint64_t>::max(). Which is wrong as it does not take into account the 'Address Byte Size' from the Compile Unit header.
2025-06-24Add support for Windows Secure Hot-Patching (redo) (#145565)sivadeilra2-0/+14
(This is a re-do of #138972, which had a minor warning in `Clang.cpp`.) This PR adds some of the support needed for Windows hot-patching. Windows implements a form of hot-patching. This allows patches to be applied to Windows apps, drivers, and the kernel, without rebooting or restarting any of these components. Hot-patching is a complex technology and requires coordination between the OS, compilers, linkers, and additional tools. This PR adds support to Clang and LLVM for part of the hot-patching process. It enables LLVM to generate the required code changes and to generate CodeView symbols which identify hot-patched functions. The PR provides new command-line arguments to Clang which allow developers to identify the list of functions that need to be hot-patched. This PR also allows LLVM to directly receive the list of functions to be modified, so that language front-ends which have not yet been modified (such as Rust) can still make use of hot-patching. This PR: * Adds a `MarkedForWindowsHotPatching` LLVM function attribute. This attribute indicates that a function should be _hot-patched_. This generates a new CodeView symbol, `S_HOTPATCHFUNC`, which identifies any function that has been hot-patched. This attribute also causes accesses to global variables to be indirected through a `_ref_*` global variable. This allows hot-patched functions to access the correct version of a global variable; the hot-patched code needs to access the variable in the _original_ image, not the patch image. * Adds a `AllowDirectAccessInHotPatchFunction` LLVM attribute. This attribute may be placed on global variable declarations. It indicates that the variable may be safely accessed without the `_ref_*` indirection. * Adds two Clang command-line parameters: `-fms-hotpatch-functions-file` and `-fms-hotpatch-functions-list`. The `-file` flag may point to a text file, which contains a list of functions to be hot-patched (one function name per line). The `-list` flag simply directly identifies functions to be patched, using a comma-separated list. These two command-line parameters may also be combined; the final set of functions to be hot-patched is the union of the two sets. * Adds similar LLVM command-line parameters: `--ms-hotpatch-functions-file` and `--ms-hotpatch-functions-list`. * Adds integration tests for both LLVM and Clang. * Adds support for dumping the new `S_HOTPATCHFUNC` CodeView symbol. Although the flags are redundant between Clang and LLVM, this allows additional languages (such as Rust) to take advantage of hot-patching support before they have been modified to generate the required attributes. Credit to @dpaoliello, who wrote the original form of this patch.
2025-06-24Revert "Add support for Windows Secure Hot-Patching" (#145553)Qinkun Bao2-14/+0
Reverts llvm/llvm-project#138972
2025-06-24Add support for Windows Secure Hot-Patching (#138972)sivadeilra2-0/+14
This PR adds some of the support needed for Windows hot-patching. Windows implements a form of hot-patching. This allows patches to be applied to Windows apps, drivers, and the kernel, without rebooting or restarting any of these components. Hot-patching is a complex technology and requires coordination between the OS, compilers, linkers, and additional tools. This PR adds support to Clang and LLVM for part of the hot-patching process. It enables LLVM to generate the required code changes and to generate CodeView symbols which identify hot-patched functions. The PR provides new command-line arguments to Clang which allow developers to identify the list of functions that need to be hot-patched. This PR also allows LLVM to directly receive the list of functions to be modified, so that language front-ends which have not yet been modified (such as Rust) can still make use of hot-patching. This PR: * Adds a `MarkedForWindowsHotPatching` LLVM function attribute. This attribute indicates that a function should be _hot-patched_. This generates a new CodeView symbol, `S_HOTPATCHFUNC`, which identifies any function that has been hot-patched. This attribute also causes accesses to global variables to be indirected through a `_ref_*` global variable. This allows hot-patched functions to access the correct version of a global variable; the hot-patched code needs to access the variable in the _original_ image, not the patch image. * Adds a `AllowDirectAccessInHotPatchFunction` LLVM attribute. This attribute may be placed on global variable declarations. It indicates that the variable may be safely accessed without the `_ref_*` indirection. * Adds two Clang command-line parameters: `-fms-hotpatch-functions-file` and `-fms-hotpatch-functions-list`. The `-file` flag may point to a text file, which contains a list of functions to be hot-patched (one function name per line). The `-list` flag simply directly identifies functions to be patched, using a comma-separated list. These two command-line parameters may also be combined; the final set of functions to be hot-patched is the union of the two sets. * Adds similar LLVM command-line parameters: `--ms-hotpatch-functions-file` and `--ms-hotpatch-functions-list`. * Adds integration tests for both LLVM and Clang. * Adds support for dumping the new `S_HOTPATCHFUNC` CodeView symbol. Although the flags are redundant between Clang and LLVM, this allows additional languages (such as Rust) to take advantage of hot-patching support before they have been modified to generate the required attributes. Credit to @dpaoliello, who wrote the original form of this patch.
2025-06-23[NFC] Remove UnwindTable dependency on CIE, and FDE (#142520)AmirHossein PashaeeHir1-19/+30
This PR is in the direction of separating Unwind table from FDE, and CIE that depends on llvm/Object. To separate, first the runtime dependencies have to be removed, which this commit does that. This is similar to [1](https://github.com/llvm/llvm-project/pull/140096), [2](https://github.com/llvm/llvm-project/pull/139175), and [3](https://github.com/llvm/llvm-project/pull/139326).
2025-06-17[NFC] Extract Printing portions of DWARFCFIProgram to new files (#143762)Sterling-Augustine4-96/+126
CFIPrograms' most common uses are within debug frames, but it is not their only use. For example, some assembly writers encode them by hand into .cfi_escape directives. This PR extracts printing code for them into its own files, which avoids the need for the main class to depend on DWARFUnit, sections, and similar. One in a series of NFC DebugInfo/DWARF refactoring changes to layer it more cleanly, so that binary CFI parsing can be used from low-level code, (such as byte strings created via .cfi_escape) without circular dependencies. The final goal is to make a more limited dwarf library usable from lower-level code. More information can be found at https://discourse.llvm.org/t/rfc-debuginfo-dwarf-refactor-into-to-lower-and-higher-level-libraries/86665
2025-06-16[llvm-debuginfo-analyzer] Fix ODR violation in llvm::logicalview::LVObject ↵Javier Lopez-Gomez2-7/+1
(#140265) Some data members are only part of a class definition in a Debug build, e.g. `LVObject::ID`. If `debuginfologicalview` is used as a library, `NDEBUG` cannot be used for this purpose, as this PP macro may have a different definition in a downstream project, which in turn triggers an ODR violation. Fix it by - Making `LVObject::ID` an unconditional data member. - Making `LVObject::dump()` non-virtual. Rationale: `virtual` is not needed (and it calls `print()`, which is virtual anyway). Fixes #139098.
2025-06-09[NFC] Separate high-level-dependent portions of DWARFExpression (revised) ↵Sterling-Augustine7-95/+103
(#143170) (Revised version of a previous, unreviewed, PR.) Move all expression verification into its only client: DWARFVerifier. Move all printing code (which was a mix of static and member functions) into a separate class. This is one in a series of refactoring PRs to separate dwarf functionality into lower-level pieces usable without object files and sections at build time. The code is already written this way via various "if (section == nullptr)" and similar conditionals. So the functionality itself is needed and exists, but only as a runtime feature. The goal of these refactors is to remove the build-time dependencies, which will allow the existing functionality to be used from lower-level parts of the compiler. Particularly from lib/MC/.... More information at: https://discourse.llvm.org/t/rfc-debuginfo-dwarf-refactor-into-to-lower-and-higher-level-libraries/86665
2025-06-08[llvm] Compare std::optional<T> to values directly (NFC) (#143340)Kazu Hirata1-1/+1
This patch transforms: X && *X == Y to: X == Y where X is of std::optional<T>, and Y is of T or similar.
2025-06-06[llvm][DebugInfo] Add support for DW_OP_GNU_implicit_pointer (#142913)Thrrreeee1-0/+2
This patch introduces support for the DWARF operation `DW_OP_GNU_implicit_pointer `(value 0xf3) within LLVM's DWARF parsing and expression evaluation infrastructure. This GNU extension is used to describe the location of a variable that is itself a pointer, where the value of this pointer is stored at an address derived from another DWARF location expression plus a constant offset. Motivation: Compilers like GCC use `DW_OP_GNU_implicit_pointer `to represent the location of certain variables.Without support for this opcode, debuggers like LLDB (and other tools relying on LLVM's DWARF libraries) cannot correctly resolve the location of such variables, leading to an inability to inspect their values or an incorrect debugging experience.
2025-06-06[NFC] Split portions of DWARFDataExtractor into new class (#140096)Sterling-Augustine2-138/+0
Currently, DWARFDataExtractor can extract data without performing relocations, (eg, by checking if the section pointer is null) but is coded such that it still depends on all the relocation machinery, like DWARFSections and similar. All at build time. Extract most functionality into a new class, DWARFDataExtractorBase, and have DWARFDataExtractor add the relocation dependent pieces via CRTP. Add a new class, DWARFDataExtractorSimple, which does no relocation at all. This will allow moving DWARFDataExtractorSimple into a new lower-level, lighter-weight library with fewer external build-time dependencies. This is another in a series of refactoring changes to create a new better-layered, low-level Dwarf library that can be called from lower-level code without circular dependencies.
2025-06-06[llvm-debuginfo-analyzer] Add support for parsing DWARF / CodeView ↵Javier Lopez-Gomez6-5/+59
SourceLanguage (#137223) This pull request adds support for parsing the source language in both DWARF and CodeView. Specifically, - The `LVSourceLanguage` class is introduced to represent any supported language by any of the debug info representations. - Update `LVDWARFReader.cpp` and `LVCodeViewVisitor.cpp` to parse the source language where it applies. Added a new `=Language` attribute; `getAttributeLanguage()` is internally used to control whether this information is being printed.
2025-06-04[llvm] annotate interfaces in llvm/DebugInfo for DLL export (#140778)Andrew Rogers2-3/+5
## Purpose This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates the `llvm/DebugInfo` library. These annotations currently have no meaningful impact on the LLVM build; however, they are a prerequisite to support an LLVM Windows DLL (shared library) build. ## Background This effort is tracked in #109483. Additional context is provided in [this discourse](https://discourse.llvm.org/t/psa-annotating-llvm-public-interface/85307), and documentation for `LLVM_ABI` and related annotations is found in the LLVM repo [here](https://github.com/llvm/llvm-project/blob/main/llvm/docs/InterfaceExportAnnotations.rst). The bulk of these changes were generated automatically using the [Interface Definition Scanner (IDS)](https://github.com/compnerd/ids) tool, followed formatting with `git clang-format`. The following manual adjustments were also applied after running IDS on Linux: - Add `#include "llvm/Support/Compiler.h"` to files where it was not auto-added by IDS due to no pre-existing block of include statements. - Explicitly make classes non-copyable where needed to due IDS adding LLVM_ABI at the class level - Add `LLVM_ABI` and to exported APIs defined via X-macro ## Validation Local builds and tests to validate cross-platform compatibility. This included llvm, clang, and lldb on the following configurations: - Windows with MSVC - Windows with Clang - Linux with GCC - Linux with Clang - Darwin with Clang
2025-06-04[llvm] Remove unused includes (NFC) (#142733)Kazu Hirata1-3/+0
These are identified by misc-include-cleaner. I've filtered out those that break builds. Also, I'm staying away from llvm-config.h, config.h, and Compiler.h, which likely cause platform- or compiler-specific build failures.
2025-06-04Revert gsymutil changes due to concurrency problems (#142829)peremyach3-139/+108
We saw occasional segfaults while processing some binaries. The reason probably is that we may clear the DIE while we are reading it's data from another thread which happens due to cross-unit references. --------- Co-authored-by: Arslan Khabutdinov <akhabutdinov@fb.com>
2025-06-04[llvm-debuginfo-analyzer][NFC] Move some functionality to LVReader. (#142740)Carlos Alberto Enciso3-241/+247
Hoist out from LVDWARFReader and LVBinaryReader some generic code, so it can be available to other readers that do not share the binary format.
2025-06-02[DebugInfo] Avoid creating a temporary instance of std::string (NFC) (#142523)Kazu Hirata1-1/+1
lookupTarget accepts StringRef. We don't need to create a temporary instance of std::string only to be converted back to StringRef.
2025-06-02[NFC] Extract DWARFCFIProgram into separate files (#139326)Sterling-Augustine3-408/+446
CFIPrograms' most common uses are within debug frames, but it is not their only use. For example, some assembly writers encode them by hand into .cfi_escape directives. This PR extracts code for them into its own files, setting them up to be evaluated from outside debug frames themselves. One in a series of NFC DebugInfo/DWARF refactoring changes to layer it more cleanly, so that binary CFI parsing can be used from low-level code, (such as byte strings created via .cfi_escape) without circular dependencies. The final goal is to make a more limited dwarf library usable from lower-level code.
2025-05-29fix llvm-gsymutil verification (#141751)peremyach1-0/+5
Verification crashed here https://github.com/llvm/llvm-project/blob/main/llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp#L519 The reason being that during verification to extract inline_info we recreate compile unit dies. Assert fails because we previously cleaned up just the DIEs but some other fields remained initialized. Co-authored-by: Arslan Khabutdinov <akhabutdinov@fb.com>
2025-05-23[pdb] Tweak the message about overflowing the publics/globals record streamHans Wennborg1-2/+2
Follow-up to https://github.com/llvm/llvm-project/pull/140884
2025-05-22[llvm-debuginfo-analyzer] Add support for DWARF `DW_AT_byte_size` (#139110)Javier Lopez-Gomez5-5/+22
This PR was split from https://github.com/llvm/llvm-project/pull/137228 (which introduced support for `DW_TAG_module` and `DW_AT_byte_size`). This PR improves `LVDWARFReader` by introducing handling of `DW_AT_byte_size`. Most DWARF emitters include this attribute for types to specify the size of an entity of the given type.
2025-05-22[pdb] Provide a better error message when overflowing the public/global ↵Hans Wennborg1-2/+10
symbol record stream (#140884) Before: lld-link: error: Stream Error: The stream is too short to perform the requested operation. lld-link: error: failed to write PDB file ./unit_tests.exe.pdb After: lld-link: error: the public (2127832912 bytes) and global (2200532960 bytes) symbols are too large to fit in a PDB file; the maximum total is 4294967295 bytes. lld-link: error: failed to write PDB file ./unit_tests.exe.pdb
2025-05-21Reduce llvm-gsymutil memory usage (#140740)peremyach3-108/+134
Same as https://github.com/llvm/llvm-project/pull/139907/ except there is now a special dovoidwork helper function. Previous approach with assert(f();return success;) failed tests for release builds, so I created a separate helper. Open to suggestions how to solve this more elegantly. Co-authored-by: Arslan Khabutdinov <akhabutdinov@fb.com>
2025-05-21[llvm-debuginfo-analyzer] Support DW_TAG_module (#137228)Javier Lopez-Gomez2-0/+19
- Adds support for `DW_TAG_module` DIEs and recurse over their children. Prior to this patch, entities hanging below `DW_TAG_module` were just not visible. This DIE kind is commonly generated by Objective-C modules. This patch will represent such entities, which will print as ``` [001] {CompileUnit} '/llvm/tools/clang/test/modules/<stdin>' [002] {Producer} 'LLVM version 3.7.0' {Directory} '/llvm/tools/clang/test/modules' {File} '<stdin>' [002] {Module} 'DebugModule' ``` The minimal test case included is just the result of ``` $ llc llvm/test/DebugInfo/X86/DIModule.ll -accel-tables=Dwarf -o llvm/unittests/DebugInfo/LogicalView/Inputs/test-dwarf-clang-module.o -filetype=obj ```
2025-05-20[DebugInfo] Use std::map::try_emplace (NFC) (#140839)Kazu Hirata1-3/+3
This patch provides default member initialization for SymInfo, which in turns allows us to call std::map::try_emplace without the value.
2025-05-21[llvm-debuginfo-analyzer] Fix a couple of unhandled DWARF situations leading ↵Javier Lopez-Gomez2-1/+13
to a crash (#137221) This pull request fixes a couple of unhandled situations in DWARF input leading to a crash. Specifically, - If the DWARF input contains a declaration of a C variadic function (where `...` translates to `DW_TAG_unspecified_parameters`), which is then followed by a definition, `llvm_unreachable()` is hit in `LVScope::addMissingElements()`. This is only visible in Debug builds. - Parsing of instructions in `LVBinaryReader::createInstructions()` does not check whether `Offset` lies within the `Bytes` ArrayRef. A specially crafted DWARF input can lead to this condition.