Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <cagney@gnu.org>
To: gdb-patches@sources.redhat.com
Subject: [Fwd: Re: RFA: DW_OP_piece read path]
Date: Thu, 14 Apr 2005 18:22:00 -0000	[thread overview]
Message-ID: <425EB411.6080109@gnu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 59 bytes --]

It appears I sent this to the wrong address, sigh.

Andrew

[-- Attachment #2: Re: RFA: DW_OP_piece read path --]
[-- Type: message/rfc822, Size: 4625 bytes --]

[-- Attachment #2.1.1: Type: text/plain, Size: 472 bytes --]

Andrew Cagney wrote:
> Elena,
> 
> This gets the read side of DW_OP_piece working, the write side is a lot 
> more work (in trying to code that side out I noticed that this tweak 
> would fix the immediate problem).
> 
> Tested on ppc, the printing of long-long in register values (as found in 
> store.exp) now passes.
> 
> I think with this in place we can (now that I've got some time again, 
> and my m/c stopped dieing) push out a quick 6.4.
> 
> ok?
> Andrew

Doh!


[-- Attachment #2.1.2: diffs --]
[-- Type: text/plain, Size: 1486 bytes --]

2005-04-05  Andrew Cagney  <cagney@gnu.org>

	* dwarf2loc.c (dwarf2_evaluate_loc_desc): Handle DW_OP_piece
	reads.

Index: dwarf2loc.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2loc.c,v
retrieving revision 1.26
diff -p -u -r1.26 dwarf2loc.c
--- dwarf2loc.c	31 Mar 2005 19:58:24 -0000	1.26
+++ dwarf2loc.c	5 Apr 2005 21:56:51 -0000
@@ -305,11 +305,27 @@ dwarf2_evaluate_loc_desc (struct symbol 
   dwarf_expr_eval (ctx, data, size);
   if (ctx->num_pieces > 0)
     {
-      /* We haven't implemented splicing together pieces from
-         arbitrary sources yet.  */
-      error (_("The value of variable '%s' is distributed across several\n"
-             "locations, and GDB cannot access its value.\n"),
-             SYMBOL_NATURAL_NAME (var));
+      int i;
+      long offset = 0;
+      bfd_byte *contents;
+      retval = allocate_value (SYMBOL_TYPE (var));
+      contents = value_contents_raw (retval);
+      for (i = 0; i < ctx->num_pieces; i++)
+	{
+	  struct dwarf_expr_piece *p = &ctx->pieces[i];
+	  if (p->in_reg)
+	    {
+	      bfd_byte regval[MAX_REGISTER_SIZE];
+	      int gdb_regnum = DWARF2_REG_TO_REGNUM (p->value);
+	      get_frame_register (frame, gdb_regnum, regval);
+	      memcpy (contents + offset, regval, p->size);
+	    }
+	  else /* In memory?  */
+	    {
+	      read_memory (p->value, contents + offset, p->size);
+	    }
+	  offset += p->size;
+	}
     }
   else if (ctx->in_reg)
     {

             reply	other threads:[~2005-04-14 18:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-14 18:22 Andrew Cagney [this message]
2005-04-14 18:46 ` Mark Kettenis

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=425EB411.6080109@gnu.org \
    --to=cagney@gnu.org \
    --cc=gdb-patches@sources.redhat.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