[all-commits] [llvm/llvm-project] 0c5c7b: Emit the CodeView `S_ARMSWITCHTABLE` debug symbol ...

Daniel Paoliello via All-commits all-commits at lists.llvm.org
Thu Aug 31 12:16:03 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0c5c7b52f0f395a6beb7956ba210b8ca727c0471
      https://github.com/llvm/llvm-project/commit/0c5c7b52f0f395a6beb7956ba210b8ca727c0471
  Author: Daniel Paoliello <danpao at microsoft.com>
  Date:   2023-08-31 (Thu, 31 Aug 2023)

  Changed paths:
    M llvm/include/llvm/CodeGen/AsmPrinter.h
    M llvm/include/llvm/CodeGen/ISDOpcodes.h
    M llvm/include/llvm/CodeGen/MachineInstr.h
    M llvm/include/llvm/CodeGen/SelectionDAG.h
    M llvm/include/llvm/CodeGen/SelectionDAGISel.h
    M llvm/include/llvm/CodeGen/TargetLowering.h
    M llvm/include/llvm/DebugInfo/CodeView/CodeView.h
    M llvm/include/llvm/DebugInfo/CodeView/CodeViewSymbols.def
    M llvm/include/llvm/DebugInfo/CodeView/EnumTables.h
    M llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h
    M llvm/include/llvm/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.h
    M llvm/include/llvm/Support/TargetOpcodes.def
    M llvm/include/llvm/Target/Target.td
    M llvm/include/llvm/Target/TargetSelectionDAG.td
    M llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    M llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
    M llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
    M llvm/lib/CodeGen/MachineCSE.cpp
    M llvm/lib/CodeGen/MachineInstr.cpp
    M llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
    M llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
    M llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
    M llvm/lib/DebugInfo/CodeView/EnumTables.cpp
    M llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
    M llvm/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp
    M llvm/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp
    M llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp
    M llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
    M llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
    M llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
    M llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp
    M llvm/lib/Target/ARM/ARMAsmPrinter.cpp
    M llvm/lib/Target/ARM/ARMAsmPrinter.h
    M llvm/lib/Target/X86/X86ISelLowering.cpp
    M llvm/lib/Target/X86/X86ISelLowering.h
    M llvm/test/CodeGen/AArch64/GlobalISel/select-jump-table-brjt-constrain.mir
    M llvm/test/CodeGen/AArch64/GlobalISel/select-jump-table-brjt.mir
    A llvm/test/DebugInfo/COFF/jump-table-with-indirect-ptr-null.ll
    A llvm/test/DebugInfo/COFF/jump-table.ll
    M llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp

  Log Message:
  -----------
  Emit the CodeView `S_ARMSWITCHTABLE` debug symbol for jump tables

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




More information about the All-commits mailing list