This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[RFA] gdbserver bits
- From: Michal Ludvig <mludvig at suse dot cz>
- To: Daniel Jacobowitz <drow at mvista dot com>
- Cc: GDB Patches <gdb-patches at sources dot redhat dot com>
- Date: Thu, 18 Jul 2002 16:59:51 +0200
- Subject: [RFA] gdbserver bits
- Organization: SuSE CR
Hi,
fifth patch today ;-)
This one adds CS and SS registers to regmap on x86-64 so that they are
stored and properly restored.
Also it adds a forgotten free() to prevent memory leakage in
regsets_store_inferior_registers().
Can I commit it?
Michal Ludvig
--
* SuSE CR, s.r.o * mludvig@suse.cz
* +420 2 9654 5373 * http://www.suse.cz
2002-07-18 Michal Ludvig <mludvig@suse.cz>
* linux-low.c (regsets_store_inferior_registers): Add free()
at the end of a loop to prevent memory leak.
* linux-x86-64-low.c (x86_64_regmap): Add CS, SS registers.
(X86_64_NUM_GREGS): Count it from the size of x86_64_regmap.
Index: linux-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-low.c,v
retrieving revision 1.17
diff -u -p -r1.17 linux-low.c
--- linux-low.c 11 Jun 2002 17:32:39 -0000 1.17
+++ linux-low.c 18 Jul 2002 14:46:53 -0000
@@ -1097,6 +1097,7 @@ regsets_store_inferior_registers ()
}
}
regset ++;
+ free (buf);
}
return 0;
}
Index: linux-x86-64-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-x86-64-low.c,v
retrieving revision 1.6
diff -u -p -r1.6 linux-x86-64-low.c
--- linux-x86-64-low.c 4 Jul 2002 06:00:49 -0000 1.6
+++ linux-x86-64-low.c 18 Jul 2002 14:46:53 -0000
@@ -28,16 +28,16 @@
#include <sys/procfs.h>
#include <sys/ptrace.h>
-#define X86_64_NUM_GREGS 22
-
-static int x86_64_regmap[X86_64_NUM_GREGS] = {
+static int x86_64_regmap[] = {
RAX * 8, RBX * 8, RCX * 8, RDX * 8,
RSI * 8, RDI * 8, RBP * 8, RSP * 8,
R8 * 8, R9 * 8, R10 * 8, R11 * 8,
R12 * 8, R13 * 8, R14 * 8, R15 * 8,
- RIP * 8, EFLAGS * 8,
+ RIP * 8, EFLAGS * 8, CS * 8, SS * 8,
DS * 8, ES * 8, FS * 8, GS * 8
};
+
+#define X86_64_NUM_GREGS (sizeof(x86_64_regmap)/sizeof(int))
static void
x86_64_fill_gregset (void *buf)