Sasha Da Rocha Pinheiro darochapinhe@wisc.edu
Thu May 2 19:29:00 GMT 2019

So why not a DW_OP_constu or DW_OP_consts and then a DW_OP_plus?

About the Dwarf_Op array we get from dwarf_frame_register(), (which are a sequence of Dwarf expressions): are they suppose to be an abstraction to all types of dwarf location descriptions? Including Single (single and composite) and Location Lists?

Is there more documentation about dwfl? What does dwfl stand for? (dwarf frame library?!)
We already have access to the process memory space and registers, so would expr_eval be suffice?

In case of finding the registers values at some PC, would it always gives us a single expression (like an address or an offset from a register)?

In the comment of dwarf_frame_register() in the file libdw.h, there is:
"Note the last operation is DW_OP_stack_value if there is no mutable location but only a computable value."
What is a mutable location, I didn't find this concept in the Dwarf Debugging Information Format v4.

Also there there is:

1057    For common simple expressions *OPS is OPS_MEM.  For arbitrary DWARF
1058    expressions in the CFI, *OPS is an internal pointer that can be used as
1059    long as the Dwarf_CFI used to create FRAME remains alive.  */

Why simple expression can only have 3 operations? (since Dwarf_Op ops_mem[3])
And what's an arbitrary Dwarf expression? What's a non-arbitrary?


From: Mark Wielaard <mark@klomp.org>
Sent: Wednesday, May 1, 2019 6:02 PM
To: Sasha Da Rocha Pinheiro
Cc: elfutils-devel@sourceware.org
Subject: Re: Dwarf_Op
On Wed, May 01, 2019 at 05:08:15PM +0000, Sasha Da Rocha Pinheiro wrote:
> yes, I did use dwarf_frame_register(), I believe I mentioned that :).

Sorry, I missed that.

> In the case I brought up you're saying it was an elfutils' libdw
> decision to provide negative number as DW_OP_plus_uconst (unsigned
> constant)? So there would be no harm to cast it to a signed int??

Yes, since I don't believe there is a better representation.
There is no DW_OP_plus_sconst for example.

> Do you know if the rules to find the registers will always have only
> another one register associated to it?  Because libdwarf function
> dwarf_get_fde_info_for_reg3() returns a register_num, which is
> described as: "Argument register_num should point to a location
> which will hold the register number associated with the register
> rule."

I am not familiar with libdwarf, so don't know how to answer this question

> elfutils only gives us a location description in an array of
> Dwarf_Op. Does it provide methods to "execute" it so we can get the
> result of the expressions? Or it delegates it to the consumer?

It doesn't have a generic location description "executor". It really
should have. But to make it generic it needs a lot of context.

libdwfl does contain a partial operator interpreter for unwinding. See
expr_eval in libdwfl/frame_unwind.c. To turn that into something more
generic we would need some way to provide it with things like memory
accessors and register values. libdwfl provides some of that through



More information about the Elfutils-devel mailing list