[Dwarf-Discuss] DW_AT_default_value reference to "subroutine"

Michael Eager eager@eagerm.com
Tue Sep 16 22:50:51 GMT 2014


On 09/16/14 12:32, Robinson, Paul wrote:
> The DW_AT_default_value attribute on a formal_parameter DIE can be used to
> express a default argument for the parameter; C++ allows this, for example.
>      int foo(int a, int b = 2);
>      int bar(int x = foo(3)); // default for x is foo(3,2)
> The description of the attribute in DWARF 4 (section 4.1 item 9, p.70)
> says it can be a reference to "a variable or subroutine" as well as a
> constant. What it means for a variable or constant is pretty obvious; but
> it's not really clear about subroutines.  DWARF 4 says it's "the value
> returned by the referenced subroutine."
>
> Is this "subroutine" actually a DW_TAG_subprogram DIE?  That's not
> expressive enough for the full glory of C++ default arguments.  It's
> not even expressive enough to allow the debugger to call a single
> arbitrary compiled function, as there's no way to express what
> parameters to pass to the compiled function.
>
> Is this "subroutine" actually a DWARF procedure?  That suggests it
> should be evaluated like DW_OP_call_ref, which allows executing an
> arbitrary DWARF expression, but a DWARF expression can't actually
> describe calling a compiled function.
>
> Any old-timers out there who can shed light on the intent of this
> terminology?  I see similar verbiage all the way back to DWARF 2.

See issue 040909.1 (DWARF Version 3):
http://dwarfstd.org/ShowIssue.php?issue=040909.1

-- 
Michael Eager	 eager at eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077



More information about the Dwarf-discuss mailing list