aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
diff options
context:
space:
mode:
authorsivadeilra <ardavis@microsoft.com>2025-07-07 12:26:30 -0700
committerGitHub <noreply@github.com>2025-07-07 12:26:30 -0700
commit9923565fb8b9a6215e85ad1bb542c301332a502d (patch)
treec251a18bc1ccdc68b7c726fb49363fbc64ecc51e /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
parent5110ac4113b5969315a38e0cffe7580a4ca847a1 (diff)
downloadllvm-9923565fb8b9a6215e85ad1bb542c301332a502d.zip
llvm-9923565fb8b9a6215e85ad1bb542c301332a502d.tar.gz
llvm-9923565fb8b9a6215e85ad1bb542c301332a502d.tar.bz2
Add CodeView S_LABEL32 symbols for jump table targets (for Windows debugging) (#146121)
This PR provides more information to debuggers and analysis tools on Windows. It adds `S_LABEL32` symbols for each target BB of each jump table. This allows debuggers to insert symbolic labels when disassembling code. `S_LABEL32` symbol records indicate that a location is definitely code, and can optionally associate a string label with the code location. BBs generated for jump tables may or may not have string labels, so it is acceptable for the "name" field within `S_LABEL32` symbols to be an empty string. More importantly, this PR allows Windows analysis tools, such as those that generate hot-patches for the Windows kernel, to use these labels to distinguish code basic blocks from data blocks. Microsoft's analysis tools (similar to Bolt) rely on being able to identify all code blocks, so that the tools can traverse all instructions and verify that important requirements for hot-patching are met. This PR has no effect on code generation. It only affects the CodeView symbols that are emitted into OBJ files, which the linker then repackages into PDB files.
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
index c862802..c2b878e 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
@@ -146,6 +146,7 @@ private:
const MCSymbol *Branch;
const MCSymbol *Table;
size_t TableSize;
+ std::vector<const MCSymbol *> Cases;
};
// For each function, store a vector of labels to its instructions, as well as