[PATCH] D149367: Emit the CodeView `S_ARMSWITCHTABLE` debug symbol for jump tables

Daniel Paoliello via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 27 11:22:31 PDT 2023


dpaoliello created this revision.
Herald added subscribers: arphaman, hiraditya, kristof.beyls.
Herald added a project: All.
dpaoliello requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

[[ https://github.com/microsoft/microsoft-pdb/blob/0fe89a942f9a0f8e061213313e438884f4c9b876/cvdump/dumpsym7.cpp#L5518 | 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.

This change adds support to LLVM to emit the `S_ARMSWITCHTABLE` debug symbol as well as to dump it out (for testing purposes).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149367

Files:
  llvm/include/llvm/CodeGen/AsmPrinter.h
  llvm/include/llvm/DebugInfo/CodeView/CodeView.h
  llvm/include/llvm/DebugInfo/CodeView/CodeViewSymbols.def
  llvm/include/llvm/DebugInfo/CodeView/EnumTables.h
  llvm/include/llvm/DebugInfo/CodeView/SymbolRecord.h
  llvm/include/llvm/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.h
  llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
  llvm/lib/DebugInfo/CodeView/EnumTables.cpp
  llvm/lib/DebugInfo/CodeView/SymbolDumper.cpp
  llvm/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp
  llvm/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp
  llvm/lib/DebugInfo/LogicalView/Readers/LVCodeViewVisitor.cpp
  llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
  llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp
  llvm/test/DebugInfo/COFF/jump-table.ll
  llvm/tools/llvm-pdbutil/MinimalSymbolDumper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149367.517658.patch
Type: text/x-patch
Size: 30890 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230427/9bb5f0d2/attachment.bin>


More information about the llvm-commits mailing list