1 /* Interface between gdb and its extension languages.
3 Copyright (C) 2013 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
59 /* Extension language frame-filter status return values. */
61 enum ext_lang_bt_status
63 /* Return when an error has occurred in processing frame filters,
64 or when printing the stack. */
65 EXT_LANG_BT_ERROR
= -1,
67 /* Return from internal routines to indicate that the function
71 /* Return when the frame filter process is complete, and all
72 operations have succeeded. */
73 EXT_LANG_BT_COMPLETED
= 2,
75 /* Return when the frame filter process is complete, but there
76 were no filter registered and enabled to process. */
77 EXT_LANG_BT_NO_FILTERS
= 3
80 /* Flags to pass to apply_extlang_frame_filter. */
82 enum frame_filter_flags
84 /* Set this flag if frame level is to be printed. */
87 /* Set this flag if frame information is to be printed. */
90 /* Set this flag if frame arguments are to be printed. */
93 /* Set this flag if frame locals are to be printed. */
97 /* A choice of the different frame argument printing strategies that
98 can occur in different cases of frame filter instantiation. */
100 enum ext_lang_frame_args
102 /* Print no values for arguments when invoked from the MI. */
103 NO_VALUES
= PRINT_NO_VALUES
,
105 MI_PRINT_ALL_VALUES
= PRINT_ALL_VALUES
,
107 /* Print only simple values (what MI defines as "simple") for
108 arguments when invoked from the MI. */
109 MI_PRINT_SIMPLE_VALUES
= PRINT_SIMPLE_VALUES
,
111 /* Print only scalar values for arguments when invoked from the CLI. */
114 /* Print all values for arguments when invoked from the CLI. */
118 /* The possible results of
119 extension_language_ops.breakpoint_cond_says_stop. */
121 enum ext_lang_bp_stop
123 /* No "stop" condition is set. */
124 EXT_LANG_BP_STOP_UNSET
,
126 /* A "stop" condition is set, and it says "don't stop". */
129 /* A "stop" condition is set, and it says "stop". */
133 /* Table of type printers associated with the global typedef table. */
135 struct ext_lang_type_printers
137 /* Type-printers from Python. */
138 void *py_type_printers
;
141 /* The interface for gdb's own extension(/scripting) language. */
142 extern const struct extension_language_defn extension_language_gdb
;
144 extern const struct extension_language_defn
*get_ext_lang_defn
145 (enum extension_language lang
);
147 extern const struct extension_language_defn
*get_ext_lang_of_file
150 extern int ext_lang_present_p (const struct extension_language_defn
*);
152 extern int ext_lang_initialized_p (const struct extension_language_defn
*);
154 extern void throw_ext_lang_unsupported
155 (const struct extension_language_defn
*);
157 /* Accessors for "public" attributes of the extension language definition. */
159 extern enum extension_language ext_lang_kind
160 (const struct extension_language_defn
*);
162 extern const char *ext_lang_name (const struct extension_language_defn
*);
164 extern const char *ext_lang_capitalized_name
165 (const struct extension_language_defn
*);
167 extern const char *ext_lang_suffix (const struct extension_language_defn
*);
169 extern const char *ext_lang_auto_load_suffix
170 (const struct extension_language_defn
*);
172 extern script_sourcer_func
*ext_lang_script_sourcer
173 (const struct extension_language_defn
*);
175 extern objfile_script_sourcer_func
*ext_lang_objfile_script_sourcer
176 (const struct extension_language_defn
*);
178 extern int ext_lang_auto_load_enabled (const struct extension_language_defn
*);
180 /* Wrappers for each extension language API function that iterate over all
181 extension languages. */
183 extern void finish_ext_lang_initialization (void);
185 extern void eval_ext_lang_from_control_command (struct command_line
*cmd
);
187 extern void auto_load_ext_lang_scripts_for_objfile (struct objfile
*);
189 extern struct ext_lang_type_printers
*start_ext_lang_type_printers (void);
191 extern char *apply_ext_lang_type_printers (struct ext_lang_type_printers
*,
194 extern void free_ext_lang_type_printers (struct ext_lang_type_printers
*);
196 extern int apply_ext_lang_val_pretty_printer
197 (struct type
*type
, const gdb_byte
*valaddr
,
198 int embedded_offset
, CORE_ADDR address
,
199 struct ui_file
*stream
, int recurse
,
200 const struct value
*val
, const struct value_print_options
*options
,
201 const struct language_defn
*language
);
203 extern enum ext_lang_bt_status apply_ext_lang_frame_filter
204 (struct frame_info
*frame
, int flags
, enum ext_lang_frame_args args_type
,
205 struct ui_out
*out
, int frame_low
, int frame_high
);
207 extern void preserve_ext_lang_values (struct objfile
*, htab_t copied_types
);
209 extern const struct extension_language_defn
*get_breakpoint_cond_ext_lang
210 (struct breakpoint
*b
, enum extension_language skip_lang
);
212 extern int breakpoint_ext_lang_cond_says_stop (struct breakpoint
*);
214 #endif /* EXTENSION_H */