This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] mips-tdep.c: Fix bug introduced at time of NUM_REGS multiarch

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;

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,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]