From 760256f9676dfeba19c6952df1ead3f067a992ff Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 12 Jun 2013 16:05:39 +0000 Subject: [PATCH] [GDBserver] Fix gdb.threads/siginfo-threads.exp, gdb.base/siginfo-obj.exp regressions. This fixes the regressions reported at : $ runtest-gdbserver gdb.base/siginfo-obj.exp gdb.base/siginfo-thread.exp gdb.threads/siginfo-threads.exp Running ./gdb.base/siginfo-thread.exp ... FAIL: gdb.base/siginfo-thread.exp: p ssi_addr Running ./gdb.threads/siginfo-threads.exp ... FAIL: gdb.threads/siginfo-threads.exp: signal 0 si_pid FAIL: gdb.threads/siginfo-threads.exp: signal 1 si_pid FAIL: gdb.threads/siginfo-threads.exp: signal 2 si_pid FAIL: gdb.threads/siginfo-threads.exp: signal 3 si_pid Running ./gdb.base/siginfo-obj.exp ... FAIL: gdb.base/siginfo-obj.exp: p ssi_addr FAIL: gdb.base/siginfo-obj.exp: p ssi_addr The multi-arch patch made GDBserver do the the wrong siginfo layout conversion, because most uses of `linux_is_elf64' were removed, and it ended up never set. A global really is the wrong thing to use as elf64-ness is a per-process property; `linux_is_elf64' was just accidentally left behind. Tested on x86_64 Fedora 17. gdb/gdbserver/ 2013-06-12 Pedro Alves * linux-x86-low.c (linux_is_elf64): Delete global. (x86_siginfo_fixup): Replace reference to `linux_is_elf64' global with local linux_pid_exe_is_elf_64_file use. --- gdb/gdbserver/ChangeLog | 6 ++++++ gdb/gdbserver/linux-x86-low.c | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index f3e47a89755..b15614a3967 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,9 @@ +2013-06-12 Pedro Alves + + * linux-x86-low.c (linux_is_elf64): Delete global. + (x86_siginfo_fixup): Replace reference to `linux_is_elf64' global + with local linux_pid_exe_is_elf_64_file use. + 2013-06-11 Pedro Alves * linux-low.c (regset_disabled, disable_regset): New functions. diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c index eeedb7c80cb..3a4f0075e63 100644 --- a/gdb/gdbserver/linux-x86-low.c +++ b/gdb/gdbserver/linux-x86-low.c @@ -1138,8 +1138,6 @@ siginfo_from_compat_x32_siginfo (siginfo_t *to, } } -/* Is this process 64-bit? */ -static int linux_is_elf64; #endif /* __x86_64__ */ /* Convert a native/host siginfo object, into/from the siginfo in the @@ -1152,6 +1150,10 @@ static int x86_siginfo_fixup (siginfo_t *native, void *inf, int direction) { #ifdef __x86_64__ + unsigned int machine; + int tid = lwpid_of (get_thread_lwp (current_inferior)); + int is_elf64 = linux_pid_exe_is_elf_64_file (tid, &machine); + /* Is the inferior 32-bit? If so, then fixup the siginfo object. */ if (!is_64bit_tdesc ()) { @@ -1166,7 +1168,7 @@ x86_siginfo_fixup (siginfo_t *native, void *inf, int direction) return 1; } /* No fixup for native x32 GDB. */ - else if (!linux_is_elf64 && sizeof (void *) == 8) + else if (!is_elf64 && sizeof (void *) == 8) { if (sizeof (siginfo_t) != sizeof (compat_x32_siginfo_t)) fatal ("unexpected difference in siginfo"); -- 2.30.2