public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: derodat@adacore.com (Pierre-Marie de Rodat)
Cc: brobecker@adacore.com (Joel Brobecker),
	       Pitchumani.Sivanupandi@atmel.com (Sivanupandi Pitchumani),
	       gdb@sourceware.org (gdb@sourceware.org),
	       andrew.burgess@embecosm.com (Andrew Burgess),
	       tom@tromey.com (tom@tromey.com)
Subject: Re: dynamic array's upper bound evaluated as address for AVR target
Date: Fri, 23 Oct 2015 16:47:00 -0000	[thread overview]
Message-ID: <20151023164734.4798E6160@oc7340732750.ibm.com> (raw)
In-Reply-To: <562A41EA.6020304@adacore.com> from "Pierre-Marie de Rodat" at Oct 23, 2015 10:19:22 AM

Pierre-Marie de Rodat wrote:

> Quick update: I started to dig into this. I still have a hard time 
> wrapping the current implementation in my mind[1] and thinking about 
> what we should do exactly:
> 
>    * Have different types for expressions and location lists (hence 
> potentially renaming existing code): looks like a big commit!
> 
>    * Introduce another entry point to evaluate dynamic properties as 
> expressions. Looks like a small change but a weaker design: how to 
> evaluate depends a property depends on the property, not the evaluation 
> context, so it would be great to keep types distinct.
> 
> I cannot make any commitment on a schedule to implement this, though.

It seems to me the easiest path to implement the change incrementally
might be:

a.) We currently have:

enum dynamic_prop_kind
{
  PROP_UNDEFINED, /* Not defined.  */
  PROP_CONST,     /* Constant.  */
  PROP_ADDR_OFFSET, /* Address offset.  */
  PROP_LOCEXPR,   /* Location expression.  */
  PROP_LOCLIST    /* Location list.  */
};

As a first step, add a value
  PROP_EXPR     /* DWARF expression.  */
to this list.

b.) Add code to dwarf2_evaluate_property / dwarf2_compile_property_to_c
to support PROP_EXPR.

This is a bit tricky since there is no real infrastructure to evaluate
DWARF expressions, as opposed to location expressions.  Note that the
existing routine dwarf_entry_parameter_to_value uses the trick to append
DW_OP_stack_value to the expression to force evaluation as a DWARF
expression instead of location.  The same could probably be done here.

c.) For the range-related dynamic properties, create PROP_EXPR property
nodes instead of PROP_LOC* property nodes.  This probably means splitting
the routine attr_to_dynamic_prop into two variants, one for locations
and one for dynamic properties.

-- At this point, everything should be functionally correct, the rest
   is simply cleanup ---

d.) Create some new common mechanism to handle DWARF locations

e.) Change the various places where DWARF locations are handled to use
this new common mechanism:
 - DW_AT_location      [ currently uses SYMBOL_COMPUTED_OPS ]
 - DW_AT_frame_base    [ currently uses SYMBOL_BLOCK_OPS ]
 - DW_AT_data_location [ currently uses dynamic_prop ]
 - DW_AT_static_link   [ currently uses dynamic_prop ]

f.) Finally, remove (now unused) support for PROP_LOCEXPR/PROP_LOCLIST
from the dynamic property code.

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com

  reply	other threads:[~2015-10-23 16:47 UTC|newest]

Thread overview: 13+ 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
2015-10-14  6:54     ` Pierre-Marie de Rodat
2015-10-14  7:54       ` Sivanupandi, Pitchumani
2015-10-14  8:26         ` Pierre-Marie de Rodat
2015-10-14  9:41           ` Ulrich Weigand
2015-10-14 12:26             ` Joel Brobecker
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 [this message]
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=20151023164734.4798E6160@oc7340732750.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=Pitchumani.Sivanupandi@atmel.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=brobecker@adacore.com \
    --cc=derodat@adacore.com \
    --cc=gdb@sourceware.org \
    --cc=tom@tromey.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).