Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Andrew Stubbs <ams@codesourcery.com>
To: Mark Kettenis <mark.kettenis@xs4all.nl>, gdb@sourceware.org
Subject: Re: [commited] Detect bad debug info
Date: Mon, 22 Sep 2008 13:13:00 -0000	[thread overview]
Message-ID: <48D799CC.4020103@codesourcery.com> (raw)
In-Reply-To: <20080922125011.GA25948@caradoc.them.org>

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

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?

Andrew

[-- Attachment #2: comment.patch --]
[-- Type: text/x-diff, Size: 929 bytes --]

2008-09-22  Andrew Stubbs  <ams@codesourcery.com>

	* 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)

  reply	other threads:[~2008-09-22 13:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-19 18:16 Andrew Stubbs
2008-09-19 22:27 ` Mark Kettenis
2008-09-22  9:42   ` Andrew Stubbs
2008-09-22 12:50     ` Daniel Jacobowitz
2008-09-22 13:13       ` Andrew Stubbs [this message]
2008-09-22 13:33         ` Daniel Jacobowitz
2008-09-22 13:38           ` Andrew Stubbs
2008-09-22 14:27         ` Mark Kettenis
2008-09-24 12:18 ` Andreas Schwab
2008-09-24 13:00   ` Andreas Schwab

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=48D799CC.4020103@codesourcery.com \
    --to=ams@codesourcery.com \
    --cc=gdb@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    /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