Skip to content

Commit

Permalink
[DebugInfo][CodeView] Include namespace into emitted globals
Browse files Browse the repository at this point in the history
Before this patch, global variables didn't have their namespace prepended in the Codeview debug symbol stream. This prevented Visual Studio from displaying them in the debugger (they appeared as 'unspecified error')

Differential Revision: https://reviews.llvm.org/D79028
  • Loading branch information
aganea committed May 4, 2020
1 parent 94361dd commit 721ea5b
Show file tree
Hide file tree
Showing 3 changed files with 220 additions and 143 deletions.
4 changes: 3 additions & 1 deletion llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
Expand Up @@ -3111,7 +3111,9 @@ void CodeViewDebug::emitDebugInfoForGlobal(const CVGlobalVariable &CVGV) {
OS.EmitCOFFSectionIndex(GVSym);
OS.AddComment("Name");
const unsigned LengthOfDataRecord = 12;
emitNullTerminatedSymbolName(OS, DIGV->getName(), LengthOfDataRecord);
emitNullTerminatedSymbolName(
OS, getFullyQualifiedName(DIGV->getScope(), DIGV->getName()),
LengthOfDataRecord);
endSymbolRecord(DataEnd);
} else {
// FIXME: Currently this only emits the global variables in the IR metadata.
Expand Down
8 changes: 4 additions & 4 deletions llvm/test/DebugInfo/COFF/global_visibility.ll
Expand Up @@ -51,15 +51,15 @@
; CHECK: }
; CHECK: DataSym {
; CHECK: Kind: S_LDATA32 (0x110C)
; CHECK: DisplayName: local_int
; CHECK: DisplayName: foo::local_int
; CHECK: LinkageName: ?local_int@?1??foo@@YAXXZ@4HA
; CHECK: }
; CHECK: BlockSym {
; CHECK: Kind: S_BLOCK32 (0x1103)
; CHECK: }
; CHECK: DataSym {
; CHECK: Kind: S_LDATA32 (0x110C)
; CHECK: DisplayName: nested_int
; CHECK: DisplayName: foo::nested_int
; CHECK: LinkageName: ?nested_int@?1??foo@@YAXXZ@4HA
; CHECK: }
; CHECK: ScopeEndSym {
Expand All @@ -78,15 +78,15 @@
; CHECK: }
; CHECK: DataSym {
; CHECK: Kind: S_LDATA32 (0x110C)
; CHECK: DisplayName: local_int
; CHECK: DisplayName: bar::local_int
; CHECK: LinkageName: ?local_int@?1??bar@@YAXXZ@4HA
; CHECK: }
; CHECK: BlockSym {
; CHECK: Kind: S_BLOCK32 (0x1103)
; CHECK: }
; CHECK: DataSym {
; CHECK: Kind: S_LDATA32 (0x110C)
; CHECK: DisplayName: nested_int
; CHECK: DisplayName: bar::nested_int
; CHECK: LinkageName: ?nested_int@?1??bar@@YAXXZ@4HA
; CHECK: }
; CHECK: ScopeEndSym {
Expand Down

0 comments on commit 721ea5b

Please sign in to comment.