From: Simon Marchi <simark@simark.ca>
To: "Maciej W. Rozycki" <macro@wdc.com>,
Pedro Alves <palves@redhat.com>,
gdb-patches@sourceware.org
Cc: Jim Wilson <jimw@sifive.com>
Subject: Re: [PATCH v2 1/4] Remove stale breakpoint step-over information
Date: Tue, 21 Jan 2020 05:41:00 -0000 [thread overview]
Message-ID: <05f8f157-1d6a-57e1-4bee-a9e17e5ed54d@simark.ca> (raw)
In-Reply-To: <alpine.LFD.2.21.1911051531570.13542@redsun52.ssa.fujisawa.hgst.com>
On 2019-11-06 3:51 p.m., Maciej W. Rozycki wrote:
> Fix an issue with the `step_over_info' structure introduced with commit
> 31e77af205cf ("PR breakpoints/7143 - Watchpoint does not trigger when
> first set"), where information stored in there is not invalidated in a
> remote debug scenario where software stepping in the all-stop mode is
> forcibly interrupted and the target connection then closed. As a result
> a subsequent target connection triggers an assertion failure on
> `ecs->event_thread->control.trap_expected' and cannot be successfully
> established, making the particular instance of GDB unusable.
>
> This was observed with a `riscv64-linux-gnu' cross-GDB and RISC-V/Linux
> `gdbserver' being developed and an attempt to step over the `ret' aka
> `c.jr ra' instruction where the value held in the `ra' aka `x1' register
> and therefore the address of a software-stepping breakpoint to insert is
> 0, as follows:
>
> (gdb) target remote 1.2.3.4:56789
> Remote debugging using 1.2.3.4:56789
> warning: while parsing target description (at line 4): Target description specified unknown architecture "riscv:rv64id"
> warning: Could not load XML target description; ignoring
> Reading symbols from .../sysroot/lib/ld-linux-riscv64-lp64d.so.1...
> 0x0000001555556ef0 in _start ()
> from .../sysroot/lib/ld-linux-riscv64-lp64d.so.1
> (gdb) break main
> Breakpoint 1 at 0x1643c
> (gdb) continue
> Continuing.
> Cannot access memory at address 0x0
> (gdb) x /i $pc
> => 0x15555607b8 <__GI__dl_debug_state>: ret
> (gdb) print /x $ra
> $1 = 0x0
> (gdb) stepi
> ^C^CInterrupted while waiting for the program.
> Give up waiting? (y or n) y
> Quit
> (gdb) kill
> Kill the program being debugged? (y or n) y
> [Inferior 1 (process 8964) killed]
> (gdb) target remote 1.2.3.4:56789
> Remote debugging using 1.2.3.4:56789
> warning: while parsing target description (at line 4): Target description specified unknown architecture "riscv:rv64id"
> warning: Could not load XML target description; ignoring
> .../gdb/infrun.c:5299: internal-error: int finish_step_over(execution_control_state*): Assertion `ecs->event_thread->control.trap_expected' failed.
> A problem internal to GDB has been detected,
> further debugging may prove unreliable.
> Quit this debugging session? (y or n) y
>
> This is a bug, please report it. For instructions, see:
> <http://www.gnu.org/software/gdb/bugs/>.
>
> .../gdb/infrun.c:5299: internal-error: int finish_step_over(execution_control_state*): Assertion `ecs->event_thread->control.trap_expected' failed.
> A problem internal to GDB has been detected,
> further debugging may prove unreliable.
> Create a core file of GDB? (y or n) n
> Command aborted.
> (gdb)
>
> Correct the issue by making a call to clear global breakpoint step-over
> information from `clear_thread_inferior_resources'. To do so add an
> argument to `clear_step_over_info' giving the global thread number to
> check against, complementing one given to `set_step_over_info' when the
> information concerned is recorded, so that information is not removed
> for a thread that has stayed alive in a multi-target scenario.
>
> Adjust all the existing `clear_step_over_info' call sites accordingly
> where a step over has completed successfully and the thread that has
> hit the breakpoint is expected to be one for which the breakpoint has
> been inserted.
>
> gdb/
> * infrun.h (clear_step_over_info): New prototype.
> * infrun.c (thread_is_stepping_over_breakpoint): Move earlier
> on.
> (clear_step_over_info): Use it. Make external.
> (resume_1, finish_step_over, handle_signal_stop)
> (keep_going_stepped_thread, keep_going_pass_signal): Adjust
> accordingly.
> * thread.c (clear_thread_inferior_resources): Call
> `clear_step_over_info'.
This patch looks good to me, but I'd really prefer if Pedro could look at it,
since he's much more adept in this area.
Simon
next prev parent reply other threads:[~2020-01-21 5:34 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-06 20:51 [PATCH v2 0/4] GDB fixes for the remote end having gone astray Maciej W. Rozycki
2019-11-06 20:51 ` [PATCH v2 1/4] Remove stale breakpoint step-over information Maciej W. Rozycki
2020-01-21 5:41 ` Simon Marchi [this message]
2020-02-19 11:26 ` Luis Machado
2019-11-06 20:52 ` [PATCH v2 4/4] Unregister the inferior from the event loop if failed to resume Maciej W. Rozycki
2020-02-19 13:40 ` Luis Machado
2019-11-06 20:52 ` [PATCH v2 2/4] Unregister the last inferior from the event loop Maciej W. Rozycki
2020-01-21 5:47 ` Simon Marchi
2020-01-21 11:21 ` Maciej W. Rozycki
2020-01-21 17:34 ` Simon Marchi
2020-01-22 17:35 ` Maciej W. Rozycki
2020-01-23 1:19 ` Maciej W. Rozycki
2020-01-23 5:39 ` Maciej W. Rozycki
2020-01-23 16:59 ` Simon Marchi
2019-11-06 20:52 ` [PATCH v2 3/4] Remove breakpoint step-over information if failed to resume Maciej W. Rozycki
2020-01-21 8:29 ` Simon Marchi
2020-02-19 13:30 ` Luis Machado
2019-11-18 12:38 ` [PING][PATCH v2 0/4] GDB fixes for the remote end having gone astray Maciej W. Rozycki
2019-11-26 15:49 ` [PING^2][PATCH " Maciej W. Rozycki
2019-12-02 14:50 ` [PING^3][PATCH " Maciej W. Rozycki
2019-12-05 20:59 ` Palmer Dabbelt via gdb-patches
2019-12-05 21:21 ` Maciej W. Rozycki
2019-12-09 21:29 ` [PING^4][PATCH " Maciej W. Rozycki
2019-12-17 0:06 ` [PING^5][PATCH " Maciej W. Rozycki
2020-01-06 15:40 ` [PING^6][PATCH " Maciej W. Rozycki
2020-01-13 20:46 ` [PING^7][PATCH " Maciej W. Rozycki
2020-01-21 4:21 ` [PING^8][PATCH " Maciej W. Rozycki
2020-02-10 9:01 ` [PING^10][PATCH " Maciej W. Rozycki
2020-02-17 14:07 ` [PATCH " Maciej W. Rozycki
2020-02-18 10:38 ` Luis Machado
2020-02-19 21:11 ` Tom Tromey
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=05f8f157-1d6a-57e1-4bee-a9e17e5ed54d@simark.ca \
--to=simark@simark.ca \
--cc=gdb-patches@sourceware.org \
--cc=jimw@sifive.com \
--cc=macro@wdc.com \
--cc=palves@redhat.com \
/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