From: Simon Marchi <simark@simark.ca>
To: Luis Machado <luis.machado@linaro.org>, gdb-patches@sourceware.org
Cc: Alan.Hayward@arm.com
Subject: Re: [PATCH v3] Harden gdb.base/step-over-syscall.exp
Date: Mon, 27 Jan 2020 19:02:00 -0000 [thread overview]
Message-ID: <491a48b7-e3ad-9372-5d45-1d645f94fd19@simark.ca> (raw)
In-Reply-To: <20200127181336.13893-1-luis.machado@linaro.org>
On 2020-01-27 1:13 p.m., Luis Machado wrote:
> @@ -75,39 +100,78 @@ proc setup { syscall } {
> # Hit the breakpoint on $syscall for the second time. In this time,
> # the address of syscall insn and next insn of syscall are recorded.
>
> - gdb_test "display/i \$pc" ".*"
> + # Check if the first instruction we stopped at is the syscall one.
> + set syscall_insn_addr -1
> + gdb_test_multiple "display/i \$pc" "fetch first stop pc" {
> + -re "display/i .*: x/i .*=> ($hex) .*:.*$syscall_insn.*$gdb_prompt $" {
> + set insn_addr $expect_out(1,string)
>
> - # Single step until we see a syscall insn or we reach the
> - # upper bound of loop iterations.
> - set msg "find syscall insn in $syscall"
> - set steps 0
> - set max_steps 1000
> - gdb_test_multiple "stepi" $msg {
> - -re ".*$syscall_insn.*$gdb_prompt $" {
> - pass $msg
> + # Is the syscall number the correct one?
> + if {[syscall_number_matches $syscall]} {
> + set syscall_insn_addr $insn_addr
> + }
> + pass $gdb_test_name
> }
> - -re "x/i .*=>.*\r\n$gdb_prompt $" {
> - incr steps
> - if {$steps == $max_steps} {
> - fail $msg
> - } else {
> - send_gdb "stepi\n"
> - exp_continue
> + -re ".*$gdb_prompt $" {
> + pass $gdb_test_name
> + }
> + }
> +
> + # If we are not at the syscall instruction yet, keep looking for it with
> + # stepi commands.
> + if {$syscall_insn_addr == -1} {
> + # Single step until we see a syscall insn or we reach the
> + # upper bound of loop iterations.
> + set msg "find syscall insn in $syscall"
This can be a literal in the gdB_test_multiple call, we don't need `msg`
anymore.
The patch LGTM with that fixed.
Simon
next prev parent reply other threads:[~2020-01-27 18:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-15 21:09 [PATCH] " Luis Machado
2020-01-22 13:39 ` [PING] " Luis Machado
2020-01-22 14:45 ` Alan Hayward
2020-01-22 15:49 ` Luis Machado
2020-01-22 17:06 ` Alan Hayward
[not found] ` <66fc6535-755d-ffae-627b-fd8925294fb6@simark.ca>
2020-01-22 17:48 ` Luis Machado
2020-01-24 16:37 ` [PATCH,v2] " Luis Machado
2020-01-24 17:35 ` Simon Marchi
2020-01-27 18:48 ` [PATCH v3] " Luis Machado
2020-01-27 19:02 ` Simon Marchi [this message]
2020-01-27 21:25 ` Luis Machado
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=491a48b7-e3ad-9372-5d45-1d645f94fd19@simark.ca \
--to=simark@simark.ca \
--cc=Alan.Hayward@arm.com \
--cc=gdb-patches@sourceware.org \
--cc=luis.machado@linaro.org \
/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