Add DW_TAG_GNU_call_site* for better tail-call debug descriptions.
authorSeth LaForge <seth@ridemission.com>
Thu, 3 Dec 2015 04:40:56 +0000 (20:40 -0800)
committerSeth LaForge <sethml@google.com>
Thu, 10 Dec 2015 18:42:57 +0000 (10:42 -0800)
This comes up for functions which have tail-calls optimized.
Describe location list for DW_AT_GNU_call_site_* to match readelf.
Add test elf file to demonstrate that we match readelf for DW_AT_GNU_call_site_*. C source is:
  extern int f2(int a, char b);
  extern char var;
  int f1(void) { return f2(666, var); }

elftools/dwarf/descriptions.py
elftools/dwarf/enums.py
test/testfiles_for_readelf/gcc_tailcall.o.elf [new file with mode: 0644]

index 9c56d67a8ee3a217daa5ed2cb645741877e00427..abe9252d1c5f398138d0f16ff3a94ecc7d65f937 100644 (file)
@@ -489,6 +489,10 @@ _EXTRA_INFO_DESCRIPTION_MAP = defaultdict(
     DW_AT_data_location=_location_list_extra,
     DW_AT_stride=_location_list_extra,
     DW_AT_import=_import_extra,
+    DW_AT_GNU_call_site_value=_location_list_extra,
+    DW_AT_GNU_call_site_data_value=_location_list_extra,
+    DW_AT_GNU_call_site_target=_location_list_extra,
+    DW_AT_GNU_call_site_target_clobbered=_location_list_extra,
 )
 
 # 8 in a line, for easier counting
index d576dffb5055fa56e1df044c7b8672d4e6199f44..9140f91519d962bd7aa0edf1ed01b7112b38d85f 100644 (file)
@@ -79,6 +79,8 @@ ENUM_DW_TAG = dict(
     DW_TAG_rvalue_reference_type    = 0x42,
 
     DW_TAG_lo_user                  = 0x4080,
+    DW_TAG_GNU_call_site            = 0x4109,
+    DW_TAG_GNU_call_site_parameter  = 0x410a,
     DW_TAG_hi_user                  = 0xffff,
 
     _default_                       = Pass,
diff --git a/test/testfiles_for_readelf/gcc_tailcall.o.elf b/test/testfiles_for_readelf/gcc_tailcall.o.elf
new file mode 100644 (file)
index 0000000..0d7766d
Binary files /dev/null and b/test/testfiles_for_readelf/gcc_tailcall.o.elf differ