From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19455 invoked by alias); 19 Sep 2008 22:27:34 -0000 Received: (qmail 19445 invoked by uid 22791); 19 Sep 2008 22:27:33 -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; Fri, 19 Sep 2008 22:26:58 +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 m8JMOHmb012111; Sat, 20 Sep 2008 00:24:17 +0200 (CEST) Received: (from kettenis@localhost) by brahms.sibelius.xs4all.nl (8.14.3/8.14.3/Submit) id m8JMOHEh032757; Sat, 20 Sep 2008 00:24:17 +0200 (CEST) Date: Fri, 19 Sep 2008 22:27:00 -0000 Message-Id: <200809192224.m8JMOHEh032757@brahms.sibelius.xs4all.nl> From: Mark Kettenis To: ams@codesourcery.com CC: gdb@sourceware.org In-reply-to: <48D3EC6C.8050809@codesourcery.com> (message from Andrew Stubbs on Fri, 19 Sep 2008 19:16:12 +0100) Subject: Re: [commited] Detect bad debug info References: <48D3EC6C.8050809@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/msg00116.txt.bz2 > Date: Fri, 19 Sep 2008 19:16:12 +0100 > From: Andrew Stubbs > > Hi, > > I have just committed the attached patch (approved privately by Daniel > Jacobowitz). > > The patch causes GDB to fail gracefully when it encounters a particular > flavour of bad debug info. Would it be possible to add some detail about this? "a particular falvour of bad debug info" is pretty non-informative. Thanks, Mark > 2008-09-19 Andrew Stubbs > > * frame.c (get_frame_register_bytes): Detect bad debug info. > > Index: gdb/frame.c > =================================================================== > RCS file: /cvs/src/src/gdb/frame.c,v > retrieving revision 1.251 > diff -u -p -r1.251 frame.c > --- gdb/frame.c 26 Aug 2008 17:40:24 -0000 1.251 > +++ gdb/frame.c 19 Sep 2008 18:10:34 -0000 > @@ -796,6 +796,8 @@ get_frame_register_bytes (struct frame_i > CORE_ADDR offset, int len, gdb_byte *myaddr) > { > struct gdbarch *gdbarch = get_frame_arch (frame); > + int i; > + int maxsize; > > /* Skip registers wholly inside of OFFSET. */ > while (offset >= register_size (gdbarch, regnum)) > @@ -804,6 +806,22 @@ get_frame_register_bytes (struct frame_i > regnum++; > } > > + /* Detect bad debug info. */ > + maxsize = -offset; > + for (i = regnum; i < gdbarch_num_regs (gdbarch); i++) > + { > + int thissize = register_size (gdbarch, i); > + if (thissize == 0) > + break; > + maxsize += thissize; > + } > + if (len > maxsize) > + { > + warning (_("Bad debug information detected: " > + "Attempt to read %d bytes from registers."), len); > + return 0; > + } > + > /* Copy the data. */ > while (len > 0) > { > > --------------060704060100080904030200-- >