From: Luis Machado <luis.machado@arm.com>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [pushed] [gdb/testsuite] Use maint ignore-probes in gdb.base/longjmp.exp
Date: Wed, 8 Feb 2023 13:27:37 +0000 [thread overview]
Message-ID: <ac22420a-1549-bc0e-94f5-9f3e3f4af107@arm.com> (raw)
In-Reply-To: <20230208124652.29570-1-tdevries@suse.de>
Hi Tom,
Is the entire test supposed to PASS? I'm seeing the following on my aarch64/Ubuntu 22.04 setup:
FAIL: gdb.base/longjmp.exp: with_probes=0: pattern 2: next over call_longjmp (the program is no longer running)
FAIL: gdb.base/longjmp.exp: with_probes=0: pattern 2: next over setjmp (the program is no longer running)
FAIL: gdb.base/longjmp.exp: with_probes=0: pattern 2: setup: breakpoint at pattern start (got interactive prompt)
FAIL: gdb.base/longjmp.exp: with_probes=0: pattern 2: setup: breakpoint at safety net (got interactive prompt)
FAIL: gdb.base/longjmp.exp: with_probes=0: pattern 2: setup: continue to breakpoint at pattern start (the program exited)
FAIL: gdb.base/longjmp.exp: with_probes=0: pattern 3: next over pattern (the program is no longer running)
FAIL: gdb.base/longjmp.exp: with_probes=0: pattern 3: setup: breakpoint at pattern start (got interactive prompt)
FAIL: gdb.base/longjmp.exp: with_probes=0: pattern 3: setup: continue to breakpoint at pattern start (the program is no longer running)
Maybe something is genuinely broken for aarch64 though, or I'm missing some packages/debuginfo.
This part in particular seems a bit off:
(gdb) break 63
No line 63 in the current file.
Make breakpoint pending on future shared library load? (y or [n]) n
(gdb) FAIL: gdb.base/longjmp.exp: with_probes=0: pattern 2: setup: breakpoint at pattern start (got interactive prompt)
On 2/8/23 12:46, Tom de Vries via Gdb-patches wrote:
> Test-case gdb.base/longjmp.exp handles both the case that there is a libc
> longjmp probe, and the case that there isn't.
>
> However, it only tests one of the two cases.
>
> Use maint ignore-probes to test both cases, if possible.
>
> Tested on x86_64-linux.
> ---
> gdb/testsuite/gdb.base/longjmp.exp | 295 +++++++++++++++--------------
> 1 file changed, 157 insertions(+), 138 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.base/longjmp.exp b/gdb/testsuite/gdb.base/longjmp.exp
> index 27a60bc4502..96d9c1c8059 100644
> --- a/gdb/testsuite/gdb.base/longjmp.exp
> +++ b/gdb/testsuite/gdb.base/longjmp.exp
> @@ -25,181 +25,200 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
> return -1
> }
>
> -clean_restart ${binfile}
> +proc do_test { with_probes } {
> + clean_restart ${::binfile}
>
> -if {![runto_main]} {
> - return 0
> -}
> + if { !$with_probes } {
> + gdb_test "maint ignore-probes libc ^longjmp$"
> + }
>
> -# With a libc with probes, all tests should pass.
> -#
> -# Without probes, we can still set a break on longjmp, but getting the longjmp
> -# target may not work, in the following cases:
> -# - gdbarch_get_longjmp_target_p (gdbarch) == 0: not implemented.
> -# - gdbarch_get_longjmp_target (gdbarch) == 0: for instance on amd64 if
> -# tdep->jb_pc_offset == -1.
> -# - gdbarch_get_longjmp_target (gdbarch) != 0: if we have a glibc with
> -# pointer mangling ( https://sourceware.org/glibc/wiki/PointerEncryption )
> -# then we retrieve a mangled longjmp target that needs to be demangled.
> -# For instance on amd64 with target board unix/-m32.
> -#
> -# Pointer demangling is currently not implemented for any target.
> -# For the amd64 case, this would require copying for instance this:
> -# 48 c1 ca 11 ror $0x11,%rdx
> -# 64 48 33 14 25 30 00 xor %fs:0x30,%rdx
> -# into a scratch space, save the register set, set %rdx to the mangled
> -# longjmp target, displaced-step through the two insn and read the
> -# demangled longjmp target from %rdx, and restore the register set.
> -#
> -# The failure mode in the first two cases is that the next degrades into a
> -# continue. The failure mode in the latter case is a failure to set a
> -# breakpoint (matched by re_cannot_insert_bp) and a stop in longjmp.
> -#
> -# We detect the different failure modes and kfail these.
> + if {![runto_main]} {
> + return 0
> + }
>
> -set have_longjmp_probe 0
> -gdb_test_multiple "info probes stap libc ^longjmp$" "" {
> - -re -wrap "No probes matched\\." {
> - pass $gdb_test_name
> + # With a libc with probes, all tests should pass.
> + #
> + # Without probes, we can still set a break on longjmp, but getting the longjmp
> + # target may not work, in the following cases:
> + # - gdbarch_get_longjmp_target_p (gdbarch) == 0: not implemented.
> + # - gdbarch_get_longjmp_target (gdbarch) == 0: for instance on amd64 if
> + # tdep->jb_pc_offset == -1.
> + # - gdbarch_get_longjmp_target (gdbarch) != 0: if we have a glibc with
> + # pointer mangling ( https://sourceware.org/glibc/wiki/PointerEncryption )
> + # then we retrieve a mangled longjmp target that needs to be demangled.
> + # For instance on amd64 with target board unix/-m32.
> + #
> + # Pointer demangling is currently not implemented for any target.
> + # For the amd64 case, this would require copying for instance this:
> + # 48 c1 ca 11 ror $0x11,%rdx
> + # 64 48 33 14 25 30 00 xor %fs:0x30,%rdx
> + # into a scratch space, save the register set, set %rdx to the mangled
> + # longjmp target, displaced-step through the two insn and read the
> + # demangled longjmp target from %rdx, and restore the register set.
> + #
> + # The failure mode in the first two cases is that the next degrades into a
> + # continue. The failure mode in the latter case is a failure to set a
> + # breakpoint (matched by re_cannot_insert_bp) and a stop in longjmp.
> + #
> + # We detect the different failure modes and kfail these.
> +
> + set have_longjmp_probe 0
> + gdb_test_multiple "info probes stap libc ^longjmp$" "" {
> + -re -wrap "No probes matched\\." {
> + pass $gdb_test_name
> + }
> + -re -wrap "\r\nstap\[ \t\]+libc\[ \t\]+longjmp\[ \t\]+.*" {
> + pass $gdb_test_name
> + set have_longjmp_probe 1
> + }
> }
> - -re -wrap "\r\nstap\[ \t\]+libc\[ \t\]+longjmp\[ \t\]+.*" {
> - pass $gdb_test_name
> - set have_longjmp_probe 1
> +
> + if { $with_probes } {
> + if { !$have_longjmp_probe } {
> + unsupported "longjmp probe required"
> + return
> + }
> + } else {
> + gdb_assert { !$have_longjmp_probe }
> }
> -}
>
> -set bp_miss_step_1 [gdb_get_line_number "miss_step_1"]
> -set bp_miss_step_2 [gdb_get_line_number "miss_step_2"]
> + set bp_miss_step_1 [gdb_get_line_number "miss_step_1"]
> + set bp_miss_step_2 [gdb_get_line_number "miss_step_2"]
>
> -set bp_start_test_1 [gdb_get_line_number "patt1"]
> -set bp_start_test_2 [gdb_get_line_number "patt2"]
> -set bp_start_test_3 [gdb_get_line_number "patt3"]
> + set bp_start_test_1 [gdb_get_line_number "patt1"]
> + set bp_start_test_2 [gdb_get_line_number "patt2"]
> + set bp_start_test_3 [gdb_get_line_number "patt3"]
>
> -set re_cannot_insert_bp \
> - [multi_line \
> - "Warning:" \
> - "Cannot insert breakpoint $decimal\\." \
> - "Cannot access memory at address $hex"]
> + set re_cannot_insert_bp \
> + [multi_line \
> + "Warning:" \
> + "Cannot insert breakpoint $::decimal\\." \
> + "Cannot access memory at address $::hex"]
>
> -#
> -# Pattern 1 - simple longjmp.
> -#
> + #
> + # Pattern 1 - simple longjmp.
> + #
>
> -with_test_prefix "pattern 1" {
> + with_test_prefix "pattern 1" {
>
> - with_test_prefix setup {
> - delete_breakpoints
> + with_test_prefix setup {
> + delete_breakpoints
>
> - gdb_test "break $bp_start_test_1" \
> - "Breakpoint.*at.* file .*$srcfile, line.*$bp_start_test_1.*" \
> - "breakpoint at pattern start"
> - gdb_test "continue" "patt1.*" "continue to breakpoint at pattern start"
> + gdb_test "break $bp_start_test_1" \
> + "Breakpoint.*at.* file .*$::srcfile, line.*$bp_start_test_1.*" \
> + "breakpoint at pattern start"
> + gdb_test "continue" "patt1.*" "continue to breakpoint at pattern start"
>
> - # set safe-net break
> - gdb_test "break $bp_miss_step_1" \
> - "Breakpoint.*at.* file .*$srcfile, line.*$bp_miss_step_1.*" \
> - "breakpoint at safety net"
> - }
> + # set safe-net break
> + gdb_test "break $bp_miss_step_1" \
> + "Breakpoint.*at.* file .*$::srcfile, line.*$bp_miss_step_1.*" \
> + "breakpoint at safety net"
> + }
>
> - gdb_test "next" "longjmps\\+\\+;.*" "next over setjmp"
> - gdb_test "next" "longjmp \\(env, 1\\);.*" "next to longjmp"
> + gdb_test "next" "longjmps\\+\\+;.*" "next over setjmp"
> + gdb_test "next" "longjmp \\(env, 1\\);.*" "next to longjmp"
>
> - set msg "next over longjmp"
> - gdb_test_multiple "next" $msg {
> - -re ".*patt1.*$gdb_prompt $" {
> - pass $msg
> - gdb_test "next" "resumes\\+\\+.*" "next into else block"
> - gdb_test "next" "miss_step_1.*" "next into safety net"
> - }
> - -re "miss_step_1.*$gdb_prompt $" {
> - if { $have_longjmp_probe } {
> - fail $gdb_test_name
> - } else {
> - kfail $gdb_test_name "gdb/26967"
> + set msg "next over longjmp"
> + gdb_test_multiple "next" $msg {
> + -re ".*patt1.*$::gdb_prompt $" {
> + pass $msg
> + gdb_test "next" "resumes\\+\\+.*" "next into else block"
> + gdb_test "next" "miss_step_1.*" "next into safety net"
> }
> - }
> - -re -wrap "\r\n$re_cannot_insert_bp\r\n.*" {
> - if { $have_longjmp_probe } {
> - fail $gdb_test_name
> - } else {
> - kfail $gdb_test_name "gdb/26967"
> + -re "miss_step_1.*$::gdb_prompt $" {
> + if { $have_longjmp_probe } {
> + fail $gdb_test_name
> + } else {
> + kfail $gdb_test_name "gdb/26967"
> + }
> + }
> + -re -wrap "\r\n$re_cannot_insert_bp\r\n.*" {
> + if { $have_longjmp_probe } {
> + fail $gdb_test_name
> + } else {
> + kfail $gdb_test_name "gdb/26967"
> + }
> }
> }
> }
> -}
>
> -#
> -# Pattern 2 - longjmp from an inner function.
> -#
> + #
> + # Pattern 2 - longjmp from an inner function.
> + #
>
> -with_test_prefix "pattern 2" {
> + with_test_prefix "pattern 2" {
>
> - with_test_prefix setup {
> - delete_breakpoints
> + with_test_prefix setup {
> + delete_breakpoints
>
> - gdb_test "break $bp_start_test_2" \
> - "Breakpoint.*at.* file .*$srcfile, line.*$bp_start_test_2.*" \
> - "breakpoint at pattern start"
> - gdb_test "continue" "patt2.*" "continue to breakpoint at pattern start"
> + gdb_test "break $bp_start_test_2" \
> + "Breakpoint.*at.* file .*$::srcfile, line.*$bp_start_test_2.*" \
> + "breakpoint at pattern start"
> + gdb_test "continue" "patt2.*" "continue to breakpoint at pattern start"
>
> - # set safe-net break
> - gdb_test "break $bp_miss_step_2" \
> - "Breakpoint.*at.* file .*$srcfile, line.*$bp_miss_step_2.*" \
> - "breakpoint at safety net"
> - }
> + # set safe-net break
> + gdb_test "break $bp_miss_step_2" \
> + "Breakpoint.*at.* file .*$::srcfile, line.*$bp_miss_step_2.*" \
> + "breakpoint at safety net"
> + }
>
> - gdb_test "next" "call_longjmp.*" "next over setjmp"
> + gdb_test "next" "call_longjmp.*" "next over setjmp"
>
> - set msg "next over call_longjmp"
> - gdb_test_multiple "next" $msg {
> - -re ".*patt2.*$gdb_prompt $" {
> - pass $msg
> + set msg "next over call_longjmp"
> + gdb_test_multiple "next" $msg {
> + -re ".*patt2.*$::gdb_prompt $" {
> + pass $msg
>
> - gdb_test "next" "resumes\\+\\+.*" "next into else block"
> - gdb_test "next" "miss_step_2.*" "next into safety net"
> - }
> - -re "miss_step_2.*$gdb_prompt $" {
> - if { $have_longjmp_probe } {
> - fail $gdb_test_name
> - } else {
> - kfail $gdb_test_name "gdb/26967"
> + gdb_test "next" "resumes\\+\\+.*" "next into else block"
> + gdb_test "next" "miss_step_2.*" "next into safety net"
> }
> - }
> - -re -wrap "\r\n$re_cannot_insert_bp\r\n.*" {
> - if { $have_longjmp_probe } {
> - fail $gdb_test_name
> - } else {
> - kfail $gdb_test_name "gdb/26967"
> + -re "miss_step_2.*$::gdb_prompt $" {
> + if { $have_longjmp_probe } {
> + fail $gdb_test_name
> + } else {
> + kfail $gdb_test_name "gdb/26967"
> + }
> + }
> + -re -wrap "\r\n$re_cannot_insert_bp\r\n.*" {
> + if { $have_longjmp_probe } {
> + fail $gdb_test_name
> + } else {
> + kfail $gdb_test_name "gdb/26967"
> + }
> }
> }
> }
> -}
>
> -#
> -# Pattern 3 - setjmp/longjmp inside stepped-over function.
> -#
> + #
> + # Pattern 3 - setjmp/longjmp inside stepped-over function.
> + #
>
> -with_test_prefix "pattern 3" {
> + with_test_prefix "pattern 3" {
>
> - with_test_prefix setup {
> - delete_breakpoints
> + with_test_prefix setup {
> + delete_breakpoints
>
> - gdb_test "break $bp_start_test_3" \
> - "Breakpoint.*at.* file .*$srcfile, line.*$bp_start_test_3.*" \
> - "breakpoint at pattern start"
> - gdb_test "continue" "patt3.*" "continue to breakpoint at pattern start"
> - }
> -
> - gdb_test_multiple "next" "next over pattern" {
> - -re -wrap "longjmp caught.*" {
> - pass $gdb_test_name
> + gdb_test "break $bp_start_test_3" \
> + "Breakpoint.*at.* file .*$::srcfile, line.*$bp_start_test_3.*" \
> + "breakpoint at pattern start"
> + gdb_test "continue" "patt3.*" "continue to breakpoint at pattern start"
> }
> - -re -wrap "\r\n$re_cannot_insert_bp\r\n.*" {
> - if { $have_longjmp_probe } {
> - fail $gdb_test_name
> - } else {
> - kfail $gdb_test_name "gdb/26967"
> +
> + gdb_test_multiple "next" "next over pattern" {
> + -re -wrap "longjmp caught.*" {
> + pass $gdb_test_name
> + }
> + -re -wrap "\r\n$re_cannot_insert_bp\r\n.*" {
> + if { $have_longjmp_probe } {
> + fail $gdb_test_name
> + } else {
> + kfail $gdb_test_name "gdb/26967"
> + }
> }
> }
> }
> }
> +
> +foreach_with_prefix with_probes { 0 1 } {
> + do_test $with_probes
> +}
>
> base-commit: 0ab9328277ce12014ce05ff139eba7a6230516fd
next prev parent reply other threads:[~2023-02-08 13:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-08 12:46 Tom de Vries
2023-02-08 13:27 ` Luis Machado [this message]
2023-02-08 14:48 ` Tom de Vries
2023-02-08 14:51 ` Luis Machado
2023-02-08 15:38 ` Tom de Vries
2023-02-08 18:06 ` Luis Machado
2023-02-08 20:36 ` Tom de Vries
2023-02-09 10:37 ` Luis Machado
2023-02-09 11:58 ` Luis Machado
2023-02-09 12:19 ` Tom de Vries
2023-02-09 14:34 ` Luis Machado
2023-02-09 16:44 ` Luis Machado
2023-02-10 11:09 ` Tom de Vries
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ac22420a-1549-bc0e-94f5-9f3e3f4af107@arm.com \
--to=luis.machado@arm.com \
--cc=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).