From 09ec9b38d64692a0dafd73936365f15a8d4ab383 Mon Sep 17 00:00:00 2001 From: Michal Ludvig Date: Thu, 18 Jul 2002 15:18:02 +0000 Subject: [PATCH] 2002-07-18 Michal Ludvig * 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. --- gdb/ChangeLog | 4 ++++ gdb/gdbserver/linux-low.c | 1 + gdb/gdbserver/linux-x86-64-low.c | 8 ++++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index befe4f14fb4..17aea0f0582 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2002-07-18 Michal Ludvig + * 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. * config/sparc/tm-sp64linux.h: Make the rest of #endif line a comment. * Makefile.in (x86-64-linux-nat.o): Remove dependency on i387-tdep.h diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index c272fed2142..7048daf221e 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -1097,6 +1097,7 @@ regsets_store_inferior_registers () } } regset ++; + free (buf); } return 0; } diff --git a/gdb/gdbserver/linux-x86-64-low.c b/gdb/gdbserver/linux-x86-64-low.c index b03dcfaeb6a..4ee1ae48190 100644 --- a/gdb/gdbserver/linux-x86-64-low.c +++ b/gdb/gdbserver/linux-x86-64-low.c @@ -28,17 +28,17 @@ #include #include -#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) { -- 2.30.2