This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: supporting DW_OP_{implicit,stack}_value


> Yep. Although I would be fine with any *ops != NULL.

Sure, just that's what it will be.  
*ops == NULL is the check that callers should make.

> I admit to not be completely clear on why the caller is providing the
> ops_mem array (or why it increased from 2 to 3 in this proposal). If it
> is an optimization for memory use, could you let the user provide an
> arbitrary length array (and reuse *nops also as input size)?

There are two kinds of cases: DW_CFA_{val_,}expression, or something else.
For *expression, we return an internal-cache pointer just as in
dwarf_getlocation.  For the other cases (which is 99% of CFI), we do not
store Dwarf_Op[] form anywhere because it would be a waste of memory.
The expression can be one of:

	DW_OP_call_frame_cfa
	DW_OP_call_frame_cfa DW_OP_plus_uconst(N)
	DW_OP_call_frame_cfa DW_OP_stack_value
	DW_OP_call_frame_cfa DW_OP_plus_uconst(N) DW_OP_stack_value
	DW_OP_regx(N)

So that's where we get the maxiumum of 3, and was 2 without DW_OP_stack_value.

I've now done what you suggested, but further changed both
dwarf_frame_{cfa,register} to return only 0/-1 and fill in *nops,
so they match dwarf_getlocation.  

Note that dwarf_frame_cfa still returns only a DWARF expression, not a
location description, i.e. it has no DW_OP_stack_value suffix (which would
always be there for a location description for the CFA, which is never
mutable).  This means you can actually just replace DW_OP_call_frame_cfa
directly with this sequence of ops and it has exactly the right meaning.


Thanks,
Roland

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]