[PATCH] D80476: [DebugInfo/llvm-objdump] - Print "ZERO terminator" for terminator entries when dumping .eh_frame.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat May 23 09:31:41 PDT 2020
grimar created this revision.
grimar added reviewers: jhenderson, MaskRay, aprantl, ikudrin, dblaikie.
Herald added subscribers: rupprecht, atanasyan, hiraditya.
Herald added a project: LLVM.
A CIE with the Length == 0 is a terminator:
https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html
And GNU objdump recognizes them and prints the following for such entries:
"00000000 ZERO terminator"
This patch teaches llvm-objdump to do the same. I had to update tests to use
"CHECK-NEXT" too.
(Note: it looks perhaps not right that printing is done inside the DebugInfo library,
I'd expect to see the change in the llvm-objdump's code somewhere instead,
but that is how it done atm).
https://reviews.llvm.org/D80476
Files:
llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
llvm/test/tools/llvm-objdump/eh_frame-mipsel.test
llvm/test/tools/llvm-objdump/eh_frame_zero_cie.test
Index: llvm/test/tools/llvm-objdump/eh_frame_zero_cie.test
===================================================================
--- llvm/test/tools/llvm-objdump/eh_frame_zero_cie.test
+++ llvm/test/tools/llvm-objdump/eh_frame_zero_cie.test
@@ -1,10 +1,6 @@
# RUN: llvm-objdump --dwarf=frames %p/Inputs/eh_frame_zero_cie.o 2>/dev/null | FileCheck %s
-# CHECK: .eh_frame contents:
-
-# CHECK: 00000000 00000000 00000000 CIE
-# CHECK: Version: 0
-# CHECK: Augmentation: ""
-# CHECK: Code alignment factor: 0
-# CHECK: Data alignment factor: 0
-# CHECK: Return address column: 0
+# CHECK: .eh_frame contents:
+# CHECK-EMPTY:
+# CHECK-NEXT: 00000000 ZERO terminator
+# CHECK-NOT: {{.}}
Index: llvm/test/tools/llvm-objdump/eh_frame-mipsel.test
===================================================================
--- llvm/test/tools/llvm-objdump/eh_frame-mipsel.test
+++ llvm/test/tools/llvm-objdump/eh_frame-mipsel.test
@@ -1,27 +1,25 @@
# RUN: llvm-objdump --dwarf=frames %p/Inputs/eh_frame.elf-mipsel | FileCheck %s
-# CHECK: .eh_frame contents:
-
-# CHECK: 00000000 00000018 00000000 CIE
-# CHECK: Version: 1
-# CHECK: Augmentation: "zPLR"
-# CHECK: Code alignment factor: 1
-# CHECK: Data alignment factor: -4
-# CHECK: Return address column: 31
-# CHECK: Augmentation data: 80 90 0B 41 00 00 0B
-
-# CHECK: DW_CFA_def_cfa: reg29 +0
-
-# CHECK: 0000001c 00000018 00000020 FDE cie=00000000 pc=00400890...004008dc
-# CHECK: DW_CFA_advance_loc: 4
-# CHECK: DW_CFA_def_cfa_offset: +24
-# CHECK: DW_CFA_advance_loc: 4
-# CHECK: DW_CFA_offset: reg31 -4
-# CHECK: DW_CFA_nop:
-
-# CHECK: 00000038 00000000 00000000 CIE
-# CHECK: Version: 0
-# CHECK: Augmentation: ""
-# CHECK: Code alignment factor: 0
-# CHECK: Data alignment factor: 0
-# CHECK: Return address column: 0
+# CHECK: .eh_frame contents:
+# CHECK-EMPTY:
+# CHECK-NEXT: 00000000 00000018 00000000 CIE
+# CHECK-NEXT: Version: 1
+# CHECK-NEXT: Augmentation: "zPLR"
+# CHECK-NEXT: Code alignment factor: 1
+# CHECK-NEXT: Data alignment factor: -4
+# CHECK-NEXT: Return address column: 31
+# CHECK-NEXT: Personality Address: 0000000000410b90
+# CHECK-NEXT: Augmentation data: 80 90 0B 41 00 00 0B
+# CHECK-EMPTY:
+# CHECK-NEXT: DW_CFA_def_cfa: reg29 +0
+# CHECK-EMPTY:
+# CHECK-NEXT: 0000001c 00000018 00000020 FDE cie=00000000 pc=00400890...004008dc
+# CHECK-NEXT: LSDA Address: 0000000000400a90
+# CHECK-NEXT: DW_CFA_advance_loc: 4
+# CHECK-NEXT: DW_CFA_def_cfa_offset: +24
+# CHECK-NEXT: DW_CFA_advance_loc: 4
+# CHECK-NEXT: DW_CFA_offset: reg31 -4
+# CHECK-NEXT: DW_CFA_nop:
+# CHECK-EMPTY:
+# CHECK-NEXT: 00000038 ZERO terminator
+# CHECK-NOT: {{.}}
Index: llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
+++ llvm/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
@@ -304,6 +304,12 @@
}
void CIE::dump(raw_ostream &OS, const MCRegisterInfo *MRI, bool IsEH) const {
+ // A CIE with a zero length is a terminator entry in the .eh_frame sextion.
+ if (IsEH && Length == 0) {
+ OS << format("%08" PRIx64, Offset) << " ZERO terminator\n";
+ return;
+ }
+
OS << format("%08" PRIx64, Offset)
<< format(" %0*" PRIx64, IsDWARF64 ? 16 : 8, Length)
<< format(" %0*" PRIx64, IsDWARF64 && !IsEH ? 16 : 8,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80476.265869.patch
Type: text/x-patch
Size: 3486 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200523/682aea8b/attachment-0001.bin>
More information about the llvm-commits
mailing list