aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2023-10-03 22:04:01 -0400
committerSimon Marchi <simon.marchi@efficios.com>2023-10-10 11:02:00 -0400
commit635b2dd919b8c58e164b77c396041935fca1d66a (patch)
treeb1d060a23bdd8b7796e0afcff103b608b80d628d /gdb/remote.c
parente84ffe7bcf2f718a492fc3645785a7705fde6d23 (diff)
downloadfsf-binutils-gdb-635b2dd919b8c58e164b77c396041935fca1d66a.zip
fsf-binutils-gdb-635b2dd919b8c58e164b77c396041935fca1d66a.tar.gz
fsf-binutils-gdb-635b2dd919b8c58e164b77c396041935fca1d66a.tar.bz2
gdb: add assertion when marking the remote async flag
As reported in bug 30630 [1], we hit a case where the remote target's async flag is marked while the target is not configured (yet) to work async. This should not happen. It is caught thanks to this assert in remote_target::wait: /* Start by clearing the flag that asks for our wait method to be called, we'll mark it again at the end if needed. If the target is not in async mode then the async token should not be marked. */ if (target_is_async_p ()) rs->clear_async_event_handler (); else gdb_assert (!rs->async_event_handler_marked ()); This is helpful, but I think that we could have caught the problem earlier than that, at the moment we marked the handler. Catching problems earlier makes them easier to debug. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=30630 Change-Id: I7e229c74b04da82bef6a817d5a676be5cf52e833 Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb/remote.c')
-rw-r--r--gdb/remote.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/gdb/remote.c b/gdb/remote.c
index 5f12f93..961061e 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -425,7 +425,10 @@ public:
}
void mark_async_event_handler ()
- { ::mark_async_event_handler (m_async_event_handler_token); }
+ {
+ gdb_assert (this->is_async_p ());
+ ::mark_async_event_handler (m_async_event_handler_token);
+ }
void clear_async_event_handler ()
{ ::clear_async_event_handler (m_async_event_handler_token); }