[commited] Detect bad debug info

Mark Kettenis mark.kettenis@xs4all.nl
Mon Sep 22 14:27:00 GMT 2008


> Date: Mon, 22 Sep 2008 14:12:44 +0100
> From: Andrew Stubbs <ams@codesourcery.com>
> 
> 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  <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)



More information about the Gdb mailing list