diff options
author | Pedro Alves <palves@redhat.com> | 2015-09-09 18:23:24 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2015-09-09 18:24:34 +0100 |
commit | 388a708404618466bbe51b7198de7a64f0a5da9f (patch) | |
tree | 2e85b3d232219ca1c8d9399007360f027df6fc2d /gdb/thread-fsm.c | |
parent | 243a925328f8e3184b2356bee497181049c0174f (diff) | |
download | gdb-388a708404618466bbe51b7198de7a64f0a5da9f.zip gdb-388a708404618466bbe51b7198de7a64f0a5da9f.tar.gz gdb-388a708404618466bbe51b7198de7a64f0a5da9f.tar.bz2 |
Convert infcalls to thread_fsm mechanism
This removes infcall-specific special casing from normal_stop,
simplifying it.
Like the "finish" command's, the FSM is responsible for storing the
function's return value.
gdb/ChangeLog:
2015-09-09 Pedro Alves <palves@redhat.com>
* infcall.c: Include thread_fsm.h.
(struct call_return_meta_info): New.
(get_call_return_value): New function, factored out from
call_function_by_hand_dummy.
(struct call_thread_fsm): New.
(call_thread_fsm_ops): New global.
(new_call_thread_fsm, call_thread_fsm_should_stop)
(call_thread_fsm_should_notify_stop): New functions.
(run_inferior_call): Add 'sm' parameter. Associate the FSM with
the thread.
(call_function_by_hand_dummy): Create a new call_thread_fsm
instance, associate it with the thread, and wait for the FSM to
finish. If finished successfully, fetch the function's result
value out of the FSM.
* infrun.c (fetch_inferior_event): If the FSM says the stop
shouldn't be notified, don't call normal_stop.
(maybe_remove_breakpoints): New function, factored out from ...
(normal_stop): ... here. Simplify.
* infrun.h (maybe_remove_breakpoints): Declare.
* thread-fsm.c (thread_fsm_should_notify_stop): New function.
(thread-fsm.h) <struct thread_fsm_ops>: New field.
(thread_fsm_should_notify_stop): Declare.
Diffstat (limited to 'gdb/thread-fsm.c')
-rw-r--r-- | gdb/thread-fsm.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gdb/thread-fsm.c b/gdb/thread-fsm.c index 761ad1c..4a27d02 100644 --- a/gdb/thread-fsm.c +++ b/gdb/thread-fsm.c @@ -95,3 +95,13 @@ thread_fsm_async_reply_reason (struct thread_fsm *self) return self->ops->async_reply_reason (self); } + +/* See thread-fsm.h. */ + +int +thread_fsm_should_notify_stop (struct thread_fsm *self) +{ + if (self->ops->should_notify_stop != NULL) + return self->ops->should_notify_stop (self); + return 1; +} |