summaryrefslogtreecommitdiff
path: root/gdb/i386gnu-nat.c
diff options
context:
space:
mode:
authortschwinge <tschwinge>2013-04-30 09:27:43 +0000
committertschwinge <tschwinge>2013-04-30 09:27:43 +0000
commitf07777f3d6fdeeb0bf54c3411bb9212cf2db8cca (patch)
tree4f99e0114d1f7811609c388e3379b6a04ba90ac3 /gdb/i386gnu-nat.c
parent31c5013d4a2abb9e4bff9e46c0782daf7edd1fd7 (diff)
downloadgdb-f07777f3d6fdeeb0bf54c3411bb9212cf2db8cca.tar.gz
2013-04-30 Samuel Thibault <samuel.thibault@gnu.org>
* i386gnu-nat.c (CREG_OFFSET): New macro. (creg_offset): New array. (CREG_ADDR): Use creg_offset instead of reg_offset.
Diffstat (limited to 'gdb/i386gnu-nat.c')
-rw-r--r--gdb/i386gnu-nat.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/gdb/i386gnu-nat.c b/gdb/i386gnu-nat.c
index f33810348cb..0fd8d91d701 100644
--- a/gdb/i386gnu-nat.c
+++ b/gdb/i386gnu-nat.c
@@ -55,8 +55,21 @@ static int reg_offset[] =
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])
/* Get the whole floating-point state of THREAD and record the values