OLD | NEW |
1 /* Python/gdb header for generic use in gdb | 1 /* Python/gdb header for generic use in gdb |
2 | 2 |
3 Copyright (C) 2008-2012 Free Software Foundation, Inc. | 3 Copyright (C) 2008-2013 Free Software Foundation, Inc. |
4 | 4 |
5 This file is part of GDB. | 5 This file is part of GDB. |
6 | 6 |
7 This program is free software; you can redistribute it and/or modify | 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 | 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 | 9 the Free Software Foundation; either version 3 of the License, or |
10 (at your option) any later version. | 10 (at your option) any later version. |
11 | 11 |
12 This program is distributed in the hope that it will be useful, | 12 This program is distributed in the hope that it will be useful, |
13 but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 GNU General Public License for more details. | 15 GNU General Public License for more details. |
16 | 16 |
17 You should have received a copy of the GNU General Public License | 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/>. */ | 18 along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
19 | 19 |
20 #ifndef GDB_PYTHON_H | 20 #ifndef GDB_PYTHON_H |
21 #define GDB_PYTHON_H | 21 #define GDB_PYTHON_H |
22 | 22 |
23 #include "value.h" | 23 #include "value.h" |
| 24 #include "mi/mi-cmds.h" |
24 | 25 |
25 struct breakpoint_object; | 26 struct gdbpy_breakpoint_object; |
26 | 27 |
27 /* The suffix of per-objfile scripts to auto-load. | 28 /* The suffix of per-objfile scripts to auto-load. |
28 E.g. When the program loads libfoo.so, look for libfoo-gdb.py. */ | 29 E.g. When the program loads libfoo.so, look for libfoo-gdb.py. */ |
29 #define GDBPY_AUTO_FILE_NAME "-gdb.py" | 30 #define GDBPY_AUTO_FILE_NAME "-gdb.py" |
30 | 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 |
31 extern void finish_python_initialization (void); | 92 extern void finish_python_initialization (void); |
32 | 93 |
33 void eval_python_from_control_command (struct command_line *); | 94 void eval_python_from_control_command (struct command_line *); |
34 | 95 |
35 void source_python_script (FILE *file, const char *filename); | 96 void source_python_script (FILE *file, const char *filename); |
36 | 97 |
37 int apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr, | 98 int apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr, |
38 int embedded_offset, CORE_ADDR address, | 99 int embedded_offset, CORE_ADDR address, |
39 struct ui_file *stream, int recurse, | 100 struct ui_file *stream, int recurse, |
40 const struct value *val, | 101 const struct value *val, |
41 const struct value_print_options *options, | 102 const struct value_print_options *options, |
42 const struct language_defn *language); | 103 const struct language_defn *language); |
43 | 104 |
| 105 enum py_bt_status apply_frame_filter (struct frame_info *frame, int flags, |
| 106 enum py_frame_args args_type, |
| 107 struct ui_out *out, int frame_low, |
| 108 int frame_high); |
| 109 |
44 void preserve_python_values (struct objfile *objfile, htab_t copied_types); | 110 void preserve_python_values (struct objfile *objfile, htab_t copied_types); |
45 | 111 |
46 void gdbpy_load_auto_scripts_for_objfile (struct objfile *objfile); | 112 const struct script_language *gdbpy_script_language_defn (void); |
47 | 113 |
48 int gdbpy_should_stop (struct breakpoint_object *bp_obj); | 114 int gdbpy_should_stop (struct gdbpy_breakpoint_object *bp_obj); |
49 | 115 |
50 int gdbpy_breakpoint_has_py_cond (struct breakpoint_object *bp_obj); | 116 int gdbpy_breakpoint_has_py_cond (struct gdbpy_breakpoint_object *bp_obj); |
| 117 |
| 118 void *start_type_printers (void); |
| 119 |
| 120 char *apply_type_printers (void *, struct type *type); |
| 121 |
| 122 void free_type_printers (void *arg); |
51 | 123 |
52 #endif /* GDB_PYTHON_H */ | 124 #endif /* GDB_PYTHON_H */ |
OLD | NEW |