Designs for better debug info in GCC

Daniel Berlin dberlin@dberlin.org
Wed Dec 19 16:35:00 GMT 2007


On 12/18/07, Alexandre Oliva <aoliva@redhat.com> wrote:
> On Dec 18, 2007, "Daniel Berlin" <dberlin@dberlin.org> wrote:
>
> >> int c = z;
> >> whatever0(c);
> >> c = x;
>
> > Because you have added information you have no way of knowing.
> > How exactly did you compute that the call *definitely sets c to the
> > value of z_0*, and definitely sets the value of c to x_2.
>
> Err...  I guess you're thinking memory, global variables, alias
> analysis and that sort of stuff.
>

Yes, i mixed your examples up, i apologize.

> None of this applies to gimple registers, which is all the annotations
> are about.
>
>
> > However, value equivalene does not imply location equivalence, and all
> > of our debug formats deal with locations of variables, except for
> > constants.
>
> Dwarf enables arbitrary value expressions too.
Well, uh, no.

The only way to directly specify the value of a variable is for
constants. DW_AT_const_value does not allow location descriptions.

"An entry describing a variable or formal parameter whose value is
constant and not
represented by an object in the address space of the program, or an
entry describing a named
constant, does not have a location attribute. Such entries have a
DW_AT_const_value
attribute, whose value may be a  string or any of the constant data or
data block forms, as
appropriate for the representation of the variable's value. The value
of this attribute is the
actual constant value of the variable, represented as it would be on
the target architecture.
"

There are no other provisions in DWARF for describing the value of a
variable, it is expected you describe their locations using
DW_AT_location (which gives you the full power of location
descriptions, but requires you to return a location, not a value)
> There's some
> discussion about lvalue vs rvalue in the document, and this is also
> something that will take some experimenting.  I'm not entirely sure
> where to draw the line, and I'm not entirely sure there is a perfect
> answer.
I'm still curious where you think it describes value expressions for
variables other than constants (which again, can't use the location
description language)

Again, i'd support such an extension, but it does not currently exist.
Rest answers in other message.



More information about the Gcc-patches mailing list