From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23794 invoked by alias); 21 Feb 2002 22:09:45 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 23693 invoked from network); 21 Feb 2002 22:09:44 -0000 Received: from unknown (HELO zwingli.cygnus.com) (208.245.165.35) by sources.redhat.com with SMTP; 21 Feb 2002 22:09:44 -0000 Received: by zwingli.cygnus.com (Postfix, from userid 442) id 0782A5E9E9; Thu, 21 Feb 2002 17:09:42 -0500 (EST) To: tromey@redhat.com Cc: gdb-patches@sources.redhat.com Subject: Re: Patch: Dwarf2 reader -vs- DW_OP_piece References: <87664qej9l.fsf@creche.redhat.com> From: Jim Blandy Date: Thu, 21 Feb 2002 14:09:00 -0000 In-Reply-To: <87664qej9l.fsf@creche.redhat.com> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-02/txt/msg00612.txt.bz2 Can you explain what sorts of location expressions this is supposed to help GDB handle? Tom Tromey writes: > 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 > > * 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: