Commit | Line | Data |
---|---|---|
c906108c | 1 | /* Module support. |
9b254dd1 | 2 | Copyright (C) 1996, 1997, 2007, 2008 Free Software Foundation, Inc. |
c906108c SS |
3 | Contributed by Cygnus Support. |
4 | ||
5 | This file is part of GDB, the GNU debugger. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
4744ac1b JB |
9 | the Free Software Foundation; either version 3 of the License, or |
10 | (at your option) any later version. | |
c906108c SS |
11 | |
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
4744ac1b JB |
17 | You should have received a copy of the GNU General Public License |
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
c906108c SS |
19 | |
20 | /* This file is intended to be included by sim-base.h. */ | |
21 | ||
22 | #ifndef SIM_MODULES_H | |
23 | #define SIM_MODULES_H | |
24 | ||
25 | /* Modules are addons to the simulator that perform a specific function | |
26 | (e.g. tracing, profiling, memory subsystem, etc.). Some modules are | |
27 | builtin, and others are added at configure time. The intent is to | |
28 | provide a uniform framework for all of the pieces that make up the | |
29 | simulator. | |
30 | ||
31 | TODO: Add facilities for saving/restoring state to/from a file. */ | |
32 | ||
33 | ||
34 | /* Various function types. */ | |
35 | ||
36 | typedef SIM_RC (MODULE_INSTALL_FN) (SIM_DESC); | |
37 | typedef SIM_RC (MODULE_INIT_FN) (SIM_DESC); | |
38 | typedef SIM_RC (MODULE_RESUME_FN) (SIM_DESC); | |
39 | typedef SIM_RC (MODULE_SUSPEND_FN) (SIM_DESC); | |
40 | typedef void (MODULE_UNINSTALL_FN) (SIM_DESC); | |
41 | typedef void (MODULE_INFO_FN) (SIM_DESC, int); | |
42 | ||
43 | ||
44 | /* Lists of installed handlers. */ | |
45 | ||
46 | typedef struct module_init_list { | |
47 | struct module_init_list *next; | |
48 | MODULE_INIT_FN *fn; | |
49 | } MODULE_INIT_LIST; | |
50 | ||
51 | typedef struct module_resume_list { | |
52 | struct module_resume_list *next; | |
53 | MODULE_RESUME_FN *fn; | |
54 | } MODULE_RESUME_LIST; | |
55 | ||
56 | typedef struct module_suspend_list { | |
57 | struct module_suspend_list *next; | |
58 | MODULE_SUSPEND_FN *fn; | |
59 | } MODULE_SUSPEND_LIST; | |
60 | ||
61 | typedef struct module_uninstall_list { | |
62 | struct module_uninstall_list *next; | |
63 | MODULE_UNINSTALL_FN *fn; | |
64 | } MODULE_UNINSTALL_LIST; | |
65 | ||
66 | typedef struct module_info_list { | |
67 | struct module_info_list *next; | |
68 | MODULE_INFO_FN *fn; | |
69 | } MODULE_INFO_LIST; | |
70 | ||
71 | ||
72 | /* Functions to register module with various handler lists */ | |
73 | ||
74 | SIM_RC sim_module_install (SIM_DESC); | |
75 | void sim_module_uninstall (SIM_DESC); | |
76 | void sim_module_add_init_fn (SIM_DESC sd, MODULE_INIT_FN fn); | |
77 | void sim_module_add_resume_fn (SIM_DESC sd, MODULE_RESUME_FN fn); | |
78 | void sim_module_add_suspend_fn (SIM_DESC sd, MODULE_SUSPEND_FN fn); | |
79 | void sim_module_add_uninstall_fn (SIM_DESC sd, MODULE_UNINSTALL_FN fn); | |
80 | void sim_module_add_info_fn (SIM_DESC sd, MODULE_INFO_FN fn); | |
81 | ||
82 | ||
83 | /* Initialize installed modules before argument processing. | |
84 | Called by sim_open. */ | |
85 | SIM_RC sim_pre_argv_init (SIM_DESC sd, const char *myname); | |
86 | ||
87 | /* Initialize installed modules after argument processing. | |
88 | Called by sim_open. */ | |
89 | SIM_RC sim_post_argv_init (SIM_DESC sd); | |
90 | ||
91 | /* Re-initialize the module. Called by sim_create_inferior. */ | |
92 | SIM_RC sim_module_init (SIM_DESC sd); | |
93 | ||
94 | /* Suspend/resume modules. Called by sim_run or sim_resume */ | |
95 | SIM_RC sim_module_suspend (SIM_DESC sd); | |
96 | SIM_RC sim_module_resume (SIM_DESC sd); | |
97 | ||
98 | /* Report general information on module */ | |
99 | void sim_module_info (SIM_DESC sd, int verbose); | |
100 | ||
101 | ||
102 | /* Module private data */ | |
103 | ||
104 | struct module_list { | |
105 | ||
106 | /* List of installed module `init' handlers */ | |
107 | MODULE_INIT_LIST *init_list; | |
108 | ||
109 | /* List of installed module `uninstall' handlers. */ | |
110 | MODULE_UNINSTALL_LIST *uninstall_list; | |
111 | ||
112 | /* List of installed module `resume' handlers. */ | |
113 | MODULE_RESUME_LIST *resume_list; | |
114 | ||
115 | /* List of installed module `suspend' handlers. */ | |
116 | MODULE_SUSPEND_LIST *suspend_list; | |
117 | ||
118 | /* List of installed module `info' handlers. */ | |
119 | MODULE_INFO_LIST *info_list; | |
120 | ||
121 | }; | |
122 | ||
123 | ||
124 | #endif /* SIM_MODULES_H */ |