diff options
-rw-r--r-- | gdb/gdbserver/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/gdbserver/linux-x86-low.c | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 4537792..e509c2c 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,9 @@ +2014-05-19 Jan Kratochvil <jan.kratochvil@redhat.com> + + Fix gdbserver qGetTLSAddr for x86_64 -m32. + * linux-x86-low.c (X86_64_USER_REGS): New. + (x86_fill_gregset): Call memset for BUF first in x86_64 -m32 case. + 2014-04-28 Yao Qi <yao@codesourcery.com> * Makefile.in (i386-avx512.c): Fix the typo of generated file diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c index 1bd7b4a..10cd0d5 100644 --- a/gdb/gdbserver/linux-x86-low.c +++ b/gdb/gdbserver/linux-x86-low.c @@ -206,6 +206,7 @@ static const int x86_64_regmap[] = }; #define X86_64_NUM_REGS (sizeof (x86_64_regmap) / sizeof (x86_64_regmap[0])) +#define X86_64_USER_REGS (GS + 1) #else /* ! __x86_64__ */ @@ -364,6 +365,10 @@ x86_fill_gregset (struct regcache *regcache, void *buf) collect_register (regcache, i, ((char *) buf) + x86_64_regmap[i]); return; } + + /* 32-bit inferior registers need to be zero-extended. + Callers would read uninitialized memory otherwise. */ + memset (buf, 0x00, X86_64_USER_REGS * 8); #endif for (i = 0; i < I386_NUM_REGS; i++) |