[gdb/testsuite] Fix regexp in gdb.arch/i386-disp-step-self-call.exp
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Test passed
|
Commit Message
Usually, with test-case gdb.arch/i386-disp-step-self-call.exp I get:
...
(gdb) x/1wx 0xffffc4f8^M
0xffffc4f8: 0x08048472^M
(gdb) PASS: $exp: check return address was updated correctly
...
but sometimes I run into:
...
(gdb) x/1wx 0xffffc5c8^M
0xffffc5c8: 0x0804917e^M
(gdb) FAIL: $exp: check return address was updated correctly
...
The problem is that here:
...
set next_insn_addr 0x[format %08X $next_insn_addr]
gdb_test "x/1wx 0x[format %x $sp]" "$hex:\\s+$next_insn_addr" \
"check return address was updated correctly"
...
we're trying to match string 0x0804917e against regexp 0x0804917E due to using
"%08X" as format string.
We only run into this problem if the address contains letters, which apparantly
usually isn't the case.
Fix this by using "%08x" instead as format string.
Likewise in test-case gdb.arch/amd64-disp-step-self-call.exp.
Tested on x86_64-linux.
PR testsuite/32121
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32121
---
gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp | 2 +-
gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
base-commit: 934fcc7c916ad2876515a099ee09fa40dc08b489
Comments
> -----Original Message-----
> From: Tom de Vries <tdevries@suse.de>
> Sent: Mittwoch, 28. August 2024 11:15
> To: gdb-patches@sourceware.org
> Subject: [PATCH] [gdb/testsuite] Fix regexp in gdb.arch/i386-disp-step-self-
> call.exp
>
> Usually, with test-case gdb.arch/i386-disp-step-self-call.exp I get:
> ...
> (gdb) x/1wx 0xffffc4f8^M
> 0xffffc4f8: 0x08048472^M
> (gdb) PASS: $exp: check return address was updated correctly
> ...
> but sometimes I run into:
> ...
> (gdb) x/1wx 0xffffc5c8^M
> 0xffffc5c8: 0x0804917e^M
> (gdb) FAIL: $exp: check return address was updated correctly
> ...
>
> The problem is that here:
> ...
> set next_insn_addr 0x[format %08X $next_insn_addr]
> gdb_test "x/1wx 0x[format %x $sp]" "$hex:\\s+$next_insn_addr" \
> "check return address was updated correctly"
> ...
> we're trying to match string 0x0804917e against regexp 0x0804917E due to using
> "%08X" as format string.
>
> We only run into this problem if the address contains letters, which apparantly
> usually isn't the case.
>
> Fix this by using "%08x" instead as format string.
>
> Likewise in test-case gdb.arch/amd64-disp-step-self-call.exp.
>
> Tested on x86_64-linux.
>
> PR testsuite/32121
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32121
> ---
> gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp | 2 +-
> gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp
> b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp
> index 762d19a2960..2db3ff228c9 100644
> --- a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp
> +++ b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp
> @@ -77,6 +77,6 @@ gdb_assert {[expr $sp == $new_sp]} \
> "check stack pointer was updated as expected"
>
> # Check the contents of the stack were updated to the expected value.
> -set next_insn_addr 0x[format %016X $next_insn_addr]
> +set next_insn_addr 0x[format %016x $next_insn_addr]
> gdb_test "x/1gx 0x[format %x $sp]" "$hex:\\s+$next_insn_addr" \
> "check return address was updated correctly"
> diff --git a/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp
> b/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp
> index b2cb902f8ed..5de7ebcd69f 100644
> --- a/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp
> +++ b/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp
> @@ -77,6 +77,6 @@ gdb_assert {[expr $sp == $new_sp]} \
> "check stack pointer was updated as expected"
>
> # Check the contents of the stack were updated to the expected value.
> -set next_insn_addr 0x[format %08X $next_insn_addr]
> +set next_insn_addr 0x[format %08x $next_insn_addr]
> gdb_test "x/1wx 0x[format %x $sp]" "$hex:\\s+$next_insn_addr" \
> "check return address was updated correctly"
>
> base-commit: 934fcc7c916ad2876515a099ee09fa40dc08b489
> --
> 2.35.3
Hi Tom,
This looks fine to me.
Thanks,
Felix
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Sean Fennelly, Jeffrey Schneiderman, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
On 8/28/24 11:20, Willgerodt, Felix wrote:
>> -----Original Message-----
>> From: Tom de Vries <tdevries@suse.de>
>> Sent: Mittwoch, 28. August 2024 11:15
>> To: gdb-patches@sourceware.org
>> Subject: [PATCH] [gdb/testsuite] Fix regexp in gdb.arch/i386-disp-step-self-
>> call.exp
>>
>> Usually, with test-case gdb.arch/i386-disp-step-self-call.exp I get:
>> ...
>> (gdb) x/1wx 0xffffc4f8^M
>> 0xffffc4f8: 0x08048472^M
>> (gdb) PASS: $exp: check return address was updated correctly
>> ...
>> but sometimes I run into:
>> ...
>> (gdb) x/1wx 0xffffc5c8^M
>> 0xffffc5c8: 0x0804917e^M
>> (gdb) FAIL: $exp: check return address was updated correctly
>> ...
>>
>> The problem is that here:
>> ...
>> set next_insn_addr 0x[format %08X $next_insn_addr]
>> gdb_test "x/1wx 0x[format %x $sp]" "$hex:\\s+$next_insn_addr" \
>> "check return address was updated correctly"
>> ...
>> we're trying to match string 0x0804917e against regexp 0x0804917E due to using
>> "%08X" as format string.
>>
>> We only run into this problem if the address contains letters, which apparantly
>> usually isn't the case.
>>
>> Fix this by using "%08x" instead as format string.
>>
>> Likewise in test-case gdb.arch/amd64-disp-step-self-call.exp.
>>
>> Tested on x86_64-linux.
>>
>> PR testsuite/32121
>> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32121
>> ---
>> gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp | 2 +-
>> gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp | 2 +-
>> 2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp
>> b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp
>> index 762d19a2960..2db3ff228c9 100644
>> --- a/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp
>> +++ b/gdb/testsuite/gdb.arch/amd64-disp-step-self-call.exp
>> @@ -77,6 +77,6 @@ gdb_assert {[expr $sp == $new_sp]} \
>> "check stack pointer was updated as expected"
>>
>> # Check the contents of the stack were updated to the expected value.
>> -set next_insn_addr 0x[format %016X $next_insn_addr]
>> +set next_insn_addr 0x[format %016x $next_insn_addr]
>> gdb_test "x/1gx 0x[format %x $sp]" "$hex:\\s+$next_insn_addr" \
>> "check return address was updated correctly"
>> diff --git a/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp
>> b/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp
>> index b2cb902f8ed..5de7ebcd69f 100644
>> --- a/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp
>> +++ b/gdb/testsuite/gdb.arch/i386-disp-step-self-call.exp
>> @@ -77,6 +77,6 @@ gdb_assert {[expr $sp == $new_sp]} \
>> "check stack pointer was updated as expected"
>>
>> # Check the contents of the stack were updated to the expected value.
>> -set next_insn_addr 0x[format %08X $next_insn_addr]
>> +set next_insn_addr 0x[format %08x $next_insn_addr]
>> gdb_test "x/1wx 0x[format %x $sp]" "$hex:\\s+$next_insn_addr" \
>> "check return address was updated correctly"
>>
>> base-commit: 934fcc7c916ad2876515a099ee09fa40dc08b489
>> --
>> 2.35.3
>
> Hi Tom,
>
> This looks fine to me.
>
Hi Felix,
thanks for the review.
Please consider adding a tag to your review(s), to get the proper credit
for your efforts (
https://sourceware.org/gdb/wiki/ContributionChecklist#Receiving_positive_reviews
).
Thanks,
- Tom
@@ -77,6 +77,6 @@ gdb_assert {[expr $sp == $new_sp]} \
"check stack pointer was updated as expected"
# Check the contents of the stack were updated to the expected value.
-set next_insn_addr 0x[format %016X $next_insn_addr]
+set next_insn_addr 0x[format %016x $next_insn_addr]
gdb_test "x/1gx 0x[format %x $sp]" "$hex:\\s+$next_insn_addr" \
"check return address was updated correctly"
@@ -77,6 +77,6 @@ gdb_assert {[expr $sp == $new_sp]} \
"check stack pointer was updated as expected"
# Check the contents of the stack were updated to the expected value.
-set next_insn_addr 0x[format %08X $next_insn_addr]
+set next_insn_addr 0x[format %08x $next_insn_addr]
gdb_test "x/1wx 0x[format %x $sp]" "$hex:\\s+$next_insn_addr" \
"check return address was updated correctly"