[PATCH 5/5] hppa: Fix pc.test testcase on hppa architecture

Helge Deller deller at gmx.de
Sun Jan 29 21:08:53 UTC 2023


On hppa the lowest 2 bits of an address encodes the (parisc-specific)
address space in which a program runs. For userspace processes the space
number is 3, which is why an instruction at e.g. 0x100 shows up in the
address registers as 0x103.
This behaviour is different than on other architectures, which is
why the pc.test testcase fails on hppa.

Fix the testcase by simply dropping the last nibble of the address
when comparing the output, e.g. search for "0x10?" instead of "0x100".

Signed-off-by: Helge Deller <deller at gmx.de>
---
 tests/pc.test | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/pc.test b/tests/pc.test
index 5ac432131..7da0d6b0c 100755
--- a/tests/pc.test
+++ b/tests/pc.test
@@ -24,14 +24,15 @@ pid="$(sed -r -n 's/^\[[[:xdigit:]]{'"$len"'}\] --- SIGCHLD \{si_signo=SIGCHLD,
 [ -n "$pid" ] &&
 ip="$(sed -r -n 's/^\[pid +'"$pid"'\] \[([[:xdigit:]]{'"$len"'})] --- SIGSEGV \{.*\} ---$/\1/p' "$LOG")" &&
 [ -n "$ip" ] &&
-addr="$(echo "$ip" |sed -r 's/^0+//')" &&
+# strip the last nibble of the address. On hppa the lowest 2 bits encode the address space.
+addr="$(echo "$ip" |sed -r 's/^0+//')" && addr=${addr%?} &&
 [ -n "$addr" ] ||
 	dump_log_and_fail_with

 cat > "$EXP" << __EOF__
 \\[[[:xdigit:]]{$len}\\] munmap\\(0x[[:xdigit:]]+, 0\\) += -1 .*
-\\[pid +$pid\\] \\[$ip\\] --- SIGSEGV \\{si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x$addr\\} ---
 \\[pid +$pid\\] \\[\\?{$len}\\] \\+\\+\\+ killed by SIGSEGV( \\(core dumped\\))? \\+\\+\\+
+\\[pid +$pid\\] \\[$ip\\] --- SIGSEGV \\{si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x$addr[[:xdigit:]]\\} ---
 \\[\\?{$len}\\] \\+\\+\\+ exited with 0 \\+\\+\\+
 __EOF__

--
2.38.1



More information about the Strace-devel mailing list