From: "Sivanupandi, Pitchumani" <Pitchumani.Sivanupandi@atmel.com>
To: Pierre-Marie de Rodat <derodat@adacore.com>,
"gdb@sourceware.org" <gdb@sourceware.org>
Cc: Andrew Burgess <andrew.burgess@embecosm.com>,
"tom@tromey.com" <tom@tromey.com>,
"uweigand@de.ibm.com" <uweigand@de.ibm.com>
Subject: RE: dynamic array's upper bound evaluated as address for AVR target
Date: Wed, 14 Oct 2015 06:33:00 -0000 [thread overview]
Message-ID: <CAC140656783604CABA6AE60C2A6D5A4A2ED2398@penmbx01> (raw)
In-Reply-To: <561D18AD.6080701@adacore.com>
> -----Original Message-----
> From: Pierre-Marie de Rodat [mailto:derodat@adacore.com]
> Sent: 13 October 2015 20:14
> To: Sivanupandi, Pitchumani; gdb@sourceware.org
> Cc: Andrew Burgess; tom@tromey.com; uweigand@de.ibm.com
> Subject: Re: dynamic array's upper bound evaluated as address for AVR target
>
> Pitchumani,
>
> (chiming in because I’ve worked a bit on DWARF expressions in GDB, but
> disclaimer: I’m not a maintainer ;-))
>
> On 10/13/2015 11:07 AM, Sivanupandi, Pitchumani wrote:
> > Why is that location expression treated as DWARF_VALUE_MEMORY by default?
> > Can gdb detect if location expression for literal value (e.g. array
> > bounds) or not?
>
> struct dwarf_expr_context::location is relevant only when evaluating DWARF
> expressions which are location descriptions. These descriptions generally
> compute addresses for objects but this “location” field makes it possible to
> describe objects that are not in memory (for instance in registers or
> several pieces in different places).
>
> Anyway in the case you expose, the DWARF expressions compute bounds (i.e.
> scalar values) and thus this field is not relevant[1].
>
> I was not aware of this hook (integer_to_address) and I could not find
> relevant documentation to learn about what it means, in what specific cases
> it should be used/avoided and why it exists in the first place (not being
> familiar with AVR neither, I don't understand what the corresponding code in
> avr-tdep.c does), so the following is speculation.
Target hook for integer_to_address does some manipulation on the given value.
In AVR target, it adds SRAM memory mask to the value to make that SRAM address.
> dwarf2_locexpr_baton_eval evaluates a DWARF expression assuming it computes
> the address of an object[1] and thus ends up invoking this hook. So my
> understanding is that either we should not call dwarf2_locexpr_baton_eval
> when evaluating things that are not locations (such as subrange bounds),
> either we should adapt dwarf2_locexpr_baton_eval to accept a new parameter
> telling wether the caller wants an address or a scalar.
>
> Thoughts?
>
> [1] This makes me feel like the handling of everything that is not
> DWARF_VALUE MEMORY in this function is dead (and incorrect) code: we should
> not get anything else in this context. I checked what happens when
> evaluating expressions in a GDB session:
> dwarf2_evaluate_loc_desc_full is called to get the location of objects, not
> dwarf2_locexpr_baton_eval. I tried to remove stack/register/literal handling
> and had no testsuite regression.
Function dwarf2_locexpr_baton_eval is called by dwarf2_evaluate_property for
location expression (from resolve_dynamic_range. i.e. to resolve bounds of
dynamic array e.g. int int_vla[n] where n is function parameter).
Regards,
Pitchumani
next prev parent reply other threads:[~2015-10-14 6:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-13 9:08 Sivanupandi, Pitchumani
2015-10-13 14:44 ` Pierre-Marie de Rodat
2015-10-14 6:33 ` Sivanupandi, Pitchumani [this message]
[not found] ` <561DFC25.5020106@adacore.com>
2015-10-14 7:54 ` Sivanupandi, Pitchumani
[not found] ` <561E11A2.5030206@adacore.com>
2015-10-14 9:41 ` Ulrich Weigand
[not found] ` <20151014122638.GG661@adacore.com>
2015-10-14 13:37 ` Pierre-Marie de Rodat
2015-10-23 14:19 ` Pierre-Marie de Rodat
2015-10-23 16:47 ` Ulrich Weigand
2015-10-14 10:15 ` Sivanupandi, Pitchumani
2015-10-14 13:39 ` Pierre-Marie de Rodat
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAC140656783604CABA6AE60C2A6D5A4A2ED2398@penmbx01 \
--to=pitchumani.sivanupandi@atmel.com \
--cc=andrew.burgess@embecosm.com \
--cc=derodat@adacore.com \
--cc=gdb@sourceware.org \
--cc=tom@tromey.com \
--cc=uweigand@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox