RE: [PATCH perf 3/4] perf tools: Fix unused variables: x86_{32,64}_regoffset_table
From: åæéå / HIRAMATUïMASAMI
Date: Fri Jan 22 2016 - 03:00:07 EST
>From: Wangnan (F) [mailto:wangnan0@xxxxxxxxxx]
>On 2016/1/22 13:56, åæéå / HIRAMATUïMASAMI wrote:
>>> From: Wangnan (F) [mailto:wangnan0@xxxxxxxxxx]
>>> I think this problem is not introduced by my patch. In fact
>>> there's a fundamental problem in get_arch_regstr() that it is
>>> impossible to switch sub ISA.
>> Right, but I guess this can fixed by switching %sp (for x86-64)
>> and +0(%sp) (for x86-32) instead of $stack.
>>
>
>It may not work.
>
>No matter how we change regoffset_table, when get_arch_regstr()
>get a register number 4, how can it know whether we are looking
>for x86_32 register and return $stack or return %si for x86_64?
I think we can also use elf header to get the ISA of the
target binary.
>The fundamental problem is: we need a way to map dwarf's register
>number to register names so uprobe know which register we are
>looking for, but the API we designed for this can't distinguish
>the sub ISAs dwarf are using.
As I said, we can read the elf header and get the Class or Machine
and switch the table according to it. Can't it?
Thanks,