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]: Prepare i386 GNU/Linux for native cross-debugging


When debugging a binary that isn't a GNU/Linux binary, or isn't
recognised as such by GDB, we'd better not try to access the
orig_eax "register" in GDB's register cache, since it isn't there.

Checked in.

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* i386-linux-nat.c (suppy_gregset): Don't supply
	I386_LINUX_ORIG_EAX_REGNUM if there isn't room for it in GDB's
	register cache.
	(fill_gregset): Don't fetch it under the same circumstances.

Index: i386-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386-linux-nat.c,v
retrieving revision 1.36
diff -u -p -r1.36 i386-linux-nat.c
--- i386-linux-nat.c 11 May 2002 17:22:26 -0000 1.36
+++ i386-linux-nat.c 9 Jun 2002 15:59:03 -0000
@@ -311,7 +311,8 @@ supply_gregset (elf_gregset_t *gregsetp)
   for (i = 0; i < NUM_GREGS; i++)
     supply_register (i, (char *) (regp + regmap[i]));
 
-  supply_register (I386_LINUX_ORIG_EAX_REGNUM, (char *) (regp + ORIG_EAX));
+  if (I386_LINUX_ORIG_EAX_REGNUM < NUM_REGS)
+    supply_register (I386_LINUX_ORIG_EAX_REGNUM, (char *) (regp + ORIG_EAX));
 }
 
 /* Fill register REGNO (if it is a general-purpose register) in
@@ -328,7 +329,8 @@ fill_gregset (elf_gregset_t *gregsetp, i
     if ((regno == -1 || regno == i))
       regcache_collect (i, regp + regmap[i]);
 
-  if (regno == -1 || regno == I386_LINUX_ORIG_EAX_REGNUM)
+  if ((regno == -1 || regno == I386_LINUX_ORIG_EAX_REGNUM)
+      && I386_LINUX_ORIG_EAX_REGNUM < NUM_REGS)
     regcache_collect (I386_LINUX_ORIG_EAX_REGNUM, regp + ORIG_EAX);
 }
 



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