From: Seth LaForge Date: Thu, 3 Dec 2015 04:40:56 +0000 (-0800) Subject: Add DW_TAG_GNU_call_site* for better tail-call debug descriptions. X-Git-Tag: v0.24~12^2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=66ddce49d92ddaab94dba269ca5661367dc9f925;p=pyelftools.git Add DW_TAG_GNU_call_site* for better tail-call debug descriptions. 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); } --- diff --git a/elftools/dwarf/descriptions.py b/elftools/dwarf/descriptions.py index 9c56d67..abe9252 100644 --- a/elftools/dwarf/descriptions.py +++ b/elftools/dwarf/descriptions.py @@ -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 diff --git a/elftools/dwarf/enums.py b/elftools/dwarf/enums.py index d576dff..9140f91 100644 --- a/elftools/dwarf/enums.py +++ b/elftools/dwarf/enums.py @@ -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 index 0000000..0d7766d Binary files /dev/null and b/test/testfiles_for_readelf/gcc_tailcall.o.elf differ