aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/PDB
AgeCommit message (Collapse)AuthorFilesLines
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-08-29[llvm] Support building with c++23 (#154372)Kyle Krüger2-0/+11
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-07-03[DebugInfo] Remove an unnecessary cast (NFC) (#146809)Kazu Hirata1-1/+1
Mem is already of uint8_t *.
2025-06-27[llvm] Remove unused includes (NFC) (#146199)Kazu Hirata1-1/+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-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[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-04-26[llvm] Use llvm::replace (NFC) (#137481)Kazu Hirata1-1/+1
2025-03-23[DebugInfo] Avoid repeated hash lookups (NFC) (#132586)Kazu Hirata1-3/+4
2025-03-17[NFC][DebugInfo] Wrap DILineInfo return type with std::optional to handle ↵Zequan Wu1-7/+10
missing debug info. (#129792) Currently, `DIContext::getLineInfoForAddress` and `DIContext::getLineInfoForDataAddress` returns empty DILineInfo when the debug info is missing for the given address. This is not differentiable with the case when debug info is found for the given address but the debug info is default value (filename:linenum is <invalid>:0). This change wraps the return types of `DIContext::getLineInfoForAddress` and `DIContext::getLineInfoForDataAddress` with `std::optional`.
2024-11-18[PDB] Fix missing `consumeError` which raise error with asserts enabled ↵Romain Thomas1-2/+6
(#116480) As mentioned in the title, the missing `consumeError` triggers assertions.
2024-11-17[DebugInfo] Remove unused includes (NFC) (#116551)Kazu Hirata25-29/+0
Identified with misc-include-cleaner.
2024-10-15[DebugInfo] Avoid repeated hash lookups (NFC) (#112298)Kazu Hirata1-3/+3
2024-09-12[DebugInfo] Avoid repeated hash lookups (NFC) (#108486)Kazu Hirata1-5/+2
2024-06-29[llvm] Use std::make_unique (NFC) (#97165)Kazu Hirata1-2/+1
This patch is based on clang-tidy's modernize-make-unique but limited to those cases where type names are mentioned twice like std::unique_ptr<Type>(new Type()), which is a bit mouthful.
2024-03-10Add llvm::min/max_element and use it in llvm/ and mlir/ directories. (#84678)Justin Lebar1-2/+1
For some reason this was missing from STLExtras.
2024-02-12[DebugInfo] Update CodeView enums (#71038)nikitalita1-0/+4
This adds the following values to the CodeView.h enums (and updates the various functions that use them): * CPUType: * Added `Unknown` * This is not currently documented in the online documentation, but this is present in `cvconst.h` in the latest DIA SDK (Visual Studio 2022, 17.7.6) * `Unknown` is the CPUType that is emitted by `aliasobj.exe` in the Compile3Sym records, and can be found in objects that link with `oldnames.lib` ![image](https://github.com/llvm/llvm-project/assets/69168929/8ee7b032-761b-45da-8439-d07aba797940) * SourceLanguage (All of these are documented at https://learn.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/cv-cfl-lang?view=vs-2022 and are present in `cvconst.h` in the latest DIA SDK (Visual Studio 2022, 17.7.6)) * Added Go * Added AliasObj * emitted by `aliasobj.exe` in certain records, can be found in PDBs that link with `oldnames.lib` * Changed Swift to the official Microsoft enumeration * Added `OldSwift` * The old Swift enumeration of `S` was changed to `OldSwift` to allow pdb dumping utilities to continue to emit correct source language information for old PDBs ### WARNING The `Swift` change is a potentially breaking change, as the swift compiler will now emit `0x13` for the SourceLanguage type in PDB records instead of `S`. This could potentially break utilities that relied on the old enum value. * CallType * Added Swift * This is not currently documented in the online documentation, but this is present in `cvconst.h` in the latest DIA SDK (Visual Studio 2022, 17.7.6)
2023-12-08[DebugInfo] Use llvm::to_underlying (NFC)Kazu Hirata1-3/+2
2023-11-13[llvm] Stop including llvm/ADT/SparseBitVector.h (NFC)Kazu Hirata1-1/+0
Identified with clangd.
2023-11-06[DebugInfo] Use StringRef::starts_with/ends_with instead of ↵Simon Pilgrim3-3/+3
startswith/endswith. NFC. startswith/endswith wrap starts_with/ends_with and will eventually go away (to more closely match string_view)
2023-10-21[llvm] Stop including Endian.h (NFC)Kazu Hirata4-4/+0
These files satisfy all of the following: - misc-include-cleaner indicates that these files do not need Endian.h. - They do not mention "endian" anywhere. - They do not include any *.inc or *.def, which could need llvm::support::endian.
2023-10-12Use llvm::endianness::{big,little,native} (NFC)Kazu Hirata1-1/+1
Note that llvm::support::endianness has been renamed to llvm::endianness while becoming an enum class as opposed to an enum. This patch replaces support::{big,little,native} with llvm::endianness::{big,little,native}.
2023-10-10Use llvm::endianness::{big,little,native} (NFC)Kazu Hirata3-5/+5
Note that llvm::support::endianness has been renamed to llvm::endianness while becoming an enum class as opposed to an enum. This patch replaces llvm::support::{big,little,native} with llvm::endianness::{big,little,native}.
2023-10-10[llvm] Use llvm::endianness::{big,little,native} (NFC)Kazu Hirata1-1/+1
Now that llvm::support::endianness has been renamed to llvm::endianness, we can use the shorter form. This patch replaces support::endianness::{big,little,native} with llvm::endianness::{big,little,native}.
2023-10-05[LLD][COFF] Add support for `--time-trace` (#68236)Alexandre Ganea6-9/+27
This adds support for generating Chrome-tracing .json profile traces in the LLD COFF driver. Also add the necessary time scopes, so that the profile trace shows in great detail which tasks are executed. As an example, this is what we see when linking a Unreal Engine executable: ![image](https://github.com/llvm/llvm-project/assets/37383324/b2e26eb4-9d37-4cf9-b002-48b604e7dcb7)
2023-07-19PDBFileBuilder: Switch to xxh3_64bitsFangrui Song2-2/+2
Following recent changes switching from xxh64 to xxh32 for better hashing performance (e.g., D154813). I am not familiar with this use case, but this change will ensure that the lld executable doesn't need xxHash64 after wasm-ld migrates.
2023-06-25[llvm] Add missing StringExtras.h includesElliot Goodrich5-0/+6
In preparation for removing the `#include "llvm/ADT/StringExtras.h"` from the header to source file of `llvm/Support/Error.h`, first add in all the missing includes that were previously included transitively through this header.
2023-05-12[llvm] Migrate {starts,ends}with_insensitive to ↵Kazu Hirata1-3/+3
{starts,ends}_with_insensitive (NFC) This patch migrates uses of StringRef::{starts,ends}with_insensitive to StringRef::{starts,ends}_with_insensitive so that we can use names similar to those used in std::string_view. I'm planning to deprecate StringRef::{starts,ends}with_insensitive once the migration is complete across the code base. Differential Revision: https://reviews.llvm.org/D150426
2023-04-17[nfc][llvm] Replace pointer cast functions in PointerUnion by llvm casting ↵Shraiysh Vaishay1-9/+9
functions. This patch replaces the uses of PointerUnion.is function by llvm::isa, PointerUnion.get function by llvm::cast, and PointerUnion.dyn_cast by llvm::dyn_cast_if_present. This is according to the FIXME in the definition of the class PointerUnion. This patch does not remove them as they are being used in other subprojects. Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D148449
2023-03-17[CodeView] Add source languages ObjC and ObjC++Stefan Gränitz2-0/+4
This patch adds llvm::codeview::SourceLanguage entries, DWARF translations, and PDB source file extensions in LLVM and allow LLDB's PDB parsers to recognize them correctly. The CV_CFL_LANG enum in the Visual Studio 2022 documentation https://learn.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/cv-cfl-lang defines: ``` CV_CFL_OBJC = 0x11, CV_CFL_OBJCXX = 0x12, ``` Since the initial commit in D24317, ObjC was emitted as C language and ObjC++ as Masm. Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D146221
2023-02-27[llvm-debuginfo-analyzer] (09/09) - CodeView ReaderCarlos Alberto Enciso1-1/+3
llvm-debuginfo-analyzer is a command line tool that processes debug info contained in a binary file and produces a debug information format agnostic “Logical View”, which is a high-level semantic representation of the debug info, independent of the low-level format. The code has been divided into the following patches: 1) Interval tree 2) Driver and documentation 3) Logical elements 4) Locations and ranges 5) Select elements 6) Warning and internal options 7) Compare elements 8) ELF Reader 9) CodeView Reader Full details: https://discourse.llvm.org/t/llvm-dev-rfc-llvm-dva-debug-information-visual-analyzer/62570 This patch: This is a high level summary of the changes in this patch. CodeView Reader - Support for CodeView/PDB. LVCodeViewReader, LVTypeVisitor, LVSymbolVisitor, LVLogicalVisitor Reviewed By: psamolysov, probinson, djtodoro, zequanwu Differential Revision: https://reviews.llvm.org/D125784
2023-01-22Use llvm::popcount instead of llvm::countPopulation(NFC)Kazu Hirata1-1/+1
2023-01-05Move from llvm::makeArrayRef to ArrayRef deduction guides - llvm/ partserge-sans-paille6-12/+12
Use deduction guides instead of helper functions. The only non-automatic changes have been: 1. ArrayRef(some_uint8_pointer, 0) needs to be changed into ArrayRef(some_uint8_pointer, (size_t)0) to avoid an ambiguous call with ArrayRef((uint8_t*), (uint8_t*)) 2. CVSymbol sym(makeArrayRef(symStorage)); needed to be rewritten as CVSymbol sym{ArrayRef(symStorage)}; otherwise the compiler is confused and thinks we have a (bad) function prototype. There was a few similar situation across the codebase. 3. ADL doesn't seem to work the same for deduction-guides and functions, so at some point the llvm namespace must be explicitly stated. 4. The "reference mode" of makeArrayRef(ArrayRef<T> &) that acts as no-op is not supported (a constructor cannot achieve that). Per reviewers' comment, some useless makeArrayRef have been removed in the process. This is a follow-up to https://reviews.llvm.org/D140896 that introduced the deduction guides. Differential Revision: https://reviews.llvm.org/D140955
2022-12-05[llvm] Use std::nullopt instead of llvm::None (NFC)Kazu Hirata1-2/+2
This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-05Remove unused #include "llvm/ADT/Optional.h"Fangrui Song1-1/+0
2022-12-05[DebugInfo] llvm::Optional => std::optionalFangrui Song6-14/+14
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-02[DebugInfo] Use std::nullopt instead of None (NFC)Kazu Hirata1-3/+3
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-11-25[Native] Use std::optional in NativeTypeEnum.cpp (NFC)Kazu Hirata1-1/+2
This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-11-21Return None instead of Optional<T>() (NFC)Kazu Hirata1-2/+2
This patch replaces: return Optional<T>(); with: return None; to make the migration from llvm::Optional to std::optional easier. Specifically, I can deprecate None (in my source tree, that is) to identify all the instances of None that should be replaced with std::nullopt. Note that "return None" far outnumbers "return Optional<T>();". There are more than 2000 instances of "return None" in our source tree. All of the instances in this patch come from functions that return Optional<T> except Archive::findSym and ASTNodeImporter::import, where we return Expected<Optional<T>>. Note that we can construct Expected<Optional<T>> from any parameter convertible to Optional<T>, which None certainly is. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716 Differential Revision: https://reviews.llvm.org/D138464
2022-11-21Don't use Optional::getPointer (NFC)Kazu Hirata1-2/+2
Since std::optional does not offer getPointer(), this patch replaces X.getPointer() with &*X to make the migration from llvm::Optional to std::optional easier. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716 Differential Revision: https://reviews.llvm.org/D138466
2022-11-08Reland "[llvm][NFC] Use c++17 style variable type traits"Nathan James1-1/+1
This reverts commit 632a389f96355cbe7ed8fa7b8d2ed6267c92457c. This relands commit 1834a310d060d55748ca38d4ae0482864c2047d8. Differential Revision: https://reviews.llvm.org/D137493
2022-11-08Revert "[llvm][NFC] Use c++17 style variable type traits"Nathan James1-1/+1
This reverts commit 1834a310d060d55748ca38d4ae0482864c2047d8.
2022-11-08[llvm][NFC] Use c++17 style variable type traitsNathan James1-1/+1
This was done as a test for D137302 and it makes sense to push these changes Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D137493
2022-08-08[llvm] LLVM_FALLTHROUGH => [[fallthrough]]. NFCFangrui Song1-1/+1
With C++17 there is no Clang pedantic warning or MSVC C5051.
2022-08-08[LLD][COFF] Ignore DEBUG_S_XFGHASH_TYPE/VIRTUALTobias Hieta1-0/+7
These are new debug types that ships with the latest Windows SDK and would warn and finally fail lld-link. The symbols seems to be related to Microsoft's XFG which is their version of CFG. We can't handle any of this yet, so for now we can just ignore these types so that lld doesn't fail with a new version of Windows SDK. Fixes: #56285 Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D129378
2022-08-07[llvm] Qualify auto (NFC)Kazu Hirata1-1/+1
Identified with readability-qualified-auto.
2022-07-10ManagedStatic: remove many straightforward uses in llvmNicolai Hähnle3-9/+12
(Reapply after revert in e9ce1a588030d8d4004f5d7e443afe46245e9a92 due to Fuchsia test failures. Removed changes in lib/ExecutionEngine/ other than error categories, to be checked in more detail and reapplied separately.) Bulk remove many of the more trivial uses of ManagedStatic in the llvm directory, either by defining a new getter function or, in many cases, moving the static variable directly into the only function that uses it. Differential Revision: https://reviews.llvm.org/D129120
2022-07-10Revert "ManagedStatic: remove many straightforward uses in llvm"Nicolai Hähnle3-12/+9
This reverts commit e6f1f062457c928c18a88c612f39d9e168f65a85. Reverting due to a failure on the fuchsia-x86_64-linux buildbot.
2022-07-10ManagedStatic: remove many straightforward uses in llvmNicolai Hähnle3-9/+12
Bulk remove many of the more trivial uses of ManagedStatic in the llvm directory, either by defining a new getter function or, in many cases, moving the static variable directly into the only function that uses it. Differential Revision: https://reviews.llvm.org/D129120
2022-06-29[CodeView] Call llvm::codeview::visitMemberRecordStream with the ↵Zequan Wu1-3/+6
deserialized CVType whose kind is FieldListRecord. llvm::codeview::visitMemberRecordStream expects to receive an array ref that's FieldListRecord's Data not a CVType's data which has 4 more bytes preceeding. The first 2 bytes indicate the size of the FieldListRecord, and following 2 bytes is always 0x1203. Inside llvm::codeview::visitMemberRecordStream, it iterates to the data to check if first two bytes matching some type record kinds. If the size coincidentally matches one type kind, it will start parsing from there and causing crash.
2022-06-25[llvm] Don't use Optional::hasValue (NFC)Kazu Hirata1-2/+2
This patch replaces Optional::hasValue with the implicit cast to bool in conditionals only.