1 /* Thread command's finish-state machine, for GDB, the GNU debugger.
2 Copyright (C) 2015-2016 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)
31 /* See thread-fsm.h. */
34 thread_fsm_delete (struct thread_fsm *self)
38 if (self->ops->dtor != NULL)
39 self->ops->dtor (self);
44 /* See thread-fsm.h. */
47 thread_fsm_clean_up (struct thread_fsm *self)
49 if (self->ops->clean_up != NULL)
50 self->ops->clean_up (self);
53 /* See thread-fsm.h. */
56 thread_fsm_should_stop (struct thread_fsm *self)
58 return self->ops->should_stop (self);
61 /* See thread-fsm.h. */
63 struct return_value_info *
64 thread_fsm_return_value (struct thread_fsm *self)
66 if (self->ops->return_value != NULL)
67 return self->ops->return_value (self);
71 /* See thread-fsm.h. */
74 thread_fsm_set_finished (struct thread_fsm *self)
79 /* See thread-fsm.h. */
82 thread_fsm_finished_p (struct thread_fsm *self)
84 return self->finished;
87 /* See thread-fsm.h. */
89 enum async_reply_reason
90 thread_fsm_async_reply_reason (struct thread_fsm *self)
92 /* If we didn't finish, then the stop reason must come from
93 elsewhere. E.g., a breakpoint hit or a signal intercepted. */
94 gdb_assert (thread_fsm_finished_p (self));
96 return self->ops->async_reply_reason (self);
99 /* See thread-fsm.h. */
102 thread_fsm_should_notify_stop (struct thread_fsm *self)
104 if (self->ops->should_notify_stop != NULL)
105 return self->ops->should_notify_stop (self);