Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH,HURD] Fix reading core
@ 2013-02-11  2:01 Samuel Thibault
  2013-04-10 11:33 ` Joel Brobecker
  0 siblings, 1 reply; 9+ messages in thread
From: Samuel Thibault @ 2013-02-11  2:01 UTC (permalink / raw)
  To: gdb-patches, thomas; +Cc: bug-hurd

The i386 GNU/Hurd ELF core format actually follows the uaccess gregset_t
array format, not the Mach thread state format.  This fixes gdb reading
it.

* gdb/i386gnu-nat.c (CREG_OFFSET): New macro.
(creg_offset): New array.
(CREG_ADDR): Use creg_offset instead of reg_offset.

--- a/gdb/i386gnu-nat.c.original	2013-02-11 00:46:02.000000000 +0000
+++ b/gdb/i386gnu-nat.c	2013-02-11 00:48:09.000000000 +0000
@@ -56,8 +56,21 @@
   REG_OFFSET (ds), REG_OFFSET (es), REG_OFFSET (fs), REG_OFFSET (gs)
 };
 
+/* Offset to the greg_t location where REG is stored.  */
+#define CREG_OFFSET(reg) (REG_##reg * 4)
+
+/* At CREG_OFFSET[N] is the offset to the greg_t location where
+   the GDB register N is stored.  */
+static int creg_offset[] =
+{
+  CREG_OFFSET (EAX), CREG_OFFSET (ECX), CREG_OFFSET (EDX), CREG_OFFSET (EBX),
+  CREG_OFFSET (UESP), CREG_OFFSET (EBP), CREG_OFFSET (ESI), CREG_OFFSET (EDI),
+  CREG_OFFSET (EIP), CREG_OFFSET (EFL), CREG_OFFSET (CS), CREG_OFFSET (SS),
+  CREG_OFFSET (DS), CREG_OFFSET (ES), CREG_OFFSET (FS), CREG_OFFSET (GS)
+};
+
 #define REG_ADDR(state, regnum) ((char *)(state) + reg_offset[regnum])
-#define CREG_ADDR(state, regnum) ((const char *)(state) + reg_offset[regnum])
+#define CREG_ADDR(state, regnum) ((const char *)(state) + creg_offset[regnum])
 
 \f
 /* Get the whole floating-point state of THREAD and record the values


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

end of thread, other threads:[~2013-04-30  9:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-11  2:01 [PATCH,HURD] Fix reading core Samuel Thibault
2013-04-10 11:33 ` Joel Brobecker
2013-04-11  2:44   ` Thomas Schwinge
2013-04-11  3:55     ` Samuel Thibault
2013-04-11 14:08       ` Thomas Schwinge
2013-04-26 17:50   ` Samuel Thibault
2013-04-26 19:02     ` Joel Brobecker
2013-04-26 19:03       ` Alfred M. Szmidt
2013-04-30 12:02   ` Thomas Schwinge

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