Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Re: [commited] Detect bad debug info
       [not found] <48D3EC6C.8050809@codesourcery.com>
@ 2008-09-24 12:18 ` Andreas Schwab
  2008-09-24 13:00   ` Andreas Schwab
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2008-09-24 12:18 UTC (permalink / raw)
  To: Andrew Stubbs; +Cc: gdb, gdb-patches

Andrew Stubbs <ams@codesourcery.com> writes:

> +  /* Detect bad debug info.  */
> +  maxsize = -offset;
> +  for (i = regnum; i < gdbarch_num_regs (gdbarch); i++)

This is broken, it completely ignores the pseudo regs, which badly
breaks ia64 and many other targets.  Committed as obvious.

Andreas.

2008-09-24  Andreas Schwab  <schwab@suse.de>

	* frame.c (get_frame_register_bytes): Take pseudo registers into
	account.

--- frame.c.~1.253.~	2008-09-23 11:46:45.000000000 +0200
+++ frame.c	2008-09-24 14:09:33.000000000 +0200
@@ -809,7 +809,8 @@ get_frame_register_bytes (struct frame_i
   /* 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++)
+  for (i = regnum;
+       i < gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch); i++)
     {
       int thissize = register_size (gdbarch, i);
       if (thissize == 0)

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [commited] Detect bad debug info
  2008-09-24 12:18 ` [commited] Detect bad debug info Andreas Schwab
@ 2008-09-24 13:00   ` Andreas Schwab
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Schwab @ 2008-09-24 13:00 UTC (permalink / raw)
  To: Andrew Stubbs; +Cc: gdb, gdb-patches

Andreas Schwab <schwab@suse.de> writes:

> Andrew Stubbs <ams@codesourcery.com> writes:
>
>> +  /* Detect bad debug info.  */
>> +  maxsize = -offset;
>> +  for (i = regnum; i < gdbarch_num_regs (gdbarch); i++)
>
> This is broken, it completely ignores the pseudo regs, which badly
> breaks ia64 and many other targets.  Committed as obvious.
>
> Andreas.
>
> 2008-09-24  Andreas Schwab  <schwab@suse.de>
>
> 	* frame.c (get_frame_register_bytes): Take pseudo registers into
> 	account.

Also checked this in to avoid useless function calls.

Andreas.

--- ChangeLog.~1.9844.~	2008-09-24 14:15:35.000000000 +0200
+++ ChangeLog	2008-09-24 14:54:30.000000000 +0200
@@ -1,7 +1,7 @@
 2008-09-24  Andreas Schwab  <schwab@suse.de>
 
 	* frame.c (get_frame_register_bytes): Take pseudo registers into
-	account.
+	account.  Avoid excessive function calls.
 
 2008-09-23  Doug Evans  <dje@google.com>
 
--- frame.c.~1.254.~	2008-09-24 14:09:33.000000000 +0200
+++ frame.c	2008-09-24 14:53:45.000000000 +0200
@@ -798,6 +798,7 @@ get_frame_register_bytes (struct frame_i
   struct gdbarch *gdbarch = get_frame_arch (frame);
   int i;
   int maxsize;
+  int numregs;
 
   /* Skip registers wholly inside of OFFSET.  */
   while (offset >= register_size (gdbarch, regnum))
@@ -809,8 +810,8 @@ get_frame_register_bytes (struct frame_i
   /* 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) + gdbarch_num_pseudo_regs (gdbarch); i++)
+  numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
+  for (i = regnum; i < numregs; i++)
     {
       int thissize = register_size (gdbarch, i);
       if (thissize == 0)

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-09-24 13:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <48D3EC6C.8050809@codesourcery.com>
2008-09-24 12:18 ` [commited] Detect bad debug info Andreas Schwab
2008-09-24 13:00   ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox