From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7244 invoked by alias); 22 Sep 2008 14:27:04 -0000 Received: (qmail 7236 invoked by uid 22791); 22 Sep 2008 14:27:04 -0000 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 22 Sep 2008 14:26:29 +0000 Received: from brahms.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by brahms.sibelius.xs4all.nl (8.14.3/8.14.3) with ESMTP id m8MENrfA009600; Mon, 22 Sep 2008 16:23:53 +0200 (CEST) Received: (from kettenis@localhost) by brahms.sibelius.xs4all.nl (8.14.3/8.14.3/Submit) id m8MENqKc022084; Mon, 22 Sep 2008 16:23:52 +0200 (CEST) Date: Mon, 22 Sep 2008 14:27:00 -0000 Message-Id: <200809221423.m8MENqKc022084@brahms.sibelius.xs4all.nl> From: Mark Kettenis To: ams@codesourcery.com CC: gdb@sourceware.org In-reply-to: <48D799CC.4020103@codesourcery.com> (message from Andrew Stubbs on Mon, 22 Sep 2008 14:12:44 +0100) Subject: Re: [commited] Detect bad debug info References: <48D3EC6C.8050809@codesourcery.com> <200809192224.m8JMOHEh032757@brahms.sibelius.xs4all.nl> <48D76849.90806@codesourcery.com> <20080922125011.GA25948@caradoc.them.org> <48D799CC.4020103@codesourcery.com> Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-09/txt/msg00122.txt.bz2 > Date: Mon, 22 Sep 2008 14:12:44 +0100 > From: Andrew Stubbs > > Daniel Jacobowitz wrote: > > On Mon, Sep 22, 2008 at 10:41:29AM +0100, Andrew Stubbs wrote: > >> The patch ensures that the debugger never attempts to read beyond the end > >> of the register file. > > > > Could you explain this in the code? I think it's more enlightening > > than "bad debug info". > > Very well, how about the attached? Thanks, that defenitely removes some serious question marks for me. > 2008-09-22 Andrew Stubbs > > * frame.c (get_frame_register_bytes): Comment improvments. > > Index: frame.c > =================================================================== > RCS file: /cvs/src/src/gdb/frame.c,v > retrieving revision 1.252 > diff -u -p -r1.252 frame.c > --- frame.c 19 Sep 2008 18:12:17 -0000 1.252 > +++ frame.c 22 Sep 2008 13:12:09 -0000 > @@ -806,13 +806,14 @@ get_frame_register_bytes (struct frame_i > regnum++; > } > > - /* Detect bad debug info. */ > + /* Ensure that we will not read beyond the end of the register file. > + This can only ever happen if the debug information is bad. */ > maxsize = -offset; > for (i = regnum; i < gdbarch_num_regs (gdbarch); i++) > { > int thissize = register_size (gdbarch, i); > if (thissize == 0) > - break; > + break; /* This register is not available on this architecture. */ > maxsize += thissize; > } > if (len > maxsize)