From 66ddce49d92ddaab94dba269ca5661367dc9f925 Mon Sep 17 00:00:00 2001 From: Seth LaForge Date: Wed, 2 Dec 2015 20:40:56 -0800 Subject: [PATCH] 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); } --- elftools/dwarf/descriptions.py | 4 ++++ elftools/dwarf/enums.py | 2 ++ test/testfiles_for_readelf/gcc_tailcall.o.elf | Bin 0 -> 2920 bytes 3 files changed, 6 insertions(+) create mode 100644 test/testfiles_for_readelf/gcc_tailcall.o.elf 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 0000000000000000000000000000000000000000..0d7766d01a4483af1fd13815efad522dc72afb8d GIT binary patch literal 2920 zcmbVOON$d(6h1eV?oJzx{ZQ;o&mxQQiK%onwvErw%_t3nFX*MTmFk-ZR;r{@kyb>- zjgNt0WBGT&HRm7iQsCMt{u>GZru~BZVChs)V=3?=Xp<^dOY~~mkT)|fJwkP z_$o09aKrk_Hx=82JunNq|2{#|Kd*8C{}J~aUU_1mpyG@Ln^nqq$+hbsEH{C$R{TZi zDCs>E@?yii&kl|G%Mz& zX7&N(Y;nG96;2gT7Y~-#=Lv2uyjU%ZdCd9rkwBN{tK~XM`Dc#=M|-jmFnf=m1=ts zIquEstuTnB8wDY_UA#GPac%8X<s<8&*{<(1B!kvmH8psVo2f zt%9!f2&wr_glTF%)f2>K5;nvx;uSxRhGIu7FKKuVcgn+aiQ}&50Ir0Op2Qf2t9my# zvP}|AJjMK8|7G+wV^Vz1|0f9vGHvUq%R2v(KL5Ykm(D+dmwEnG#LSrF@_`nlU*m1G znzkFLF)=dsHOT$v0H*B~RAkj(D8?S_PxVvnX8k?H%$Vf)T7yjz5@gzLp)M=`iq6k- zLiwqsW`24FQ%tTCSw-)3q6ZA-tT1fe=&{_RFv_UFFR^KCvm6#K2t|AvGFne~%w)=uU(bfSmafxb?= z@G|pHBbJr_Jt>fWh_}&d<{v2xhV1h2@v{Ld(aM}ysw1ls!m~O|I6cwhWWm%ph=?^h zeOhg)$xdS=S+H{)R5<&zoN>IC658Y=`Maovm`j$zoVcgD2{__L(Q zoLlxId!A7;JgKbXcSLf|FBv%3v8{2=dsoYR7Q&NL!@V}^;r^L;MaQFBlJ$H6jwQ-< literal 0 HcmV?d00001 -- 2.30.2