From 388a708404618466bbe51b7198de7a64f0a5da9f Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Wed, 9 Sep 2015 18:23:24 +0100 Subject: 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 * 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) : New field. (thread_fsm_should_notify_stop): Declare. --- gdb/thread-fsm.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gdb/thread-fsm.h') diff --git a/gdb/thread-fsm.h b/gdb/thread-fsm.h index 031684b..c22c51f 100644 --- a/gdb/thread-fsm.h +++ b/gdb/thread-fsm.h @@ -67,6 +67,9 @@ struct thread_fsm_ops /* The async_reply_reason that is broadcast to MI clients if this FSM finishes successfully. */ enum async_reply_reason (*async_reply_reason) (struct thread_fsm *self); + + /* Whether the stop should be notified to the user/frontend. */ + int (*should_notify_stop) (struct thread_fsm *self); }; /* Initialize FSM. */ extern void thread_fsm_ctor (struct thread_fsm *fsm, @@ -95,4 +98,7 @@ extern int thread_fsm_finished_p (struct thread_fsm *fsm); extern enum async_reply_reason thread_fsm_async_reply_reason (struct thread_fsm *fsm); +/* Calls the FSM's should_notify_stop method. */ +extern int thread_fsm_should_notify_stop (struct thread_fsm *self); + #endif /* THREAD_FSM_H */ -- cgit v1.1