1 /* Thread command's finish-state machine, for GDB, the GNU debugger.
2 Copyright (C) 2015-2018 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 #include "thread-fsm.h"
22 /* See thread-fsm.h. */
25 thread_fsm_ctor (struct thread_fsm *self, struct thread_fsm_ops *ops,
26 struct interp *cmd_interp)
28 self->command_interp = cmd_interp;
33 /* See thread-fsm.h. */
36 thread_fsm_delete (struct thread_fsm *self)
40 if (self->ops->dtor != NULL)
41 self->ops->dtor (self);
46 /* See thread-fsm.h. */
49 thread_fsm_clean_up (struct thread_fsm *self, struct thread_info *thread)
51 if (self->ops->clean_up != NULL)
52 self->ops->clean_up (self, thread);
55 /* See thread-fsm.h. */
58 thread_fsm_should_stop (struct thread_fsm *self, struct thread_info *thread)
60 return self->ops->should_stop (self, thread);
63 /* See thread-fsm.h. */
65 struct return_value_info *
66 thread_fsm_return_value (struct thread_fsm *self)
68 if (self->ops->return_value != NULL)
69 return self->ops->return_value (self);
73 /* See thread-fsm.h. */
76 thread_fsm_set_finished (struct thread_fsm *self)
81 /* See thread-fsm.h. */
84 thread_fsm_finished_p (struct thread_fsm *self)
86 return self->finished;
89 /* See thread-fsm.h. */
91 enum async_reply_reason
92 thread_fsm_async_reply_reason (struct thread_fsm *self)
94 /* If we didn't finish, then the stop reason must come from
95 elsewhere. E.g., a breakpoint hit or a signal intercepted. */
96 gdb_assert (thread_fsm_finished_p (self));
98 return self->ops->async_reply_reason (self);
101 /* See thread-fsm.h. */
104 thread_fsm_should_notify_stop (struct thread_fsm *self)
106 if (self->ops->should_notify_stop != NULL)
107 return self->ops->should_notify_stop (self);