This is the mail archive of the gdb-patches@sources.redhat.com 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]

[PATCH main&6.0] fix core dump in mi register funcs


DEPRECATED_REGISTER_BYTES is not set anymore on those architectures
that use the new frame/register code, and it is 0 for such arches.  On
i386, register_changed_p() was writing to offset 16 of this 0-length
array and overwriting the output file data structures.
A core dump would happen later on.

Committed to mainline and branch.

elena


2003-09-10  Elena Zannoni  <ezannoni@redhat.com>

	* mi-main.c (mi_setup_architecture_data): Don't use
	DEPRECATED_REGISTER_BYTES because some architecture don't set it
	and its default is 0.

Index: mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.48.4.1
diff -u -p -r1.48.4.1 mi-main.c
--- mi-main.c	8 Aug 2003 18:35:23 -0000	1.48.4.1
+++ mi-main.c	11 Sep 2003 02:29:34 -0000
@@ -1475,9 +1475,8 @@ mi_load_progress (const char *section_na
 void
 mi_setup_architecture_data (void)
 {
-  /* don't trust DEPRECATED_REGISTER_BYTES to be zero. */
-  old_regs = xmalloc (DEPRECATED_REGISTER_BYTES + 1);
-  memset (old_regs, 0, DEPRECATED_REGISTER_BYTES + 1);
+  old_regs = xmalloc ((NUM_REGS + NUM_PSEUDO_REGS) * MAX_REGISTER_SIZE + 1);
+  memset (old_regs, 0, (NUM_REGS + NUM_PSEUDO_REGS) * MAX_REGISTER_SIZE + 1);
 }
 
 void


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