This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [RFA] fetch result of locdesc expressions as integer (not address)


Joel Brobecker wrote:

> The problem is that the debugger is treating the result of
> the DWARF location expressions as addresses, whereas this is
> just an offset in this case.  I think that this was an unintentional
> side-effect of simplifying the code that fetches the result
> from the DWARF expression computation stack. We had a bit of
> code that used to fetch it, and turn it into a struct value.
> And we replaced it by one call to a function that seemed to
> be doing the same: dwarf_expr_fetch_address. The problem is
> that dwarf_expr_fetch_address treats the result as an address,
> and thus applies the integer_to_address gdbarch method. We do
> not want that for struct field offsets...
> 
> gdb/ChangeLog:
> 
>         * dwarf2read.c (decode_locdesc): Fetch the result of
>         the expression evaluation as an integer rather than
>         an address.

It seems the problem is a bit more complex: different callers
of decode_locdesc have different expectations.  As the comment
before the routine says:

   NOTE drow/2003-11-18: This function is called in two situations
   now: for the address of static or global variables (partial symbols
   only) and for offsets into structures which are expected to be
   (more or less) constant.

In the first of these situations, dwarf_expr_fetch_address is
probably required on some architectures.  Of course, in the
second situation (which is the one you ran into), we need to
treat the result as integer instead of address ...

Maybe we ought to have two routines (or a parameter) here.

[ In any case, from a quick look at the callers, some of those
really want to evaluate DWARF expressions only, not generic
location descriptions.  But this distinction is mostly ignored
in the rest of our DWARF code as well ... that should probably
be cleaned up at some point. ]

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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