All right.
Thank you,
Francis
On Thu, Jul 17, 2014 at 2:15 PM, Bill Williams <bill@xxxxxxxxxxx> wrote:
> After a quick check, libdwarf supports a variety of GNU extensions that
> Dyninst presently does not. Filing this one as "for 8.3" tentatively, as the
> gnu extensions will take more work than we want to tackle for 8.2.
>
>
> On 07/17/2014 01:03 PM, Francis Deslauriers wrote:
>>
>> Hi folks,
>> This email is part bug report and part question. I wanted to share
>> what I found while debugging this issue in order to helps someone that
>> would tackle this issue in the future.
>>
>> I want to retrieve the parameters of a binary that has been compile
>> with gcc -O2 optimization option.
>>
>> I made a dummy program (mutatee.c in the attached archive) that
>> contains a function named foo that has one parameter. I was wondering
>> why I was not able to get the parameter's name, type and eventually
>> value with my mutator program. So, I activated the
>> DYNINST_DEBUG_DWARF=1 env var to examine what was happening.
>> http://paste.ubuntu.com/7809741/. We can see on line 655 that there is
>> a failure parsing the third entry of the location list for the bar
>> variable.
>>
>> Here is the function foo:
>> void __attribute__((noinline, noclone))
>> foo(int bar)
>> {
>> printf("%d",bar);
>> return;
>> }
>>
>> Using the following: objdump --dwarf=info mutatee
>> We can find the entry for the foo function and find the bar parameter
>> at the 0x2ec offset.
>> <1><2cf>: Abbrev Number: 17 (DW_TAG_subprogram)
>> <2d0> DW_AT_external : 1
>> <2d0> DW_AT_name : foo
>> <2d4> DW_AT_decl_file : 1
>> <2d5> DW_AT_decl_line : 8
>> <2d6> DW_AT_prototyped : 1
>> <2d6> DW_AT_low_pc : 0x400650
>> <2de> DW_AT_high_pc : 0x13
>> <2e6> DW_AT_frame_base : 1 byte block: 9c
>> (DW_OP_call_frame_cfa)
>> <2e8> DW_AT_GNU_all_call_sites: 1
>> <2e8> DW_AT_sibling : <0x34b>
>> <2><2ec>: Abbrev Number: 18 (DW_TAG_formal_parameter)
>> <2ed> DW_AT_name : bar
>> <2f1> DW_AT_decl_file : 1
>> <2f2> DW_AT_decl_line : 8
>> <2f3> DW_AT_type : <0x5e>
>> <2f7> DW_AT_location : 0x0 (location list)
>>
>> We see at the last line that the DW_AT_location of the foo formal
>> parameter is a location list at offset 0x0 in the loc table which we
>> can examine using: objdump --dwarf=loc mutatee
>> 00000000 0000000000400650 000000000040065c (DW_OP_reg5 (rdi))
>> 00000013 000000000040065c 0000000000400662 (DW_OP_reg1 (rdx))
>> 00000026 0000000000400662 0000000000400663 (DW_OP_GNU_entry_value:
>> (DW_OP_reg5 (rdi)); DW_OP_stack_value)
>>
>> So from my understanding, we aren't able to correctly parse the third
>> entry of the location list. Digging in the code I found that the
>> keyword
>> DW_OP_GNU_entry_value is not handle by the switch case in
>> dwarf/src/dwarfExprParser.C:126.it then falls in the default case and
>> then return false.
>> This behavior causes the mutator to return an empty vector when asked
>> for the parameters of the function.
>>
>> My setup:
>> gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu9)
>> Dyninst branch v8.2
>>
>> Is this an issue that is within Dyninst's control, more related to
>> libdwarf or something else?
>>
>> Thanks,
>>
>> Francis
>>
>>
>>
>> _______________________________________________
>> Dyninst-api mailing list
>> Dyninst-api@xxxxxxxxxxx
>> https://lists.cs.wisc.edu/mailman/listinfo/dyninst-api
>>
>
>
> --
> --bw
>
> Bill Williams
> Paradyn Project
> bill@xxxxxxxxxxx
|