summaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/PDB/PDBExtras.cpp
AgeCommit message (Collapse)Author
2024-02-12[DebugInfo] Update CodeView enums (#71038)nikitalita
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-03-17[CodeView] Add source languages ObjC and ObjC++Stefan Gränitz
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
2022-03-01[PDB] Add char8_t typeZequan Wu
Differential Revision: https://reviews.llvm.org/D120690
2022-02-23Cleanup llvm/DebugInfo/PDB headersserge-sans-paille
accumulated preprocessed size: before: 1065515095 after: 1065629059 Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup Differential Revision: https://reviews.llvm.org/D120195
2022-01-06Add Rust to CodeView SourceLanguage (CV_CFL_LANG) enumArlo Siemsen
Microsoft has added several new entries to the CV_CFL_LANG enum, including Rust: https://docs.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/cv-cfl-lang This change adds Rust to the corresponding LLVM enum and translates `dwarf::DW_LANG_Rust` to `SourceLanguage::Rust` in the CodeView AsmPrinter. This means that Rust will no longer emit as Masm. Differential Revision: https://reviews.llvm.org/D115300
2020-10-19[COFF][ARM] Fix CodeView for Windows on 32bit ARM targets.Luqman Aden
Create the LLVM / CodeView register mappings for the 32-bit ARM Window targets. Reviewed By: compnerd Differential Revision: https://reviews.llvm.org/D89622
2020-08-06Revert "PDBExtras.h - remove unnecessary raw_ostream forward declaration. NFCI."Raphael Isemann
This reverts commit 87c5437afd273e909e0fed3389de7531d5452ea5. The commit includes several headers in the middle of a function, which breaks pretty much everything.
2020-08-06PDBExtras.h - remove unnecessary raw_ostream forward declaration. NFCI.Simon Pilgrim
We already need to include raw_ostream.h, also add missing StringRef.h and cstdint implicit dependencies. Remove unnecessary includes from PDBExtras.cpp
2019-07-17llvm-pdbdump: Fix several smaller issues with injected source compression ↵Nico Weber
handling - getCompression() used to return a PDB_SourceCompression even though the docs for IDiaInjectedSource are explicit about the return value being compiler-dependent. Return an uint32_t instead, and make the printing code handle unknown values better by printing "Unknown" and the int value instead of not printing any compression. - Print compressed contents as hex dump, not as string. - Add compression type "DotNet", which is used (at least) by csc.exe, the C# compiler. Also add a lengthy comment describing the stream contents (derived from looking at the raw hex contents long enough to see the GUIDs, which led me to the roslyn and mono implementations for handling this). - The native injected source dumper was dumping the contents of the whole data stream -- but csc.exe writes a stream that's padded with zero bytes to the next 512 boundary, and the dia api doesn't display those padding bytes. So make NativeInjectedSource::getCode() do the same thing. Differential Revision: https://reviews.llvm.org/D64879 llvm-svn: 366386
2019-05-31[COFF, ARM64] Add CodeView register mappingTom Tan
CodeView has its own register map which is defined in cvconst.h. Missing this mapping before saving register to CodeView causes debugger to show incorrect value for all register based variables, like variables in register and local variables addressed by register (stack pointer + offset). This change added mapping between LLVM register and CodeView register so the correct register number will be stored to CodeView/PDB, it aso fixed the mapping from CodeView register number to register name based on current CPUType but print PDB to yaml still assumes X86 CPU and needs to be fixed. Differential Revision: https://reviews.llvm.org/D62608 llvm-svn: 362280
2019-03-11Add Swift enumerator value for CodeView::SourceLanguageNathan Lanza
Summary: Swift now generates PDBs for debugging on Windows. llvm and lldb need a language enumerator value too properly handle the output emitted by swiftc. Subscribers: jdoerfert, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D59231 llvm-svn: 355882
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
2018-10-01[PDB] Add support for more kinds of PDB Sym Tags.Zachary Turner
DIA SDK is returning several new sym tag types, so we update the enumeration and printing code to support these. llvm-svn: 343547
2018-09-20[PDB] Fix -Wcovered-switch-default warning.Zachary Turner
llvm-svn: 342681
2018-09-20[PDB] Better printing of builtin types when using DIA dumper.Zachary Turner
llvm-svn: 342658
2018-09-17[PDB] Make the native reader support enumerators.Zachary Turner
Previously we would dump the names of enum types, but not their enumerator values. This adds support for enumerator values. In doing so, we have to introduce a general purpose mechanism for caching symbol indices of field list members. Unlike global types, FieldList members do not have a TypeIndex. So instead, we identify them by the pair {TypeIndexOfFieldList, IndexInFieldList}. llvm-svn: 342415
2018-04-03[DebugInfoPDB] Add a few missing definitions to PDBTypes.hAaron Smith
The missing definitions are from cvconst.h shipped with DIA SDK. Correct the url to MSDN for MemoryTypeEnum and set the underlying type of PDB_StackFrameType and PDB_MemoryType to uint16_t. llvm-svn: 329104
2018-03-13[PDB] Support dumping injected sources via the DIA reader.Zachary Turner
Injected sources are basically a way to add actual source file content to your PDB. Presumably you could use this for shipping your source code with your debug information, but in practice I can only find this being used for embedding natvis files inside of PDBs. In order to effectively test LLVM's natvis file injection, we need a way to dump the injected sources of a PDB in a way that is authoritative (i.e. based on Microsoft's understanding of the PDB format, and not LLVM's). To this end, I've added support for dumping injected sources via DIA. I made a PDB file that used the /natvis option to generate a test case. Differential Revision: https://reviews.llvm.org/D44405 llvm-svn: 327428
2017-12-13Remove redundant includes from lib/DebugInfo.Michael Zolotukhin
llvm-svn: 320620
2017-10-03Fix -Wcovered-switch-default warnings from r314821Hans Wennborg
llvm-svn: 314826
2017-10-03CodeView: Provide a .def file with the register idsHans Wennborg
The list of register ids was previously written out in a couple of dirrent places. This puts it in a .def file and also adds a few more registers (e.g. the x87 regs) which should lead to more readable dumps, but I didn't include the whole list since that seems unnecessary. X86_MC::initLLVMToSEHAndCVRegMapping is pretty ugly, but at least it's not relying on magic constants anymore. The TODO of using tablegen still stands. Differential revision: https://reviews.llvm.org/D38480 llvm-svn: 314821
2017-07-24Revert "Debug: handle dumping the D language."Tim Northover
Reid beat me to it. llvm-svn: 308902
2017-07-24Debug: handle dumping the D language.Tim Northover
Mostly just to silence a warning about an unhandled case. There don't seem to be any tests for this operator (at least that I could find). llvm-svn: 308901
2017-07-24Add missing case to switchReid Kleckner
llvm-svn: 308894
2017-07-17[codeview] Fix YAML for LF_TYPESERVER2 by hoisting PDB_UniqueIdReid Kleckner
Summary: We were treating the GUIDs in TypeServer2Record as strings, and the non-ASCII bytes in the GUID would not round-trip through YAML. We already had the PDB_UniqueId type portably represent a Windows GUID, but we need to hoist that up to the DebugInfo/CodeView library so that we can use it in the TypeServer2Record as well as in PDB parsing code. Reviewers: inglorion, amccarth Subscribers: llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D35495 llvm-svn: 308234
2017-06-30[CodeView, PDB] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko
warnings; other minor fixes (NFC). llvm-svn: 306911
2017-02-03Properly parse the TypeServer2 record.Zachary Turner
llvm-svn: 294046
2016-05-24[codeview] Add support for new type records.Zachary Turner
This adds support for parsing and dumping the following symbol types: S_LPROCREF S_ENVBLOCK S_COMPILE2 S_REGISTER S_COFFGROUP S_SECTION S_THUNK32 S_TRAMPOLINE As of this patch, the test PDB files no longer have any unknown symbol types. llvm-svn: 270628
2016-05-04Move pdb code into pdb namespace.Zachary Turner
llvm-svn: 268544
2016-04-26Parse and dump PDB DBI Stream Header InformationZachary Turner
The DBI stream contains a lot of bookkeeping information for other streams. In particular it contains information about section contributions and linked modules. This patch is a first attempt at parsing some of the information out of the DBI stream. It currently only parses and dumps the headers of the DBI stream, so none of the module data or section contribution data is pulled out. This is just a proof of concept that we understand the basic properties of the DBI stream's metadata, and followup patches will try to extract more detailed information out. Differential Revision: http://reviews.llvm.org/D19500 Reviewed By: majnemer, ruiu llvm-svn: 267585
2016-02-17[DebugInfoPDB] Teach Variant to support string types.Zachary Turner
The IDiaSymbol::getValue() method returns a variant. Until now, I had never encountered a string value, so the Variant wrapper did not support VT_BSTR. Now we have need to support string values, so this patch just adds support for one extra type to Variant. llvm-svn: 261152
2016-01-13Fix instance of -Wcovered-switch-defaultReid Kleckner
llvm-svn: 257665
2016-01-13[readobj] Expand CodeView dumping functionalityReid Kleckner
This rewrites and expands the existing codeview dumping functionality in llvm-readobj using techniques similar to those in lib/Object. This defines a number of new records and enums useful for reading memory mapped codeview sections in COFF objects. The dumper is intended as a testing tool for LLVM as it grows more codeview output capabilities. Reviewers: majnemer Differential Revision: http://reviews.llvm.org/D16104 llvm-svn: 257658
2015-03-04[llvm-pdbdump] Display full enum definitions.Zachary Turner
This will now display enum definitions both at the global scope as well as nested inside of classes. Additionally, it will no longer display enums at the global scope if the enum is nested. Instead, it will omit the definition of the enum globally and instead emit it in the corresponding class definition. llvm-svn: 231215
2015-03-02[llvm-pdbdump] Many minor fixes and improvementsZachary Turner
A short list of some of the improvements: 1) Now supports -all command line argument, which implies many other command line arguments to simplify usage. 2) Now supports -no-compiler-generated command line argument to exclude compiler generated types. 3) Prints base class list. 4) -class-definitions implies -types. 5) Proper display of bitfields. 6) Can now distinguish between struct/class/interface/union. And a few other minor tweaks. llvm-svn: 230933
2015-02-26[llvm-pdbdump] Fix dumping of function pointers and basic types.Zachary Turner
Function pointers were not correctly handled by the dumper, and they would print as "* name". They now print as "int (__cdecl *name)(int arg1, int arg2)" as they should. Also, doubles were being printed as floats. This fixes that bug as well, and adds tests for all builtin types. as well as a test for function pointers. llvm-svn: 230703
2015-02-22[llvm-pdbdump] Rewrite dumper using visitor pattern.Zachary Turner
This increases the flexibility of how to dump different symbol types -- necessary for context-sensitive formatting of symbol types -- and also improves the modularity by allowing the dumping to be implemented in the actual dumper, as opposed to in the PDB library. llvm-svn: 230184
2015-02-14llvm-pdbdump: Re-order header files according to LLVM style guide.Zachary Turner
llvm-svn: 229231
2015-02-13llvm-pdbdump: Add more comprehensive dumping of symbol types.Zachary Turner
In particular this patch adds the ability to dump complete function signature information including argument types as correctly formatted strings. A side effect of this is that almost all symbol and meta types are now formatted. llvm-svn: 229076
2015-02-13Improve llvm-pdbdump output display.Zachary Turner
This patch adds a number of improvements to llvm-pdbdump. 1) Dumping of the entire global scope, and not only those symbols that live in individual compilands. 2) Prepend class name to member functions and data 3) Improved display of bitfields. 4) Support for dumping more kinds of data symbols. llvm-svn: 229012
2015-02-12Add concrete type overloads to PDBSymbol::findChildren().Zachary Turner
Frequently you only want to iterate over children of a specific type (e.g. functions). Previously you would get back a generic interface that allowed iteration over the base symbol type, which you would have to dyn_cast<> each one of. With this patch, we allow the user to specify the concrete type as a template parameter, and it will return an iterator which returns instances of the concrete type directly. llvm-svn: 228960
2015-02-11Fix some warnings due to -Wcovered-switch-default.Zachary Turner
llvm-svn: 228773
2015-02-10Rewrite llvm-pdbdump in terms of LLVMDebugInfoPDB.Zachary Turner
This makes llvm-pdbdump available on all platforms, although it will currently fail to create a dumper if there is no PDB reader implementation for the current platform. It implements dumping of compilands and children, which is less information than was previously available, but it has to be rewritten from scratch using the new set of interfaces, so the rest of the functionality will be added back in subsequent commits. llvm-svn: 228755