* [RFA] gdbserver bits
@ 2002-07-18 8:08 Michal Ludvig
2002-07-18 8:33 ` Daniel Jacobowitz
0 siblings, 1 reply; 4+ messages in thread
From: Michal Ludvig @ 2002-07-18 8:08 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: GDB Patches
[-- Attachment #1: Type: text/plain, Size: 344 bytes --]
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
[-- Attachment #2: gdbserver-cs-2.diff --]
[-- Type: text/plain, Size: 1559 bytes --]
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)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] gdbserver bits
2002-07-18 8:08 [RFA] gdbserver bits Michal Ludvig
@ 2002-07-18 8:33 ` Daniel Jacobowitz
2002-07-18 8:35 ` Michal Ludvig
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2002-07-18 8:33 UTC (permalink / raw)
To: Michal Ludvig; +Cc: GDB Patches
On Thu, Jul 18, 2002 at 04:59:51PM +0200, Michal Ludvig wrote:
> 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?
Go ahead. Doesn't GDB have the same problem with CS and SS?
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] gdbserver bits
2002-07-18 8:33 ` Daniel Jacobowitz
@ 2002-07-18 8:35 ` Michal Ludvig
2002-07-18 9:24 ` Daniel Jacobowitz
0 siblings, 1 reply; 4+ messages in thread
From: Michal Ludvig @ 2002-07-18 8:35 UTC (permalink / raw)
To: Daniel Jacobowitz; +Cc: GDB Patches
Daniel Jacobowitz wrote:
> Go ahead. Doesn't GDB have the same problem with CS and SS?
Well, yes actually. But in GDB it doesn't make problems, because there
the regbuf is zeroed after allocation so it cannot happen, that you'd
write something wrong to CS or SS (at least on x86-64 the kernel doesn't
permit setting CS since it uses it for it's own purposes).
Consider cleaning the newly allocated regbuf in gdbserver as well...
Michal Ludvig
--
* SuSE CR, s.r.o * mludvig@suse.cz
* +420 2 9654 5373 * http://www.suse.cz
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFA] gdbserver bits
2002-07-18 8:35 ` Michal Ludvig
@ 2002-07-18 9:24 ` Daniel Jacobowitz
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2002-07-18 9:24 UTC (permalink / raw)
To: Michal Ludvig; +Cc: GDB Patches
On Thu, Jul 18, 2002 at 05:33:24PM +0200, Michal Ludvig wrote:
> Daniel Jacobowitz wrote:
> >Go ahead. Doesn't GDB have the same problem with CS and SS?
>
> Well, yes actually. But in GDB it doesn't make problems, because there
> the regbuf is zeroed after allocation so it cannot happen, that you'd
> write something wrong to CS or SS (at least on x86-64 the kernel doesn't
> permit setting CS since it uses it for it's own purposes).
> Consider cleaning the newly allocated regbuf in gdbserver as well...
I don't think I will; writing arbitrary zeros is just as damaging as
writing a bad regset. The whole thing needs to be set.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-07-18 15:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-18 8:08 [RFA] gdbserver bits Michal Ludvig
2002-07-18 8:33 ` Daniel Jacobowitz
2002-07-18 8:35 ` Michal Ludvig
2002-07-18 9:24 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox