1 /* Interface between gdb and its extension languages.
3 Copyright (C) 2014 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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/>. */
23 #include "mi/mi-cmds.h" /* For PRINT_NO_VALUES, etc. */
30 struct extension_language_defn;
35 struct value_print_options;
37 /* A function to load and process a script file.
38 The file has been opened and is ready to be read from the beginning.
39 Any exceptions are not caught, and are passed to the caller. */
40 typedef void script_sourcer_func (const struct extension_language_defn *,
41 FILE *stream, const char *filename);
43 /* A function to load and process a script for an objfile.
44 The file has been opened and is ready to be read from the beginning.
45 Any exceptions are not caught, and are passed to the caller. */
46 typedef void objfile_script_sourcer_func
47 (const struct extension_language_defn *,
48 struct objfile *, FILE *stream, const char *filename);
50 /* Enum of each extension(/scripting) language. */
52 enum extension_language
60 /* Extension language frame-filter status return values. */
62 enum ext_lang_bt_status
64 /* Return when an error has occurred in processing frame filters,
65 or when printing the stack. */
66 EXT_LANG_BT_ERROR = -1,
68 /* Return from internal routines to indicate that the function
72 /* Return when the frame filter process is complete, and all
73 operations have succeeded. */
74 EXT_LANG_BT_COMPLETED = 2,
76 /* Return when the frame filter process is complete, but there
77 were no filter registered and enabled to process. */
78 EXT_LANG_BT_NO_FILTERS = 3
81 /* Flags to pass to apply_extlang_frame_filter. */
83 enum frame_filter_flags
85 /* Set this flag if frame level is to be printed. */
88 /* Set this flag if frame information is to be printed. */
91 /* Set this flag if frame arguments are to be printed. */
94 /* Set this flag if frame locals are to be printed. */
98 /* A choice of the different frame argument printing strategies that
99 can occur in different cases of frame filter instantiation. */
101 enum ext_lang_frame_args
103 /* Print no values for arguments when invoked from the MI. */
104 NO_VALUES = PRINT_NO_VALUES,
106 MI_PRINT_ALL_VALUES = PRINT_ALL_VALUES,
108 /* Print only simple values (what MI defines as "simple") for
109 arguments when invoked from the MI. */
110 MI_PRINT_SIMPLE_VALUES = PRINT_SIMPLE_VALUES,
112 /* Print only scalar values for arguments when invoked from the CLI. */
115 /* Print all values for arguments when invoked from the CLI. */
119 /* The possible results of
120 extension_language_ops.breakpoint_cond_says_stop. */
122 enum ext_lang_bp_stop
124 /* No "stop" condition is set. */
125 EXT_LANG_BP_STOP_UNSET,
127 /* A "stop" condition is set, and it says "don't stop". */
130 /* A "stop" condition is set, and it says "stop". */
134 /* Table of type printers associated with the global typedef table. */
136 struct ext_lang_type_printers
138 /* Type-printers from Python. */
139 void *py_type_printers;
142 /* The interface for gdb's own extension(/scripting) language. */
143 extern const struct extension_language_defn extension_language_gdb;
145 extern const struct extension_language_defn *get_ext_lang_defn
146 (enum extension_language lang);
148 extern const struct extension_language_defn *get_ext_lang_of_file
151 extern int ext_lang_present_p (const struct extension_language_defn *);
153 extern int ext_lang_initialized_p (const struct extension_language_defn *);
155 extern void throw_ext_lang_unsupported
156 (const struct extension_language_defn *);
158 /* Accessors for "public" attributes of the extension language definition. */
160 extern enum extension_language ext_lang_kind
161 (const struct extension_language_defn *);
163 extern const char *ext_lang_name (const struct extension_language_defn *);
165 extern const char *ext_lang_capitalized_name
166 (const struct extension_language_defn *);
168 extern const char *ext_lang_suffix (const struct extension_language_defn *);
170 extern const char *ext_lang_auto_load_suffix
171 (const struct extension_language_defn *);
173 extern script_sourcer_func *ext_lang_script_sourcer
174 (const struct extension_language_defn *);
176 extern objfile_script_sourcer_func *ext_lang_objfile_script_sourcer
177 (const struct extension_language_defn *);
179 extern int ext_lang_auto_load_enabled (const struct extension_language_defn *);
181 /* Wrappers for each extension language API function that iterate over all
182 extension languages. */
184 extern void finish_ext_lang_initialization (void);
186 extern void eval_ext_lang_from_control_command (struct command_line *cmd);
188 extern void auto_load_ext_lang_scripts_for_objfile (struct objfile *);
190 extern struct ext_lang_type_printers *start_ext_lang_type_printers (void);
192 extern char *apply_ext_lang_type_printers (struct ext_lang_type_printers *,
195 extern void free_ext_lang_type_printers (struct ext_lang_type_printers *);
197 extern int apply_ext_lang_val_pretty_printer
198 (struct type *type, const gdb_byte *valaddr,
199 int embedded_offset, CORE_ADDR address,
200 struct ui_file *stream, int recurse,
201 const struct value *val, const struct value_print_options *options,
202 const struct language_defn *language);
204 extern enum ext_lang_bt_status apply_ext_lang_frame_filter
205 (struct frame_info *frame, int flags, enum ext_lang_frame_args args_type,
206 struct ui_out *out, int frame_low, int frame_high);
208 extern void preserve_ext_lang_values (struct objfile *, htab_t copied_types);
210 extern const struct extension_language_defn *get_breakpoint_cond_ext_lang
211 (struct breakpoint *b, enum extension_language skip_lang);
213 extern int breakpoint_ext_lang_cond_says_stop (struct breakpoint *);
215 #endif /* EXTENSION_H */