diff options
author | Mitch Phillips <31459023+hctim@users.noreply.github.com> | 2022-05-18 13:39:59 -0700 |
---|---|---|
committer | Mitch Phillips <31459023+hctim@users.noreply.github.com> | 2022-05-18 13:56:45 -0700 |
commit | 7aa1fa0a0a07f7949d2d77c099aab43cf9b75a91 (patch) | |
tree | de129bc5922b3c475f373bf3781af42a075be8b7 /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | |
parent | 7d8060bc19e9b03c93d825a5a790e3c1f4978c52 (diff) | |
download | llvm-7aa1fa0a0a07f7949d2d77c099aab43cf9b75a91.zip llvm-7aa1fa0a0a07f7949d2d77c099aab43cf9b75a91.tar.gz llvm-7aa1fa0a0a07f7949d2d77c099aab43cf9b75a91.tar.bz2 |
Reland "[dwarf] Emit a DIGlobalVariable for constant strings."
An upcoming patch will extend llvm-symbolizer to provide the source line
information for global variables. The goal is to move AddressSanitizer
off of internal debug info for symbolization onto the DWARF standard
(and doing a clean-up in the process). Currently, ASan reports the line
information for constant strings if a memory safety bug happens around
them. We want to keep this behaviour, so we need to emit debuginfo for
these variables as well.
Reviewed By: dblaikie, rnk, aprantl
Differential Revision: https://reviews.llvm.org/D123534
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 83d77cb..ece4167 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -3175,6 +3175,11 @@ void CodeViewDebug::collectGlobalVariableInfo() { for (const auto *GVE : CU->getGlobalVariables()) { const DIGlobalVariable *DIGV = GVE->getVariable(); const DIExpression *DIE = GVE->getExpression(); + // Don't emit string literals in CodeView, as the only useful parts are + // generally the filename and line number, which isn't possible to output + // in CodeView. String literals should be the only unnamed GlobalVariable + // with debug info. + if (DIGV->getName().empty()) continue; if ((DIE->getNumElements() == 2) && (DIE->getElement(0) == dwarf::DW_OP_plus_uconst)) |