aboutsummaryrefslogtreecommitdiff
path: root/gdb/arch
diff options
context:
space:
mode:
authorThiago Jung Bauermann <thiago.bauermann@linaro.org>2024-02-26 19:11:45 -0300
committerThiago Jung Bauermann <thiago.bauermann@linaro.org>2024-02-29 12:27:27 -0300
commitbbb12eb9c84aa2b32480b7c022c494c2469ef717 (patch)
treebadfe1f699a84a833ed202a2800dbeeb3ecd4870 /gdb/arch
parent801977ce47911ecb88b7b2ffc502aafe807535b5 (diff)
downloadbinutils-bbb12eb9c84aa2b32480b7c022c494c2469ef717.zip
binutils-bbb12eb9c84aa2b32480b7c022c494c2469ef717.tar.gz
binutils-bbb12eb9c84aa2b32480b7c022c494c2469ef717.tar.bz2
gdb/arm: Remove tpidruro register from non-FreeBSD target descriptions
Commit 92d48a1e4eac ("Add an arm-tls feature which includes the tpidruro register from CP15.") introduced the org.gnu.gdb.arm.tls feature, which adds the tpidruro register, and unconditionally enabled it in aarch32_create_target_description. In Linux, the tpidruro register isn't available via ptrace in the 32-bit kernel but it is available for an aarch32 program running under an arm64 kernel via the ptrace compat interface. This isn't currently implemented however, which causes GDB on arm-linux with 64-bit kernel to list the register but show it as unavailable, as reported by Tom de Vries: $ gdb -q -batch a.out -ex start -ex 'p $tpidruro' Temporary breakpoint 1 at 0x512 Temporary breakpoint 1, 0xaaaaa512 in main () $1 = <unavailable> Simon Marchi then clarified: > The only time we should be seeing some "unavailable" registers or memory > is in the context of tracepoints, for things that are not collected. > Seeing an unavailable register here is a sign that something is not > right. Therefore, disable the TLS feature in aarch32 target descriptions for Linux and NetBSD targets (the latter also doesn't seem to support accessing tpidruro either, based on a quick look at arm-netbsd-nat.c). This patch fixes the following tests: Running gdb.base/inline-frame-cycle-unwind.exp ... FAIL: gdb.base/inline-frame-cycle-unwind.exp: cycle at level 3: backtrace when the unwind is broken at frame 3 FAIL: gdb.base/inline-frame-cycle-unwind.exp: cycle at level 5: backtrace when the unwind is broken at frame 5 FAIL: gdb.base/inline-frame-cycle-unwind.exp: cycle at level 1: backtrace when the unwind is broken at frame 1 Tested with Ubuntu 22.04.3 on armv8l-linux-gnueabihf in native, native-gdbserver and native-extended-gdbserver targets with no regressions. PR tdep/31418 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31418 Approved-By: John Baldwin <jhb@FreeBSD.org>
Diffstat (limited to 'gdb/arch')
-rw-r--r--gdb/arch/aarch32.c5
-rw-r--r--gdb/arch/aarch32.h2
2 files changed, 4 insertions, 3 deletions
diff --git a/gdb/arch/aarch32.c b/gdb/arch/aarch32.c
index c910e3b..9f3e250 100644
--- a/gdb/arch/aarch32.c
+++ b/gdb/arch/aarch32.c
@@ -25,7 +25,7 @@
/* See aarch32.h. */
target_desc *
-aarch32_create_target_description ()
+aarch32_create_target_description (bool tls)
{
target_desc_up tdesc = allocate_target_description ();
@@ -39,7 +39,8 @@ aarch32_create_target_description ()
/* Create a vfpv3 feature, then a blank NEON feature. */
regnum = create_feature_arm_arm_vfpv3 (tdesc.get (), regnum);
tdesc_create_feature (tdesc.get (), "org.gnu.gdb.arm.neon");
- regnum = create_feature_arm_arm_tls (tdesc.get (), regnum);
+ if (tls)
+ regnum = create_feature_arm_arm_tls (tdesc.get (), regnum);
return tdesc.release ();
}
diff --git a/gdb/arch/aarch32.h b/gdb/arch/aarch32.h
index f7ee6fa..1811b8a 100644
--- a/gdb/arch/aarch32.h
+++ b/gdb/arch/aarch32.h
@@ -22,6 +22,6 @@
/* Create the AArch32 target description. */
-target_desc *aarch32_create_target_description ();
+target_desc *aarch32_create_target_description (bool tls);
#endif /* aarch32.h. */