summaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/CodeView/EnumTables.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-08-31Emit the CodeView `S_ARMSWITCHTABLE` debug symbol for jump tablesDaniel Paoliello
The CodeView `S_ARMSWITCHTABLE` debug symbol is used to describe the layout of a jump table, it contains the following information: * The address of the branch instruction that uses the jump table. * The address of the jump table. * The "base" address that the values in the jump table are relative to. * The type of each entry (absolute pointer, a relative integer, a relative integer that is shifted). Together this information can be used by debuggers and binary analysis tools to understand what an jump table indirect branch is doing and where it might jump to. Documentation for the symbol can be found in the Microsoft PDB library dumper: https://github.com/microsoft/microsoft-pdb/blob/0fe89a942f9a0f8e061213313e438884f4c9b876/cvdump/dumpsym7.cpp#L5518 This change adds support to LLVM to emit the `S_ARMSWITCHTABLE` debug symbol as well as to dump it out (for testing purposes). Reviewed By: efriedma Differential Revision: https://reviews.llvm.org/D149367
2023-08-25Revert "Emit the CodeView `S_ARMSWITCHTABLE` debug symbol for jump tables"Arthur Eubanks
This reverts commit 8d0c3db388143f4e058b5f513a70fd5d089d51c3. Causes crashes, see comments in https://reviews.llvm.org/D149367. Some follow-up fixes are also reverted: This reverts commit 636269f4fca44693bfd787b0a37bb0328ffcc085. This reverts commit 5966079cf4d4de0285004eef051784d0d9f7a3a6. This reverts commit e7294dbc85d24a08c716d9babbe7f68390cf219b.
2023-08-25Emit the CodeView `S_ARMSWITCHTABLE` debug symbol for jump tablesDaniel Paoliello
The CodeView `S_ARMSWITCHTABLE` debug symbol is used to describe the layout of a jump table, it contains the following information: * The address of the branch instruction that uses the jump table. * The address of the jump table. * The "base" address that the values in the jump table are relative to. * The type of each entry (absolute pointer, a relative integer, a relative integer that is shifted). Together this information can be used by debuggers and binary analysis tools to understand what an jump table indirect branch is doing and where it might jump to. Documentation for the symbol can be found in the Microsoft PDB library dumper: https://github.com/microsoft/microsoft-pdb/blob/0fe89a942f9a0f8e061213313e438884f4c9b876/cvdump/dumpsym7.cpp#L5518 This change adds support to LLVM to emit the `S_ARMSWITCHTABLE` debug symbol as well as to dump it out (for testing purposes). Reviewed By: efriedma Differential Revision: https://reviews.llvm.org/D149367
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
2023-01-05Move from llvm::makeArrayRef to ArrayRef deduction guides - llvm/ partserge-sans-paille
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-11-08Reland "[llvm][NFC] Use c++17 style variable type traits"Nathan James
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 James
This reverts commit 1834a310d060d55748ca38d4ae0482864c2047d8.
2022-11-08[llvm][NFC] Use c++17 style variable type traitsNathan James
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-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
2021-07-07[COFF] [CodeView] Add a few new enum valuesMartin Storsjö
These are undocumented, but are visible in the SDK headers since some versions ago. Differential Revision: https://reviews.llvm.org/D105513
2021-04-13[CodeView] Fix the ARM64 CPUType enumMartin Storsjö
The old, incorrect one seems to have been added in d41ac895bb810d0b15844773cbecbf394d914010, with a similarly placed entry added in EnumTables.cpp in eb4d6142dcd53d79d8f8a86908a035582965fc52. This matches the value documented at https://docs.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/cv-cpu-type-e?view=vs-2019. This fixes running obj2yaml on an object file generated by MSVC. Differential Revision: https://reviews.llvm.org/D100306
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
2019-08-21Improving CodeView debug info type record's inline commentsNilanjana Basu
llvm-svn: 369533
2019-08-02Temporarily revert "Changes to improve CodeView debug info type record ↵Eric Christopher
inline comments" due to a sanitizer failure. This reverts commit 367623. llvm-svn: 367640
2019-08-01Changes to improve CodeView debug info type record inline commentsNilanjana Basu
Signed-off-by: Nilanjana Basu <nilanjana.basu87@gmail.com> llvm-svn: 367623
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-09-11[codeview] Decode and dump FP regs from S_FRAMEPROC recordsReid Kleckner
Summary: There are two registers encoded in the S_FRAMEPROC flags: one for locals and one for parameters. The encoding is described by the ExpandEncodedBasePointerReg function in cvinfo.h. Two bits are used to indicate one of four possible values: 0: no register - Used when there are no variables. 1: SP / standard - Variables are stored relative to the standard SP for the ISA. 2: FP - Variables are addressed relative to the ISA frame pointer, i.e. EBP on x86. If realignment is required, parameters use this. If a dynamic alloca is used, locals will be EBP relative. 3: Alternative - Variables are stored relative to some alternative third callee-saved register. This is required to address highly aligned locals when there are dynamic stack adjustments. In this case, both the incoming SP saved in the standard FP and the current SP are at some dynamic offset from the locals. LLVM uses ESI in this case, MSVC uses EBX. Most of the changes in this patch are to pass around the CPU so that we can decode these into real, named architectural registers. Subscribers: hiraditya Differential Revision: https://reviews.llvm.org/D51894 llvm-svn: 341999
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-24[codeview] Emit 'D' as the cv source language for D codeReid Kleckner
This matches DMD: https://github.com/dlang/dmd/blob/522263965cf3a27ed16b31f3c3562db86cdeabec/src/ddmd/backend/cv8.c#L199 Fixes PR33899. llvm-svn: 308890
2017-06-29[CodeView] Fix some Clang-tidy modernize-use-using and Include What You Use ↵Eugene Zelenko
warnings; other minor fixes (NFC). llvm-svn: 306616
2017-06-19[CodeView] Fix dumping of public symbol record flagsReid Kleckner
I noticed nonsensical type information while dumping PDBs produced by MSVC. llvm-svn: 305708
2017-05-30[CodeView] Move CodeView YAML code to ObjectYAML.Zachary Turner
This is the beginning of an effort to move the codeview yaml reader / writer into ObjectYAML so that it can be shared. Currently the only consumer / producer of CodeView YAML is llvm-pdbdump, but CodeView can exist outside of PDB files, and indeed is put into object files and passed to the linker to produce PDB files. Furthermore, there are subtle differences in the types of records that show up in object file CodeView vs PDB file CodeView, but they are otherwise 99% the same. By having this code in ObjectYAML, we can have llvm-pdbdump reuse this code, while teaching obj2yaml and yaml2obj to use this syntax for dealing with object files that can contain CodeView. This patch only adds support for CodeView type information to ObjectYAML. Subsequent patches will add support for CodeView symbol information. llvm-svn: 304248
2017-05-30[CodeView] Rename ModuleDebugFragment -> DebugSubsection.Zachary Turner
This is more concise, and matches the terminology used in other parts of the codebase more closely. llvm-svn: 304218
2017-04-27Rename some PDB classes.Zachary Turner
We have a lot of very similarly named classes related to dealing with module debug info. This patch has NFC, it just renames some classes to be more descriptive (albeit slightly more to type). The mapping from old to new class names is as follows: Old | New ModInfo | DbiModuleDescriptor ModuleSubstream | ModuleDebugFragment ModStream | ModuleDebugStream With the corresponding Builder classes renamed accordingly. Differential Revision: https://reviews.llvm.org/D32506 llvm-svn: 301555
2016-08-18Resubmit "Write the TPI stream from a PDB to Yaml."Zachary Turner
The original patch was breaking some buildbots due to an incorrect ordering of function definitions which caused some compilers to recognize a definition but others to not. llvm-svn: 279089
2016-08-16Revert "Write the TPI stream from a PDB to Yaml."Justin Bogner
This is hitting a "use of undeclared identifier 'skipPadding' error locally and on some bots. This reverts r278869. llvm-svn: 278871
2016-08-16Write the TPI stream from a PDB to Yaml.Zachary Turner
Reviewed By: ruiu, rnk Differential Revision: https://reviews.llvm.org/D23226 llvm-svn: 278869
2016-06-24[codeview] Use one byte for S_FRAMECOOKIE CookieKind and add flags byteReid Kleckner
We bailed out while printing codeview for an MSVC compiled SemaExprCXX.cpp that used this record. The MS reference headers look incorrect here, which is probably why we had this bug. They use a 32-bit enum as the field type, but the actual record appears to use one byte for the cookie kind followed by a flags byte. llvm-svn: 273691
2016-06-03[pdb] Dump file checksums from pdb codeview line info.Zachary Turner
llvm-svn: 271622
2016-06-02[llvm-pdbdump] Dump CodeView line information.Zachary Turner
This first pass only splits apart the records and dumps the line info kinds and binary data. Subsequent patches will parse out the binary data into more useful information and dump it in detail. llvm-svn: 271576
2016-06-02[pdb] Parse and dump section map and section contribsZachary Turner
Differential Revision: http://reviews.llvm.org/D20876 Reviewed By: rnk, ruiu llvm-svn: 271488