-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[llvm-debuginfo-analyzer] Support both Reference and Type attrs in si…
…ngle DIE Relax the assumption that at most one Reference-or-Type-like attribute is present on a DWARF DIE. Add support for at most one Type attribute (i.e. DW_AT_import xor DW_AT_type) and separately at most one Reference attribute (i.e. DW_AT_specification xor DW_AT_abstract_origin xor ...). Update comment describing old assumption and tag it as a "FIXME" to reflect the fact that this is perhaps still not general enough. Add a test based on the case which led me to encounter the bug in the wild. Reviewed By: CarlosAlbertoEnciso Differential Revision: https://reviews.llvm.org/D150713
- Loading branch information
Showing
4 changed files
with
64 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+1.97 KB
llvm/test/tools/llvm-debuginfo-analyzer/DWARF/Inputs/dw-at-specification.o
Binary file not shown.
29 changes: 29 additions & 0 deletions
29
llvm/test/tools/llvm-debuginfo-analyzer/DWARF/dw-at-specification.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
; REQUIRES: x86-registered-target | ||
|
||
; dw-at-specification.cpp | ||
; 1 struct S { | ||
; 2 static const int Arr[]; | ||
; 3 }; | ||
; 4 const int S::Arr[] = { | ||
; 5 0, 1, 2 | ||
; 6 }; | ||
|
||
; The above test compiled with clang++ produces both a DW_AT_type and | ||
; DW_AT_specification on the definition die for S::Arr, which previously caused | ||
; an assert in the LVELFReader: | ||
; $ clang++ -g -c dw-at-specification.cpp -o dw-at-specification.o | ||
|
||
; RUN: llvm-debuginfo-analyzer --attribute=level,format,producer \ | ||
; RUN: --output-sort=name \ | ||
; RUN: --print=symbols \ | ||
; RUN: %p/Inputs/dw-at-specification.o 2>&1 | \ | ||
; RUN: FileCheck --strict-whitespace -check-prefix=CHECK %s | ||
|
||
; CHECK: Logical View: | ||
; CHECK: [000] {File} 'dw-at-specification.o' -> elf64-x86-64 | ||
; CHECK-EMPTY: | ||
; CHECK: [001] {CompileUnit} 'a.cpp' | ||
; CHECK: [002] {Producer} 'clang version 11.0.0 ({{.*}})' | ||
; CHECK: [002] {Variable} 'Arr' -> 'const int [3]' | ||
; CHECK: [002] 1 {Struct} 'S' | ||
; CHECK: [003] 2 {Member} extern public 'Arr' -> 'const int [1]' |