]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/python/python.h
Update Copyright year range in all files maintained by GDB.
[thirdparty/binutils-gdb.git] / gdb / python / python.h
1 /* Python/gdb header for generic use in gdb
2
3 Copyright (C) 2008-2014 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 GDB_PYTHON_H
21 #define GDB_PYTHON_H
22
23 #include "value.h"
24 #include "mi/mi-cmds.h"
25
26 struct gdbpy_breakpoint_object;
27
28 /* The suffix of per-objfile scripts to auto-load.
29 E.g. When the program loads libfoo.so, look for libfoo-gdb.py. */
30 #define GDBPY_AUTO_FILE_NAME "-gdb.py"
31
32 /* Python frame-filter status return values. */
33 enum py_bt_status
34 {
35 /* Return when an error has occurred in processing frame filters,
36 or when printing the stack. */
37 PY_BT_ERROR = -1,
38
39 /* Return from internal routines to indicate that the function
40 succeeded. */
41 PY_BT_OK = 1,
42
43 /* Return when the frame filter process is complete, and all
44 operations have succeeded. */
45 PY_BT_COMPLETED = 2,
46
47 /* Return when the frame filter process is complete, but there
48 were no filter registered and enabled to process. */
49 PY_BT_NO_FILTERS = 3
50 };
51
52 /* Flags to pass to apply_frame_filter. */
53
54 enum frame_filter_flags
55 {
56 /* Set this flag if frame level is to be printed. */
57 PRINT_LEVEL = 1,
58
59 /* Set this flag if frame information is to be printed. */
60 PRINT_FRAME_INFO = 2,
61
62 /* Set this flag if frame arguments are to be printed. */
63 PRINT_ARGS = 4,
64
65 /* Set this flag if frame locals are to be printed. */
66 PRINT_LOCALS = 8,
67 };
68
69 /* A choice of the different frame argument printing strategies that
70 can occur in different cases of frame filter instantiation. */
71 typedef enum py_frame_args
72 {
73 /* Print no values for arguments when invoked from the MI. */
74 NO_VALUES = PRINT_NO_VALUES,
75
76 MI_PRINT_ALL_VALUES = PRINT_ALL_VALUES,
77
78 /* Print only simple values (what MI defines as "simple") for
79 arguments when invoked from the MI. */
80 MI_PRINT_SIMPLE_VALUES = PRINT_SIMPLE_VALUES,
81
82
83 /* Print only scalar values for arguments when invoked from the
84 CLI. */
85 CLI_SCALAR_VALUES,
86
87 /* Print all values for arguments when invoked from the
88 CLI. */
89 CLI_ALL_VALUES
90 } py_frame_args;
91
92 /* Returns true if Python support is built into GDB, false
93 otherwise. */
94
95 static inline int
96 have_python (void)
97 {
98 #ifdef HAVE_PYTHON
99 return 1;
100 #else
101 return 0;
102 #endif
103 }
104
105 extern void finish_python_initialization (void);
106
107 void eval_python_from_control_command (struct command_line *);
108
109 void source_python_script (FILE *file, const char *filename);
110
111 int apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr,
112 int embedded_offset, CORE_ADDR address,
113 struct ui_file *stream, int recurse,
114 const struct value *val,
115 const struct value_print_options *options,
116 const struct language_defn *language);
117
118 enum py_bt_status apply_frame_filter (struct frame_info *frame, int flags,
119 enum py_frame_args args_type,
120 struct ui_out *out, int frame_low,
121 int frame_high);
122
123 void preserve_python_values (struct objfile *objfile, htab_t copied_types);
124
125 const struct script_language *gdbpy_script_language_defn (void);
126
127 int gdbpy_should_stop (struct gdbpy_breakpoint_object *bp_obj);
128
129 int gdbpy_breakpoint_has_py_cond (struct gdbpy_breakpoint_object *bp_obj);
130
131 void *start_type_printers (void);
132
133 char *apply_type_printers (void *, struct type *type);
134
135 void free_type_printers (void *arg);
136
137 #endif /* GDB_PYTHON_H */