diff options
author | Markus Metzger <markus.t.metzger@intel.com> | 2015-01-29 10:43:05 +0100 |
---|---|---|
committer | Markus Metzger <markus.t.metzger@intel.com> | 2015-03-03 12:47:41 +0100 |
commit | d68e53f47932eb7c374df9b90faed7aca2eed9d7 (patch) | |
tree | 47015cbfe454f85ccfb6c95577800d86767712ad /gdb/x86-linux-nat.c | |
parent | 986b66010c684a871f5606cb4f074d4e3d829e2f (diff) | |
download | binutils-gdb-d68e53f47932eb7c374df9b90faed7aca2eed9d7.tar.gz |
btrace: support 32-bit inferior on 64-bit host
The heuristic for filtering out kernel addressess in BTS trace checks the
most significant bit in each address. This works fine for 32-bit and 64-bit
mode.
For 32-bit compatibility mode, i.e. a 32-bit inferior running on 64-bit
host, we need to check bit 63 (or any bit bigger than 31), not bit 31.
Use the machine field in struct utsname provided by a uname call to
determine whether we are running on a 64-bit host.
Thanks to Jan Kratochvil for reporting the issue.
gdb/
* nat/linux-btrace.c: Include sys/utsname.h.
(linux_determine_kernel_ptr_bits): New.
(linux_enable_bts): Call linux_determine_kernel_ptr_bits.
* x86-linux-nat.c (x86_linux_enable_btrace): Do not overwrite non-zero
ptr_bits.
gdbserver/
* linux-low.c (linux_low_enable_btrace): Do not overwrite non-zero
ptr_bits.
Diffstat (limited to 'gdb/x86-linux-nat.c')
-rw-r--r-- | gdb/x86-linux-nat.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gdb/x86-linux-nat.c b/gdb/x86-linux-nat.c index c58c01a2bb7..7f038f01b56 100644 --- a/gdb/x86-linux-nat.c +++ b/gdb/x86-linux-nat.c @@ -450,9 +450,11 @@ x86_linux_enable_btrace (struct target_ops *self, ptid_t ptid, target_pid_to_str (ptid), safe_strerror (errno)); /* Fill in the size of a pointer in bits. */ - gdbarch = target_thread_architecture (ptid); - tinfo->ptr_bits = gdbarch_ptr_bit (gdbarch); - + if (tinfo->ptr_bits == 0) + { + gdbarch = target_thread_architecture (ptid); + tinfo->ptr_bits = gdbarch_ptr_bit (gdbarch); + } return tinfo; } |