[PATCH] D38879: [llvm-dwarfdump] - Teach tool to parse DW_CFA_GNU_args_size.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 13 03:14:07 PDT 2017


grimar created this revision.
Herald added a subscriber: JDevlieghere.

Currently llvm-dwarfdump runs into llvm_unreachable when faces DW_CFA_GNU_args_size.

I found it when inspected the object produced by "GCC 7.0.1 20170211 (experimental)" and:
g++ -std=c++11 -w -m32 -fPIC -O3 -g -c 1.ii,
where 1.ii is file from PR34852.

DW_CFA_GNU_args_size is a DWARF CFI described here:
https://refspecs.linuxfoundation.org/LSB_3.0.0/LSB-PDA/LSB-PDA/dwarfext.html
(The DW_CFA_GNU_args_size instruction takes an unsigned LEB128 operand representing an argument size. 
This instruction specifies the total of the size of the arguments which have been pushed onto the stack.)


https://reviews.llvm.org/D38879

Files:
  lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
  test/tools/llvm-dwarfdump/X86/debug_frame_GNU_args_size.s


Index: test/tools/llvm-dwarfdump/X86/debug_frame_GNU_args_size.s
===================================================================
--- test/tools/llvm-dwarfdump/X86/debug_frame_GNU_args_size.s
+++ test/tools/llvm-dwarfdump/X86/debug_frame_GNU_args_size.s
@@ -0,0 +1,15 @@
+# RUN: llvm-mc %s -filetype=obj -triple=i686-pc-linux -o %t
+# RUN: llvm-dwarfdump -v %t | FileCheck %s
+
+# CHECK:      .eh_frame contents:
+# CHECK:        00000018 00000010 0000001c FDE cie=0000001c pc=00000000...00000000
+# CHECK-NEXT:     DW_CFA_GNU_args_size: +16
+# CHECK-NEXT:     DW_CFA_nop:
+
+.text
+.globl foo
+.type  foo, at function
+foo:
+ .cfi_startproc
+ .cfi_escape 0x2e, 0x10
+ .cfi_endproc
Index: lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
===================================================================
--- lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
+++ lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
@@ -163,6 +163,7 @@
         case DW_CFA_same_value:
         case DW_CFA_def_cfa_register:
         case DW_CFA_def_cfa_offset:
+        case DW_CFA_GNU_args_size:
           // Operands: ULEB128
           addInstruction(Opcode, Data.getULEB128(Offset));
           break;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38879.118894.patch
Type: text/x-patch
Size: 1160 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171013/f72776fa/attachment.bin>


More information about the llvm-commits mailing list