Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] mips-tdep.c: Fix bug introduced at time of NUM_REGS multiarch
@ 2002-12-20 22:46 Kevin Buettner
  2003-01-06 14:24 ` Andrew Cagney
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Buettner @ 2002-12-20 22:46 UTC (permalink / raw)
  To: gdb-patches

I've just committed the patch below.  As noted in the subject, it fixes
a bug that was introduced when I multiarched NUM_REGS a short time ago.

	* mips-tdep.c (heuristic_proc_desc): Clear memory associated with
	``temp_saved_regs'', not the pointer or other storage contiguous
	to this pointer.

Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.147
diff -u -p -r1.147 mips-tdep.c
--- mips-tdep.c	13 Dec 2002 18:09:30 -0000	1.147
+++ mips-tdep.c	21 Dec 2002 06:31:58 -0000
@@ -2142,7 +2142,7 @@ heuristic_proc_desc (CORE_ADDR start_pc,
     return NULL;
   memset (&temp_proc_desc, '\0', sizeof (temp_proc_desc));
   temp_saved_regs = xrealloc (temp_saved_regs, SIZEOF_FRAME_SAVED_REGS);
-  memset (&temp_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS);
+  memset (temp_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS);
   PROC_LOW_ADDR (&temp_proc_desc) = start_pc;
   PROC_FRAME_REG (&temp_proc_desc) = SP_REGNUM;
   PROC_PC_REG (&temp_proc_desc) = RA_REGNUM;


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

* Re: [PATCH] mips-tdep.c: Fix bug introduced at time of NUM_REGS multiarch
  2002-12-20 22:46 [PATCH] mips-tdep.c: Fix bug introduced at time of NUM_REGS multiarch Kevin Buettner
@ 2003-01-06 14:24 ` Andrew Cagney
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cagney @ 2003-01-06 14:24 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: gdb-patches

> I've just committed the patch below.  As noted in the subject, it fixes
> a bug that was introduced when I multiarched NUM_REGS a short time ago.
> 
> 	* mips-tdep.c (heuristic_proc_desc): Clear memory associated with
> 	``temp_saved_regs'', not the pointer or other storage contiguous
> 	to this pointer.
> 
> Index: mips-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/mips-tdep.c,v
> retrieving revision 1.147
> diff -u -p -r1.147 mips-tdep.c
> --- mips-tdep.c	13 Dec 2002 18:09:30 -0000	1.147
> +++ mips-tdep.c	21 Dec 2002 06:31:58 -0000
> @@ -2142,7 +2142,7 @@ heuristic_proc_desc (CORE_ADDR start_pc,
>      return NULL;
>    memset (&temp_proc_desc, '\0', sizeof (temp_proc_desc));
>    temp_saved_regs = xrealloc (temp_saved_regs, SIZEOF_FRAME_SAVED_REGS);
> -  memset (&temp_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS);
> +  memset (temp_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS);
>    PROC_LOW_ADDR (&temp_proc_desc) = start_pc;
>    PROC_FRAME_REG (&temp_proc_desc) = SP_REGNUM;
>    PROC_PC_REG (&temp_proc_desc) = RA_REGNUM;

Outch!

BTW, it isn't as bad as:

	memcpy (&frame->saved_regs, new_regs, sizeof (frame->saved_regs));

which has been cloned a number of times and now appears in multiple 
targets.  (frame->saved_regs is a pointer to the buffer).

good catch,
Andrew



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

end of thread, other threads:[~2003-01-06 14:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-20 22:46 [PATCH] mips-tdep.c: Fix bug introduced at time of NUM_REGS multiarch Kevin Buettner
2003-01-06 14:24 ` Andrew Cagney

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