GDB (xrefs)
/tmp/gdb-8.1/gdb/extension.h
Go to the documentation of this file.
1 /* Interface between gdb and its extension languages.
2 
3  Copyright (C) 2014-2018 Free Software Foundation, Inc.
4 
5  This file is part of GDB.
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
9  the Free Software Foundation; either version 3 of the License, or
10  (at your option) any later version.
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 
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/>. */
19 
20 #ifndef EXTENSION_H
21 #define EXTENSION_H
22 
23 #include "mi/mi-cmds.h" /* For PRINT_NO_VALUES, etc. */
24 #include "common/vec.h"
25 
26 struct breakpoint;
27 struct command_line;
28 struct frame_info;
29 struct language_defn;
30 struct objfile;
32 struct type;
33 struct ui_file;
34 struct ui_out;
35 struct value;
36 struct value_print_options;
37 
38 /* A function to load and process a script file.
39  The file has been opened and is ready to be read from the beginning.
40  Any exceptions are not caught, and are passed to the caller. */
41 typedef void script_sourcer_func (const struct extension_language_defn *,
42  FILE *stream, const char *filename);
43 
44 /* A function to load and process a script for an objfile.
45  The file has been opened and is ready to be read from the beginning.
46  Any exceptions are not caught, and are passed to the caller. */
47 typedef void objfile_script_sourcer_func
48  (const struct extension_language_defn *,
49  struct objfile *, FILE *stream, const char *filename);
50 
51 /* A function to execute a script for an objfile.
52  Any exceptions are not caught, and are passed to the caller. */
54  (const struct extension_language_defn *,
55  struct objfile *, const char *name, const char *script);
56 
57 /* Enum of each extension(/scripting) language. */
58 
60  {
65  };
66 
67 /* Extension language frame-filter status return values. */
68 
70  {
71  /* Return when an error has occurred in processing frame filters,
72  or when printing the stack. */
74 
75  /* Return from internal routines to indicate that the function
76  succeeded. */
78 
79  /* Return when the frame filter process is complete, and all
80  operations have succeeded. */
82 
83  /* Return when the frame filter process is complete, but there
84  were no filter registered and enabled to process. */
86  };
87 
88 /* Flags to pass to apply_extlang_frame_filter. */
89 
91  {
92  /* Set this flag if frame level is to be printed. */
94 
95  /* Set this flag if frame information is to be printed. */
97 
98  /* Set this flag if frame arguments are to be printed. */
100 
101  /* Set this flag if frame locals are to be printed. */
103  };
104 
105 /* A choice of the different frame argument printing strategies that
106  can occur in different cases of frame filter instantiation. */
107 
109  {
110  /* Print no values for arguments when invoked from the MI. */
112 
114 
115  /* Print only simple values (what MI defines as "simple") for
116  arguments when invoked from the MI. */
118 
119  /* Print only scalar values for arguments when invoked from the CLI. */
121 
122  /* Print all values for arguments when invoked from the CLI. */
124  };
125 
126 /* The possible results of
127  extension_language_ops.breakpoint_cond_says_stop. */
128 
130  {
131  /* No "stop" condition is set. */
133 
134  /* A "stop" condition is set, and it says "don't stop". */
136 
137  /* A "stop" condition is set, and it says "stop". */
139  };
140 
141 /* Table of type printers associated with the global typedef table. */
142 
144 {
145  /* Type-printers from Python. */
147 };
148 
149 /* A type which holds its extension language specific xmethod worker data. */
150 
152 {
153  /* The language the xmethod worker is implemented in. */
155 
156  /* The extension language specific data for this xmethod worker. */
157  void *data;
158 
159  /* The TYPE_CODE_XMETHOD value corresponding to this worker.
160  Always use value_of_xmethod to access it. */
161  struct value *value;
162 };
163 
166 typedef VEC (xmethod_worker_ptr) xmethod_worker_vec;
167 
168 
169 /* The interface for gdb's own extension(/scripting) language. */
171 
172 extern const struct extension_language_defn *get_ext_lang_defn
173  (enum extension_language lang);
174 
176  (const char *file);
177 
178 extern int ext_lang_present_p (const struct extension_language_defn *);
179 
180 extern int ext_lang_initialized_p (const struct extension_language_defn *);
181 
182 extern void throw_ext_lang_unsupported
183  (const struct extension_language_defn *);
184 
185 /* Accessors for "public" attributes of the extension language definition. */
186 
188  (const struct extension_language_defn *);
189 
190 extern const char *ext_lang_name (const struct extension_language_defn *);
191 
192 extern const char *ext_lang_capitalized_name
193  (const struct extension_language_defn *);
194 
195 extern const char *ext_lang_suffix (const struct extension_language_defn *);
196 
197 extern const char *ext_lang_auto_load_suffix
198  (const struct extension_language_defn *);
199 
201  (const struct extension_language_defn *);
202 
204  (const struct extension_language_defn *);
205 
207  (const struct extension_language_defn *);
208 
209 extern int ext_lang_auto_load_enabled (const struct extension_language_defn *);
210 
211 /* Wrappers for each extension language API function that iterate over all
212  extension languages. */
213 
214 extern void finish_ext_lang_initialization (void);
215 
216 extern void eval_ext_lang_from_control_command (struct command_line *cmd);
217 
218 extern void auto_load_ext_lang_scripts_for_objfile (struct objfile *);
219 
221 
223  struct type *);
224 
226 
228  (struct type *type,
229  LONGEST embedded_offset, CORE_ADDR address,
230  struct ui_file *stream, int recurse,
231  struct value *val, const struct value_print_options *options,
232  const struct language_defn *language);
233 
235  (struct frame_info *frame, int flags, enum ext_lang_frame_args args_type,
236  struct ui_out *out, int frame_low, int frame_high);
237 
238 extern void preserve_ext_lang_values (struct objfile *, htab_t copied_types);
239 
241  (struct breakpoint *b, enum extension_language skip_lang);
242 
243 extern int breakpoint_ext_lang_cond_says_stop (struct breakpoint *);
244 
245 extern struct value *invoke_xmethod (struct xmethod_worker *,
246  struct value *,
247  struct value **, int nargs);
248 
249 extern struct xmethod_worker *clone_xmethod_worker (struct xmethod_worker *);
250 
251 extern struct xmethod_worker *new_xmethod_worker
252  (const struct extension_language_defn *extlang, void *data);
253 
254 extern void free_xmethod_worker (struct xmethod_worker *);
255 
256 extern void free_xmethod_worker_vec (void *vec);
257 
258 extern xmethod_worker_vec *get_matching_xmethod_workers
259  (struct type *, const char *);
260 
261 extern struct type **get_xmethod_arg_types (struct xmethod_worker *, int *);
262 
263 extern struct type *get_xmethod_result_type (struct xmethod_worker *,
264  struct value *object,
265  struct value **args, int nargs);
266 
267 #endif /* EXTENSION_H */
int apply_ext_lang_val_pretty_printer(struct type *type, LONGEST embedded_offset, CORE_ADDR address, struct ui_file *stream, int recurse, struct value *val, const struct value_print_options *options, const struct language_defn *language)
Definition: extension.c:499
frame_filter_flags
Definition: extension.h:90
void throw_ext_lang_unsupported(const struct extension_language_defn *)
Definition: extension.c:194
void preserve_ext_lang_values(struct objfile *, htab_t copied_types)
Definition: extension.c:592
bfd_vma CORE_ADDR
Definition: common-types.h:41
ext_lang_bp_stop
Definition: extension.h:129
const struct extension_language_defn * get_ext_lang_of_file(const char *file)
Definition: extension.c:152
const struct extension_language_defn * extlang
Definition: extension.h:154
void objfile_script_executor_func(const struct extension_language_defn *, struct objfile *, const char *name, const char *script)
Definition: extension.h:54
struct value * invoke_xmethod(struct xmethod_worker *, struct value *, struct value **, int nargs)
Definition: extension.c:998
struct xmethod_worker * clone_xmethod_worker(struct xmethod_worker *)
Definition: extension.c:885
void free_xmethod_worker_vec(void *vec)
Definition: extension.c:1021
struct ext_lang_type_printers * start_ext_lang_type_printers(void)
Definition: extension.c:409
char * apply_ext_lang_type_printers(struct ext_lang_type_printers *, struct type *)
Definition: extension.c:431
int ext_lang_auto_load_enabled(const struct extension_language_defn *)
Definition: extension.c:310
ext_lang_bt_status
Definition: extension.h:69
mach_port_t kern_return_t mach_port_t msgports mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
Definition: gnu-nat.c:1891
const char * ext_lang_capitalized_name(const struct extension_language_defn *)
Definition: extension.c:235
const char *const name
Definition: aarch64-tdep.c:76
extension_language
Definition: extension.h:59
objfile_script_executor_func * ext_lang_objfile_script_executor(const struct extension_language_defn *)
Definition: extension.c:298
void objfile_script_sourcer_func(const struct extension_language_defn *, struct objfile *, FILE *stream, const char *filename)
Definition: extension.h:48
void auto_load_ext_lang_scripts_for_objfile(struct objfile *)
Definition: extension.c:383
int ext_lang_present_p(const struct extension_language_defn *)
Definition: extension.c:170
ext_lang_frame_args
Definition: extension.h:108
const struct extension_language_defn * get_ext_lang_defn(enum extension_language lang)
Definition: extension.c:116
Definition: gdbtypes.h:749
void script_sourcer_func(const struct extension_language_defn *, FILE *stream, const char *filename)
Definition: extension.h:41
void free_ext_lang_type_printers(struct ext_lang_type_printers *)
Definition: extension.c:467
void eval_ext_lang_from_control_command(struct command_line *cmd)
Definition: extension.c:353
struct type ** get_xmethod_arg_types(struct xmethod_worker *, int *)
Definition: extension.c:949
const struct extension_language_defn extension_language_gdb
Definition: extension.c:69
const char * ext_lang_name(const struct extension_language_defn *)
Definition: extension.c:227
void finish_ext_lang_initialization(void)
Definition: extension.c:329
typedef VEC(xmethod_worker_ptr) xmethod_worker_vec
Definition: extension.c:905
enum extension_language ext_lang_kind(const struct extension_language_defn *)
void free_xmethod_worker(struct xmethod_worker *)
Definition: extension.c:1010
const char * ext_lang_suffix(const struct extension_language_defn *)
Definition: extension.c:243
Definition: value.c:169
Definition: ui-out.h:77
DEF_VEC_P(xmethod_worker_ptr)
struct value * value
Definition: extension.h:161
objfile_script_sourcer_func * ext_lang_objfile_script_sourcer(const struct extension_language_defn *)
Definition: extension.c:280
xmethod_worker_vec * get_matching_xmethod_workers(struct type *, const char *)
struct xmethod_worker * xmethod_worker_ptr
Definition: extension.h:164
enum ext_lang_bt_status apply_ext_lang_frame_filter(struct frame_info *frame, int flags, enum ext_lang_frame_args args_type, struct ui_out *out, int frame_low, int frame_high)
Definition: extension.c:556
script_sourcer_func * ext_lang_script_sourcer(const struct extension_language_defn *)
Definition: extension.c:263
const struct extension_language_defn * get_breakpoint_cond_ext_lang(struct breakpoint *b, enum extension_language skip_lang)
Definition: extension.c:614
const char * ext_lang_auto_load_suffix(const struct extension_language_defn *)
Definition: extension.c:251
language
Definition: defs.h:203
int breakpoint_ext_lang_cond_says_stop(struct breakpoint *)
Definition: extension.c:635
struct xmethod_worker * new_xmethod_worker(const struct extension_language_defn *extlang, void *data)
Definition: extension.c:865
struct type * get_xmethod_result_type(struct xmethod_worker *, struct value *object, struct value **args, int nargs)
Definition: extension.c:972
int ext_lang_initialized_p(const struct extension_language_defn *)
Definition: extension.c:179
long long LONGEST
Definition: common-types.h:52