forked from Imagelibrary/binutils-gdb
gdbserver: 64-bit kernel / 32-inferior, syscall restarting
$ make check RUNTESTFLAGS="--target_board=native-gdbserver/-m32 clone-thread_db.exp"
gdb.log shows:
Running target native-gdbserver/-m32
...
clone-thread_db: src/gdb/testsuite/gdb.threads/clone-thread_db.c:57: thread_fn: Assertion `res != -1' failed.
...
(gdb) FAIL: gdb.threads/clone-thread_db.exp: continue to end
That was waitpid returning -1 / EINTR. We don't see that when testing
with unix/-m32 (native debugging). Turns out to be that when
debugging a 32-bit inferior, a 64-bit GDBserver is reading/writing
$orig_eax from/to the wrong ptrace register buffer offset. When
gdbserver is 64-bit, the ptrace register buffer is in 64-bit layout,
so the register is found at "ORIG_EAX * 8", not at "ORIG_EAX * 4".
Fixes these with --target_board=native-gdbserver/-m32 on x86_64 Fedora 20:
-FAIL: gdb.threads/clone-thread_db.exp: continue to end
+PASS: gdb.threads/clone-thread_db.exp: continue to end
-FAIL: gdb.threads/hand-call-in-threads.exp: all dummies popped
+PASS: gdb.threads/hand-call-in-threads.exp: all dummies popped
PASS: gdb.threads/hand-call-in-threads.exp: breakpoint on all_threads_running
PASS: gdb.threads/hand-call-in-threads.exp: breakpoint on hand_call
PASS: gdb.threads/hand-call-in-threads.exp: disable scheduler locking
@@ -29339,15 +29331,15 @@ PASS: gdb.threads/hand-call-in-threads.e
PASS: gdb.threads/hand-call-in-threads.exp: discard hand call, thread 4
PASS: gdb.threads/hand-call-in-threads.exp: discard hand call, thread 5
PASS: gdb.threads/hand-call-in-threads.exp: dummy stack frame number, thread 1
-FAIL: gdb.threads/hand-call-in-threads.exp: dummy stack frame number, thread 2
-FAIL: gdb.threads/hand-call-in-threads.exp: dummy stack frame number, thread 3
-FAIL: gdb.threads/hand-call-in-threads.exp: dummy stack frame number, thread 4
+PASS: gdb.threads/hand-call-in-threads.exp: dummy stack frame number, thread 2
+PASS: gdb.threads/hand-call-in-threads.exp: dummy stack frame number, thread 3
+PASS: gdb.threads/hand-call-in-threads.exp: dummy stack frame number, thread 4
PASS: gdb.threads/hand-call-in-threads.exp: dummy stack frame number, thread 5
PASS: gdb.threads/hand-call-in-threads.exp: enable scheduler locking
PASS: gdb.threads/hand-call-in-threads.exp: hand call, thread 1
-FAIL: gdb.threads/hand-call-in-threads.exp: hand call, thread 2
-FAIL: gdb.threads/hand-call-in-threads.exp: hand call, thread 3
-FAIL: gdb.threads/hand-call-in-threads.exp: hand call, thread 4
+PASS: gdb.threads/hand-call-in-threads.exp: hand call, thread 2
+PASS: gdb.threads/hand-call-in-threads.exp: hand call, thread 3
+PASS: gdb.threads/hand-call-in-threads.exp: hand call, thread 4
PASS: gdb.threads/hand-call-in-threads.exp: hand call, thread 5
PASS: gdb.threads/hand-call-in-threads.exp: prepare to discard hand call, thread 1
PASS: gdb.threads/hand-call-in-threads.exp: prepare to discard hand call, thread 2
gdb/gdbserver/ChangeLog
2015-02-23 Pedro Alves <palves@redhat.com>
* linux-x86-low.c (REGSIZE): Define in both 32-bit and 64-bit
modes.
(x86_fill_gregset, x86_store_gregset): Use it when handling
$orig_eax.
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
2015-02-23 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
|
* linux-x86-low.c (REGSIZE): Define in both 32-bit and 64-bit
|
||||||
|
modes.
|
||||||
|
(x86_fill_gregset, x86_store_gregset): Use it when handling
|
||||||
|
$orig_eax.
|
||||||
|
|
||||||
2015-02-20 Pedro Alves <palves@redhat.com>
|
2015-02-20 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
* thread-db.c: Include "nat/linux-procfs.h".
|
* thread-db.c: Include "nat/linux-procfs.h".
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ static /*const*/ int i386_regmap[] =
|
|||||||
|
|
||||||
/* So code below doesn't have to care, i386 or amd64. */
|
/* So code below doesn't have to care, i386 or amd64. */
|
||||||
#define ORIG_EAX ORIG_RAX
|
#define ORIG_EAX ORIG_RAX
|
||||||
|
#define REGSIZE 8
|
||||||
|
|
||||||
static const int x86_64_regmap[] =
|
static const int x86_64_regmap[] =
|
||||||
{
|
{
|
||||||
@@ -221,6 +222,8 @@ static /*const*/ int i386_regmap[] =
|
|||||||
|
|
||||||
#define I386_NUM_REGS (sizeof (i386_regmap) / sizeof (i386_regmap[0]))
|
#define I386_NUM_REGS (sizeof (i386_regmap) / sizeof (i386_regmap[0]))
|
||||||
|
|
||||||
|
#define REGSIZE 4
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
@@ -374,7 +377,7 @@ x86_fill_gregset (struct regcache *regcache, void *buf)
|
|||||||
collect_register (regcache, i, ((char *) buf) + i386_regmap[i]);
|
collect_register (regcache, i, ((char *) buf) + i386_regmap[i]);
|
||||||
|
|
||||||
collect_register_by_name (regcache, "orig_eax",
|
collect_register_by_name (regcache, "orig_eax",
|
||||||
((char *) buf) + ORIG_EAX * 4);
|
((char *) buf) + ORIG_EAX * REGSIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -396,7 +399,7 @@ x86_store_gregset (struct regcache *regcache, const void *buf)
|
|||||||
supply_register (regcache, i, ((char *) buf) + i386_regmap[i]);
|
supply_register (regcache, i, ((char *) buf) + i386_regmap[i]);
|
||||||
|
|
||||||
supply_register_by_name (regcache, "orig_eax",
|
supply_register_by_name (regcache, "orig_eax",
|
||||||
((char *) buf) + ORIG_EAX * 4);
|
((char *) buf) + ORIG_EAX * REGSIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user