xref: /dflybsd-src/contrib/gdb-7/gdb/continuations.h (revision de8e141f24382815c10a4012d209bbbf7abf1112)
1a45ae5f8SJohn Marino /* Continuations for GDB, the GNU debugger.
2a45ae5f8SJohn Marino 
3*ef5ccd6cSJohn Marino    Copyright (C) 1999-2013 Free Software Foundation, Inc.
4a45ae5f8SJohn Marino 
5a45ae5f8SJohn Marino    This file is part of GDB.
6a45ae5f8SJohn Marino 
7a45ae5f8SJohn Marino    This program is free software; you can redistribute it and/or modify
8a45ae5f8SJohn Marino    it under the terms of the GNU General Public License as published by
9a45ae5f8SJohn Marino    the Free Software Foundation; either version 3 of the License, or
10a45ae5f8SJohn Marino    (at your option) any later version.
11a45ae5f8SJohn Marino 
12a45ae5f8SJohn Marino    This program is distributed in the hope that it will be useful,
13a45ae5f8SJohn Marino    but WITHOUT ANY WARRANTY; without even the implied warranty of
14a45ae5f8SJohn Marino    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15a45ae5f8SJohn Marino    GNU General Public License for more details.
16a45ae5f8SJohn Marino 
17a45ae5f8SJohn Marino    You should have received a copy of the GNU General Public License
18a45ae5f8SJohn Marino    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19a45ae5f8SJohn Marino 
20a45ae5f8SJohn Marino #ifndef CONTINUATIONS_H
21a45ae5f8SJohn Marino #define CONTINUATIONS_H
22a45ae5f8SJohn Marino 
23a45ae5f8SJohn Marino struct thread_info;
24a45ae5f8SJohn Marino struct inferior;
25a45ae5f8SJohn Marino 
26a45ae5f8SJohn Marino /* To continue the execution commands when running gdb asynchronously.
27a45ae5f8SJohn Marino    A continuation structure contains a pointer to a function to be called
28a45ae5f8SJohn Marino    to finish the command, once the target has stopped.  Such mechanism is
29a45ae5f8SJohn Marino    used by the finish and until commands, and in the remote protocol
30a45ae5f8SJohn Marino    when opening an extended-remote connection.  */
31a45ae5f8SJohn Marino 
32a45ae5f8SJohn Marino /* Prototype of the continuation callback functions.  ARG is the
33a45ae5f8SJohn Marino    continuation argument registered in the corresponding
34a45ae5f8SJohn Marino    add_*_continuation call.  ERR is true when the command should be
35a45ae5f8SJohn Marino    cancelled instead of finished normally.  In that case, the
36a45ae5f8SJohn Marino    continuation should clean up whatever state had been set up for the
37a45ae5f8SJohn Marino    command in question (e.g., remove momentary breakpoints).  This
38a45ae5f8SJohn Marino    happens e.g., when an error was thrown while handling a target
39a45ae5f8SJohn Marino    event, or when the inferior thread the command was being executed
40a45ae5f8SJohn Marino    on exits.  */
41a45ae5f8SJohn Marino typedef void (continuation_ftype) (void *arg, int err);
42a45ae5f8SJohn Marino 
43a45ae5f8SJohn Marino /* Prototype of the function responsible for releasing the argument
44a45ae5f8SJohn Marino    passed to the continuation callback functions, either when the
45a45ae5f8SJohn Marino    continuation is called, or discarded.  */
46a45ae5f8SJohn Marino typedef void (continuation_free_arg_ftype) (void *);
47a45ae5f8SJohn Marino 
48a45ae5f8SJohn Marino /* Thread specific continuations.  */
49a45ae5f8SJohn Marino 
50a45ae5f8SJohn Marino extern void add_continuation (struct thread_info *,
51a45ae5f8SJohn Marino 			      continuation_ftype *, void *,
52a45ae5f8SJohn Marino 			      continuation_free_arg_ftype *);
53a45ae5f8SJohn Marino extern void do_all_continuations (int err);
54a45ae5f8SJohn Marino extern void do_all_continuations_thread (struct thread_info *, int err);
55a45ae5f8SJohn Marino extern void discard_all_continuations (void);
56a45ae5f8SJohn Marino extern void discard_all_continuations_thread (struct thread_info *);
57a45ae5f8SJohn Marino 
58a45ae5f8SJohn Marino extern void add_intermediate_continuation (struct thread_info *,
59a45ae5f8SJohn Marino 					   continuation_ftype *, void *,
60a45ae5f8SJohn Marino 					   continuation_free_arg_ftype *);
61a45ae5f8SJohn Marino extern void do_all_intermediate_continuations (int err);
62a45ae5f8SJohn Marino extern void do_all_intermediate_continuations_thread (struct thread_info *, int err);
63a45ae5f8SJohn Marino extern void discard_all_intermediate_continuations (void);
64a45ae5f8SJohn Marino extern void discard_all_intermediate_continuations_thread (struct thread_info *);
65a45ae5f8SJohn Marino 
66a45ae5f8SJohn Marino /* Inferior specific (any thread) continuations.  */
67a45ae5f8SJohn Marino 
68a45ae5f8SJohn Marino extern void add_inferior_continuation (continuation_ftype *,
69a45ae5f8SJohn Marino 				       void *,
70a45ae5f8SJohn Marino 				       continuation_free_arg_ftype *);
71a45ae5f8SJohn Marino extern void do_all_inferior_continuations (int err);
72a45ae5f8SJohn Marino extern void discard_all_inferior_continuations (struct inferior *inf);
73a45ae5f8SJohn Marino 
74a45ae5f8SJohn Marino #endif
75