Re: RFC: DWARF expression disassembly

Tom Tromey
2010-05-25T20:17:25Z

>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

Jan> On Tue, 25 May 2010 21:16:34 +0200, Tom Tromey wrote:
>> This is not always possible, though, and in
>> those cases it falls back to a disassembly form. Additionally, it adds
>> a new parameter, "maint show dwarf2 always-disassemble", which can be
>> set if you prefer to always get disassembly.

Jan> I have to ask why have you duplicated
Jan> binutils/dwarf.c:decode_location_expression().

I did think about this, and I have a few reasons.

First, it really isn't that much code. (The code in gdb is actually
much shorter, since we already have a table of opcode names.)

Second, we want some specialized behavior: different piece handling,
some output formatting details, and the fact that we want to only handle
operations that gdb itself handles. (This latter may be a mistake;
maybe we want to decode DW_OP_call* even though we can't evaluate them.)

Jan> Asking primarily because I miss the register names decording in readelf.

I don't see that in the code or the output. I see raw numbers like:

(DW_OP_reg3; DW_OP_piece: 4; DW_OP_fbreg: 0; DW_OP_deref; DW_OP_plus_uconst: 6; DW_OP_stack_value; DW_OP_piece: 4)

I can add decoding if you want. Maybe some other details need fixing
too; if you agree with this general approach, feel free to list all the
issues you run across and I will fix them up.

Tom