Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>,
	Tristan Gingold <gingold@adacore.com>
Cc: gdb-patches@sourceware.org, Ulrich Weigand <uweigand@de.ibm.com>
Subject: Re: [patch#2] fetch result of locdesc expressions as integer (not address)
Date: Mon, 17 Oct 2011 01:56:00 -0000	[thread overview]
Message-ID: <20111016233208.GV19246@adacore.com> (raw)
In-Reply-To: <20111009163457.GA1767@host1.jankratochvil.net>

> It is not an offset, the problem is it really is an address.
> 
> DWARF-4:
> # The beginning address is pushed on the DWARF stack before the location
> # description is evaluated; the result of the evaluation is the base address
> # of the member entry.

Ah - I missed that part of the standard, and that helps understand
the command that pushes the null address indeed.

> Both former and current FSF GDB pushes bogus address 0 first
> simulating base address of the struct.
> -  stack[stacki] = 0;
> -  stack[++stacki] = 0;
> +  /* DW_AT_data_member_location expects the structure address to be pushed on
> +     the stack.  Simulate the offset by address 0.  */
> +  dwarf_expr_push_address (ctx, 0, 0);

What we could perhaps try is to push 'integer-to-address(0)', rather
than zero itself.  Then, if we want the offset, then subtract that
same integer-to-address(0) value from the result.

> While trying to fix it I faced for example the exception for address 0 - isn't
> it broken for AVR?  Isn't SRAM address 0 a valid address?
> 	static CORE_ADDR
> 	avr_make_saddr (CORE_ADDR x)
> 	{
> 	  /* Return 0 for NULL.  */
> 	  if (x == 0)
> 	    return 0;
> 
> 	  return ((x) | AVR_SMEM_START);
> 	}
> Unfortunately I cannot argue about AVR arch issues.

Me neither, and the documentations I have been able to find wheren't
very clear or complete. I suspect that this is because it's not
typical CPU, but rather a micro controler.  I'm copying Tristan
who knows this architecture better.

> Joel, do you run the testsuite with iron AVR or is it OK to run it
> some way with sim/avr/ ?

We run our testsuite with the GDB simulator. For the official testsuite,
there should be a way to do it, and I have an email from Kevin that
should put me on the track, but for now, we have never really done it.

> gdb/
> 2011-10-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
> 
> 	Revert:
> 	2011-07-27  Jan Kratochvil  <jan.kratochvil@redhat.com>
>         * dwarf2expr.c (ctx_no_read_reg): New function.
>         * dwarf2expr.h (ctx_no_read_reg): New declaration.
>         * dwarf2read.c (read_2_signed_bytes, read_4_signed_bytes): Remove.
>         (decode_locdesc_read_mem, decode_locdesc_ctx_funcs): New.
>         (decode_locdesc): Replace by a caller of dwarf_expr_eval.
> 
> gdb/testsuite/
> 2011-10-09  Jan Kratochvil  <jan.kratochvil@redhat.com>
> 
> 	* gdb.dwarf2/dw2-simple-locdesc.exp (p &s.shl): KFAIL it.
> 	Revert the part of:
> 	2011-07-27  Jan Kratochvil  <jan.kratochvil@redhat.com>
> 	* gdb.dwarf2/dw2-stack-boundary.exp (check partial symtab errors):
> 	Change the expected string.

Based on the reasons you provided, it seems indeed that this patch
is no longer really necessary.  On the other hand, you are right
to say that it's a bit of a miracle that things are working so far.

-- 
Joel


  reply	other threads:[~2011-10-16 23:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-03 21:10 [RFA] " Joel Brobecker
2011-10-04 17:16 ` Tom Tromey
2011-10-04 19:32 ` Ulrich Weigand
2011-10-04 19:38   ` Joel Brobecker
2011-10-04 23:06     ` Ulrich Weigand
2011-10-05  1:09       ` Joel Brobecker
2011-10-05 12:30         ` Ulrich Weigand
2011-10-09 16:35 ` [patch#2] " Jan Kratochvil
2011-10-17  1:56   ` Joel Brobecker [this message]
2011-10-17  7:59     ` Tristan Gingold
2011-10-17 13:22       ` [commit] " Jan Kratochvil

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=20111016233208.GV19246@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=gingold@adacore.com \
    --cc=jan.kratochvil@redhat.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