[Dwarf-discuss] DW_AT_ranges info generated by gcc

Bishop, John E john.e.bishop
Thu Apr 28 15:10:00 GMT 2005


In Vol 8, Issue 7, Daniel Jacobowitz says:

> It seems natural to me that an outer scope which completely encloses
an
> inner scope will have PC bounds completely enclosing the bounds of its
> inner scopes.  Functions already do this; it's pretty clear that the
> range information for a function should include all code associated
> with the function.

It seems to me that there are two possible meanings for the
PC ranges associated with a scope:

1.  These are the ranges of me and all my sub-ranges unioned
    together (as suggested above), or

2.  These are the ranges only for that code which is me.

In the former case, we'll need a rule for determining which
scope "wins", such as "the innermost scope claiming a PC address
wins".

But in the presence of tail-merging or phi-motions, it can be
the case that a single instruction is the merge of instructions
from different scopes: consider inlining applied to this program:

   caller() {
       if () {
          foo(x);
	    shared-bit
       } else {
          foo(y);
          shared-bit;
       }
   }

   foo(z) {
      /* actions depending on z */
      other-actions...;
   }

The resulting code could look like this:

   compare-and-branch $L1
   x-specific stuff
   branch $L2
 $L1:
   y-specific stuff
 $L2:
   other-actions
   shared-bit

The "other-actions" instructions are from scope "foo".
It's possible that "other-actions" and "shared-bit" allow
further merging.  So the same instruction could be in
multiple scopes, and not all innermost ones.

So "innermost scope wins" isn't a possible rule: it could
be incomplete.  Therefore the scopes for a range should 
be the "definitely me" scopes, and it should be the case
that the ranges are not disjoint: more than one scope can
contain a given address.

Having said this, I should introduce myself: I'm a new
hire on the Intel debugger (IDB) team.   Previously I've
worked on Digital's Ladebug and VMS debuggers, on HP's
wdb (a gdb variant) and DDE debuggers and on Pascal and
BLISS compilers.  But I've only just started to learn
DWARF.  Comments are therefore welcome!

	-John Bishop




More information about the Dwarf-discuss mailing list