57 PyObject *result = PyObject_CallMethod (obj,
"symbol", NULL);
89 PyErr_SetString (PyExc_RuntimeError,
90 _(
"Unexpected value. Expecting a "
91 "gdb.Symbol or a Python string."));
125 PyObject *vresult = PyObject_CallMethod (obj,
"value", NULL);
133 if (vresult == Py_None)
244 int should_print = 0;
245 int local_indent = (4 * indent);
317 PyObject *result = PyObject_CallMethod (filter, func, NULL);
321 if (result == Py_None)
327 PyObject *iterator = PyObject_GetIter (result);
358 const char *sym_name,
363 int print_args_field,
371 if (fa->
val == NULL && fa->
error == NULL)
391 if (print_args_field || args_type !=
NO_VALUES)
407 DMGL_PARAMS | DMGL_ANSI);
414 DMGL_PARAMS | DMGL_ANSI);
432 if (print_args_field)
465 _(
"<error reading variable: %s>"),
500 int print_args_field,
531 item = PyIter_Next (iter);
532 if (item == NULL && PyErr_Occurred ())
543 success =
extract_sym (item, &sym_name, &sym, &language);
578 PyErr_SetString (PyExc_RuntimeError,
579 _(
"No symbol or value provided."));
636 args_type, print_args_field, NULL)
655 args_type, print_args_field,
669 item = PyIter_Next (iter);
684 else if (PyErr_Occurred ())
723 int print_args_field,
732 while ((item = PyIter_Next (iter)))
739 int local_indent = 8 + (8 * indent);
740 struct cleanup *locals_cleanups;
744 success =
extract_sym (item, &sym_name, &sym, &language);
788 if (print_args_field || args_type !=
NO_VALUES)
825 int val_indent = (indent + 1) * 4;
861 if (item == NULL && PyErr_Occurred ())
881 PyObject *locals_iter;
885 if (args_iter == NULL)
889 if (locals_iter == NULL)
895 if (args_iter != Py_None)
900 if (locals_iter != Py_None)
928 if (locals_iter == NULL)
933 if (locals_iter != Py_None)
960 if (args_iter == NULL)
978 if (args_iter != Py_None)
1021 struct ui_out *out,
int indent, htab_t levels_printed)
1027 struct cleanup *cleanup_stack;
1029 PyObject *py_inf_frame;
1043 py_inf_frame = PyObject_CallMethod (filter,
"inferior_frame", NULL);
1044 if (py_inf_frame == NULL)
1066 if (print_locals && print_args && ! print_frame_info)
1078 if (print_frame_info || (print_args && ! print_locals))
1081 if (print_frame_info)
1104 PyObject *paddr = PyObject_CallMethod (filter,
"address", NULL);
1112 if (paddr != Py_None)
1114 address = PyLong_AsLong (paddr);
1123 if ((print_frame_info || print_args) && print_level)
1128 slot = (
struct frame_info **) htab_find_slot (levels_printed,
1159 if (print_frame_info)
1184 PyObject *py_func = PyObject_CallMethod (filter,
"function", NULL);
1185 struct cleanup *py_func_cleanup;
1186 const char *
function = NULL;
1188 if (py_func == NULL)
1197 char *function_to_free;
1199 function = function_to_free =
1202 if (
function == NULL)
1209 else if (PyLong_Check (py_func))
1211 CORE_ADDR addr = PyLong_AsUnsignedLongLong (py_func);
1214 if (PyErr_Occurred ())
1221 if (msymbol.
minsym != NULL)
1224 else if (py_func != Py_None)
1226 PyErr_SetString (PyExc_RuntimeError,
1227 _(
"FrameDecorator.function: expecting a " \
1228 "String, integer or None."));
1236 if (
function == NULL)
1266 if (print_frame_info)
1282 PyObject *py_fn = PyObject_CallMethod (filter,
"filename", NULL);
1283 struct cleanup *py_fn_cleanup;
1292 if (py_fn != Py_None)
1296 if (filename == NULL)
1324 PyObject *py_line = PyObject_CallMethod (filter,
"line", NULL);
1325 struct cleanup *py_line_cleanup;
1328 if (py_line == NULL)
1335 if (py_line != Py_None)
1337 line = PyLong_AsLong (py_line);
1386 struct cleanup *elided_cleanup;
1397 if (elided != Py_None)
1406 while ((item = PyIter_Next (elided)))
1423 if (item == NULL && PyErr_Occurred ())
1441 int frame_low,
int frame_high)
1445 PyObject *module, *sort_func, *iterable, *frame_obj, *iterator;
1446 PyObject *py_frame_low, *py_frame_high;
1449 if (frame_obj == NULL)
1453 module = PyImport_ImportModule (
"gdb.frames");
1459 if (sort_func == NULL)
1463 py_frame_low = PyInt_FromLong (frame_low);
1464 if (py_frame_low == NULL)
1468 py_frame_high = PyInt_FromLong (frame_high);
1469 if (py_frame_high == NULL)
1473 iterable = PyObject_CallFunctionObjArgs (sort_func, frame_obj,
1477 if (iterable == NULL)
1482 if (iterable != Py_None)
1484 iterator = PyObject_GetIter (iterable);
1518 struct ui_out *out,
int frame_low,
int frame_high)
1525 htab_t levels_printed;
1545 if (iterable == NULL)
1569 if (iterable == Py_None)
1575 levels_printed = htab_create (20,
1581 while ((item = PyIter_Next (iterable)))
1596 if (item == NULL && PyErr_Occurred ())
void annotate_frame_function_name(void)
#define PyObject_GetAttrString(obj, attr)
void fprintf_symbol_filtered(struct ui_file *stream, const char *name, enum language lang, int arg_mode)
void annotate_frame_source_file_end(void)
#define SYMBOL_PRINT_NAME(symbol)
void ui_out_wrap_hint(struct ui_out *uiout, char *identstring)
void ui_out_field_stream(struct ui_out *uiout, const char *fldname, struct ui_file *stream)
void ui_out_field_int(struct ui_out *uiout, const char *fldname, int value)
void ui_out_spaces(struct ui_out *uiout, int numspaces)
static PyObject * get_py_iter_from_func(PyObject *filter, char *func)
int gdbpy_is_string(PyObject *obj)
enum ext_lang_bt_status gdbpy_apply_frame_filter(const struct extension_language_defn *extlang, struct frame_info *frame, int flags, enum ext_lang_frame_args args_type, struct ui_out *out, int frame_low, int frame_high)
void annotate_arg_begin(void)
void common_val_print(struct value *val, struct ui_file *stream, int recurse, const struct value_print_options *options, const struct language_defn *language)
#define SYMBOL_CLASS(symbol)
const struct language_defn * language_def(enum language lang)
int ui_out_is_mi_like_p(struct ui_out *uiout)
PyObject * frame_info_to_frame_object(struct frame_info *frame)
void type_print(struct type *type, const char *varstring, struct ui_file *stream, int show)
struct value * read_var_value(struct symbol *var, struct frame_info *frame)
static enum ext_lang_bt_status py_mi_print_variables(PyObject *filter, struct ui_out *out, struct value_print_options *opts, enum ext_lang_frame_args args_type, struct frame_info *frame)
struct symbol * symbol_object_to_symbol(PyObject *obj)
static enum ext_lang_bt_status extract_sym(PyObject *obj, char **name, struct symbol **sym, const struct language_defn **language)
void annotate_arg_value(struct type *type)
void ui_out_field_fmt(struct ui_out *uiout, const char *fldname, const char *format,...)
void ui_out_text(struct ui_out *uiout, const char *string)
static enum ext_lang_bt_status py_print_locals(PyObject *filter, struct ui_out *out, enum ext_lang_frame_args args_type, int indent, struct frame_info *frame)
mach_port_t kern_return_t mach_port_t msgports mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
void null_cleanup(void *arg)
struct cleanup * make_cleanup_py_xdecref(PyObject *py)
#define MSYMBOL_PRINT_NAME(symbol)
static enum ext_lang_bt_status py_print_single_arg(struct ui_out *out, const char *sym_name, struct frame_arg *fa, struct value *fv, const struct value_print_options *opts, enum ext_lang_frame_args args_type, int print_args_field, const struct language_defn *language)
void annotate_frame_address(void)
const char print_entry_values_no[]
void annotate_frame_args(void)
void annotate_frame_source_file(void)
struct type * check_typedef(struct type *type)
#define CATCH(EXCEPTION, MASK)
void ui_out_field_skip(struct ui_out *uiout, const char *fldname)
struct cleanup * make_cleanup_ui_out_list_begin_end(struct ui_out *uiout, const char *id)
struct cleanup * make_cleanup_ui_out_tuple_begin_end(struct ui_out *uiout, const char *id)
static enum ext_lang_bt_status py_print_args(PyObject *filter, struct ui_out *out, enum ext_lang_frame_args args_type, struct frame_info *frame)
const char print_entry_values_compact[]
void fputs_filtered(const char *linebuffer, struct ui_file *stream)
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
char * python_string_to_host_string(PyObject *obj)
static PyObject * bootstrap_python_frame_filters(struct frame_info *frame, int frame_low, int frame_high)
struct cleanup * ensure_python_env(struct gdbarch *gdbarch, const struct language_defn *language)
int gdb_python_initialized
struct ui_file * mem_fileopen(void)
void annotate_frame_begin(int level, struct gdbarch *gdbarch, CORE_ADDR pc)
void read_frame_arg(struct symbol *sym, struct frame_info *frame, struct frame_arg *argp, struct frame_arg *entryargp)
static void print_args(struct field *args, int nargs, int spaces)
const struct language_defn * current_language
const char print_entry_values_only[]
void annotate_arg_end(void)
struct bound_minimal_symbol lookup_minimal_symbol_by_pc(CORE_ADDR pc)
static enum ext_lang_bt_status py_print_frame(PyObject *filter, int flags, enum ext_lang_frame_args args_type, struct ui_out *out, int indent, htab_t levels_printed)
struct cleanup * make_cleanup_ui_file_delete(struct ui_file *arg)
void annotate_frame_end(void)
void gdbpy_convert_exception(struct gdb_exception exception)
int frame_relative_level(struct frame_info *fi)
#define TYPE_CODE(thistype)
void annotate_frame_source_begin(void)
void annotate_frame_address_end(void)
struct minimal_symbol * minsym
void gdbpy_print_stack(void)
void get_user_print_options(struct value_print_options *opts)
struct value * convert_value_from_python(PyObject *obj)
#define SYMBOL_LANGUAGE(symbol)
void annotate_frame_source_line(void)
struct cleanup * make_cleanup_htab_delete(htab_t htab)
static enum ext_lang_bt_status py_print_type(struct ui_out *out, struct value *val)
static int mi_should_print(struct symbol *sym, enum mi_print_types type)
void ui_out_field_core_addr(struct ui_out *uiout, const char *fldname, struct gdbarch *gdbarch, CORE_ADDR address)
void ui_out_field_fmt_int(struct ui_out *uiout, int input_width, enum ui_align input_align, const char *fldname, int value)
struct type * value_type(const struct value *value)
void annotate_arg_name_end(void)
void ui_out_field_string(struct ui_out *uiout, const char *fldname, const char *string)
const struct language_defn * python_language
static enum ext_lang_bt_status extract_value(PyObject *obj, struct value **value)
struct cleanup * make_cleanup_py_decref(PyObject *py)
struct frame_info * frame_object_to_frame_info(PyObject *obj)
void print_frame_info(struct frame_info *, int print_level, enum print_what print_what, int args, int set_current_sal)
static enum ext_lang_bt_status py_print_value(struct ui_out *out, struct value *val, const struct value_print_options *opts, int indent, enum ext_lang_frame_args args_type, const struct language_defn *language)
static enum ext_lang_bt_status enumerate_locals(PyObject *iter, struct ui_out *out, int indent, enum ext_lang_frame_args args_type, int print_args_field, struct frame_info *frame)
void error(const char *fmt,...)
static enum ext_lang_bt_status enumerate_args(PyObject *iter, struct ui_out *out, enum ext_lang_frame_args args_type, int print_args_field, struct frame_info *frame)
struct gdbarch * get_frame_arch(struct frame_info *this_frame)
#define PyObject_HasAttrString(obj, attr)
void do_cleanups(struct cleanup *old_chain)
#define SYMBOL_IS_ARGUMENT(symbol)