[gdb] Fix assert in remote_async_get_pending_events_handler

Occassionally I run into the following assert:
...
(gdb) PASS: gdb.multi/multi-target-continue.exp: inferior 5
Remote debugging from host ::1, port 49990^M
Process multi-target-continue created; pid = 31241^M
src/gdb/remote-notif.c:113: internal-error: \
  void remote_async_get_pending_events_handler(gdb_client_data): \
  Assertion `target_is_non_stop_p ()' failed.^M
...

The assert checks target_is_non_stop_p, which is related to the current
target.

Fix this by changing the assert such that it checks non-stopness related to
the event it's handling.

Tested on x86_64-linux.

gdb/ChangeLog:

2021-04-22  Simon Marchi  <simon.marchi@polymtl.ca>
	    Tom de Vries  <tdevries@suse.de>

	PR remote/27710
	* remote.c (remote_target_is_non_stop_p): New function.
	* remote.h (remote_target_is_non_stop_p): Declare.
	* remote-notif.c (remote_async_get_pending_events_handler): Fix assert
	to check non-stopness using notif_state->remote rather current target.
This commit is contained in:
Tom de Vries
2021-04-22 17:01:00 +02:00
parent bdd2aaf69e
commit c39ebbf43f
4 changed files with 22 additions and 1 deletions

View File

@ -110,7 +110,7 @@ remote_async_get_pending_events_handler (gdb_client_data data)
{
remote_notif_state *notif_state = (remote_notif_state *) data;
clear_async_event_handler (notif_state->get_pending_events_token);
gdb_assert (target_is_non_stop_p ());
gdb_assert (remote_target_is_non_stop_p (notif_state->remote));
remote_notif_process (notif_state, NULL);
}