Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: Patch: Dwarf2 reader -vs- DW_OP_piece
Date: Thu, 21 Feb 2002 10:53:00 -0000	[thread overview]
Message-ID: <87664qej9l.fsf@creche.redhat.com> (raw)

I just submitted a change that changes gcc's Dwarf-2 output.
It hasn't been approved yet, but of course I'm hoping it will be.
With this change gcc will now generate DW_OP_piece when a value spans
multiple registers.

I came up with a somewhat hacky gdb patch to ignore DW_OP_piece.

I'm hoping this patch is just a stopgap until someone adds real
Dwarf-2 location expression support to gdb.

Ok?

Tom


Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* dwarf2read.c (decode_locdesc): Recognize DW_OP_piece.

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.48
diff -u -r1.48 dwarf2read.c
--- dwarf2read.c 2002/02/15 22:42:33 1.48
+++ dwarf2read.c 2002/02/21 18:49:43
@@ -5808,6 +5808,7 @@
   int stacki;
   unsigned int bytes_read, unsnd;
   unsigned char op;
+  int last_was_piece = 0;
 
   i = 0;
   stacki = 0;
@@ -5891,8 +5892,13 @@
 	case DW_OP_reg29:
 	case DW_OP_reg30:
 	case DW_OP_reg31:
-	  isreg = 1;
-	  stack[++stacki] = op - DW_OP_reg0;
+	  if (last_was_piece)
+	    last_was_piece = 0;
+	  else
+	    {
+	      isreg = 1;
+	      stack[++stacki] = op - DW_OP_reg0;
+	    }
 	  break;
 
 	case DW_OP_regx:
@@ -6043,6 +6049,14 @@
 	     this using GDB's address_class enum.  */
 	  if (i < size)
 	    complain (&dwarf2_complex_location_expr);
+	  break;
+
+	case DW_OP_piece:
+	  /* For now we essentially ignore this.  We assume it only
+	     occurs when a value spans multiple registers.  */
+	  read_unsigned_leb128 (NULL, (data + i), &bytes_read);
+	  i += bytes_read;
+	  last_was_piece = 1;
 	  break;
 
 	default:


             reply	other threads:[~2002-02-21 18:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-21 10:53 Tom Tromey [this message]
2002-02-21 14:09 ` Jim Blandy
2002-02-21 14:58   ` Tom Tromey
2002-02-23 22:15     ` Jim Blandy
2002-02-24  9:12       ` Andrew Cagney

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=87664qej9l.fsf@creche.redhat.com \
    --to=tromey@redhat.com \
    --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