GDB (API)
/home/stan/gdb/src/gdb/python/python.h
Go to the documentation of this file.
00001 /* Python/gdb header for generic use in gdb
00002 
00003    Copyright (C) 2008-2013 Free Software Foundation, Inc.
00004 
00005    This file is part of GDB.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 3 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00019 
00020 #ifndef GDB_PYTHON_H
00021 #define GDB_PYTHON_H
00022 
00023 #include "value.h"
00024 #include "mi/mi-cmds.h"
00025 
00026 struct breakpoint_object;
00027 
00028 /* The suffix of per-objfile scripts to auto-load.
00029    E.g. When the program loads libfoo.so, look for libfoo-gdb.py.  */
00030 #define GDBPY_AUTO_FILE_NAME "-gdb.py"
00031 
00032 /* Python frame-filter status return values.  */
00033 enum py_bt_status
00034   {
00035     /* Return when an error has occurred in processing frame filters,
00036        or when printing the stack.  */
00037     PY_BT_ERROR = -1,
00038 
00039     /* Return from internal routines to indicate that the function
00040        succeeded.  */
00041     PY_BT_OK = 1,
00042 
00043     /* Return when the frame filter process is complete, and all
00044        operations have succeeded.  */
00045     PY_BT_COMPLETED = 2,
00046 
00047     /* Return when the frame filter process is complete, but there
00048        were no filter registered and enabled to process. */
00049     PY_BT_NO_FILTERS = 3
00050   };
00051 
00052 /* Flags to pass to apply_frame_filter.  */
00053 
00054 enum frame_filter_flags
00055   {
00056     /* Set this flag if frame level is to be printed.  */
00057     PRINT_LEVEL = 1,
00058 
00059     /* Set this flag if frame information is to be printed.  */
00060     PRINT_FRAME_INFO = 2,
00061 
00062     /* Set this flag if frame arguments are to be printed.  */
00063     PRINT_ARGS = 4,
00064 
00065     /* Set this flag if frame locals are to be printed.  */
00066     PRINT_LOCALS = 8,
00067   };
00068 
00069 /* A choice of the different frame argument printing strategies that
00070    can occur in different cases of frame filter instantiation.  */
00071 typedef enum py_frame_args
00072 {
00073   /* Print no values for arguments when invoked from the MI. */
00074   NO_VALUES = PRINT_NO_VALUES,
00075 
00076   MI_PRINT_ALL_VALUES = PRINT_ALL_VALUES,
00077 
00078   /* Print only simple values (what MI defines as "simple") for
00079      arguments when invoked from the MI. */
00080   MI_PRINT_SIMPLE_VALUES = PRINT_SIMPLE_VALUES,
00081 
00082 
00083   /* Print only scalar values for arguments when invoked from the
00084      CLI. */
00085   CLI_SCALAR_VALUES,
00086 
00087   /* Print all values for arguments when invoked from the
00088      CLI. */
00089   CLI_ALL_VALUES
00090 } py_frame_args;
00091 
00092 extern void finish_python_initialization (void);
00093 
00094 void eval_python_from_control_command (struct command_line *);
00095 
00096 void source_python_script (FILE *file, const char *filename);
00097 
00098 int apply_val_pretty_printer (struct type *type, const gdb_byte *valaddr,
00099                               int embedded_offset, CORE_ADDR address,
00100                               struct ui_file *stream, int recurse,
00101                               const struct value *val,
00102                               const struct value_print_options *options,
00103                               const struct language_defn *language);
00104 
00105 enum py_bt_status apply_frame_filter (struct frame_info *frame, int flags,
00106                                       enum py_frame_args args_type,
00107                                       struct ui_out *out, int frame_low,
00108                                       int frame_high);
00109 
00110 void preserve_python_values (struct objfile *objfile, htab_t copied_types);
00111 
00112 void gdbpy_load_auto_scripts_for_objfile (struct objfile *objfile);
00113 
00114 int gdbpy_should_stop (struct breakpoint_object *bp_obj);
00115 
00116 int gdbpy_breakpoint_has_py_cond (struct breakpoint_object *bp_obj);
00117 
00118 void *start_type_printers (void);
00119 
00120 char *apply_type_printers (void *, struct type *type);
00121 
00122 void free_type_printers (void *arg);
00123 
00124 #endif /* GDB_PYTHON_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines