aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.arch
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2024-08-16 14:22:46 +0200
committerTom de Vries <tdevries@suse.de>2024-08-16 14:22:46 +0200
commit51f38ebfc430b81a6ee93dbb37ed293b78f87778 (patch)
tree2a2de64411d833fec88c0cc5820baff25daaf9fb /gdb/testsuite/gdb.arch
parentbc737bc7fb7808d2915cc15cfba4b84b345940f1 (diff)
downloadbinutils-51f38ebfc430b81a6ee93dbb37ed293b78f87778.zip
binutils-51f38ebfc430b81a6ee93dbb37ed293b78f87778.tar.gz
binutils-51f38ebfc430b81a6ee93dbb37ed293b78f87778.tar.bz2
[gdb/testsuite] Fix gdb.arch/arm-single-step-kernel-helper.exp
On arm-linux I run into: ... (gdb) p *kernel_user_helper_version^M Cannot access memory at address 0xffff0ffc^M (gdb) FAIL: gdb.arch/arm-single-step-kernel-helper.exp: check kernel helper version ... What the test-case is trying to do, is to access a special address in the arm linux kernel [1] using ptrace, which doesn't seem to work. This is with kernel version 6.1.55. Perhaps this used to work, but the kernel was modified to be more strict with respect to access to this special address. Fix this by making the inferior access that special address instead. Tested on arm-linux. Approved-By: Luis Machado <luis.machado@arm.com> PR testsuite/32070 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32070 [1] https://www.kernel.org/doc/Documentation/arm/kernel_user_helpers.txt
Diffstat (limited to 'gdb/testsuite/gdb.arch')
-rw-r--r--gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.c5
-rw-r--r--gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.exp5
2 files changed, 8 insertions, 2 deletions
diff --git a/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.c b/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.c
index 393004e..9b5e137 100644
--- a/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.c
+++ b/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.c
@@ -15,7 +15,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-static int *kernel_user_helper_version = (int *) 0xffff0ffc;
+static int *kernel_user_helper_version_ptr = (int *) 0xffff0ffc;
+static int kernel_user_helper_version;
typedef void * (kernel_user_func_t)(void);
#define kernel_user_get_tls (*(kernel_user_func_t *) 0xffff0fe0)
@@ -25,6 +26,8 @@ main (void)
{
int i;
+ kernel_user_helper_version = *kernel_user_helper_version_ptr;
+
for (i = 0; i < 8; i++)
kernel_user_get_tls ();
}
diff --git a/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.exp b/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.exp
index 27be5d5..788bc86 100644
--- a/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.exp
+++ b/gdb/testsuite/gdb.arch/arm-single-step-kernel-helper.exp
@@ -26,10 +26,13 @@ if { ![runto_main] } {
return -1
}
+# Initialize kernel_user_helper_version.
+gdb_test "next" "for .*"
+
# Check kernel helpers are supported or not.
set kernel_helper_supported 0
-gdb_test_multiple "p *kernel_user_helper_version" \
+gdb_test_multiple "p kernel_user_helper_version" \
"check kernel helper version" {
-re " = ($decimal)\r\n$gdb_prompt $" {
if { $expect_out(1,string) >= 1 } {