53 {
"natural",
"binary",
"decimal",
"hexadecimal",
"octal" };
160 struct varobj *,
int,
int);
189 struct value *new_value);
224 #define VAROBJ_TABLE_SIZE 227
274 frame_base &= ((
CORE_ADDR) 1 << addr_bit) - 1;
276 if (frame_base == frame_addr)
294 if (expression != NULL)
359 " as an expression.\n");
365 var->
name = xstrdup (expression);
380 error (
_(
"Failed to find the specified frame"));
407 int real_type_found = 0;
430 if ((var != NULL) && (objname != NULL))
470 unsigned int index = 0;
473 for (chp = objname; *chp; chp++)
478 cv = *(varobj_table + index);
479 while ((cv != NULL) && (strcmp (cv->
var->
obj_name, objname) != 0))
483 error (
_(
"Variable object not found"));
532 *dellist =
xmalloc ((delcount + 1) *
sizeof (
char *));
536 *cp =
cppop (&result);
537 while ((*cp != NULL) && (mycount > 0))
541 *cp =
cppop (&result);
544 if (mycount || (*cp != NULL))
545 warning (
_(
"varobj_delete: assertion failed - mycount(=%d) <> 0"),
559 PyObject *val_obj = NULL;
566 printer = PyObject_CallFunctionObjArgs (constructor, val_obj, NULL);
683 if (*from < 0 || *to < 0)
735 if (!type_updated && changed)
738 else if (!type_updated && unchanged)
774 requested an iterator from a non-dynamic varobj"));
822 for (; to < 0 || i < to + 1; ++i)
837 if (item != NULL && item->
value != NULL)
849 if (to < 0 || i < to)
851 int can_mention = from < 0 || i >=
from;
854 can_mention ? type_changed : NULL,
855 can_mention ? newobj : NULL,
856 can_mention ? unchanged : NULL,
857 can_mention ? cchanged : NULL, i,
917 varobj_list_children (
struct varobj *var,
int *
from,
int *
to)
920 int i, children_changed;
930 &children_changed, 0, 0, *to);
932 return var->children;
940 return var->children;
951 if (existing == NULL)
963 return var->children;
1066 attributes |= 0x00000001;
1099 struct value *val = NULL;
1103 struct expression *exp;
1106 const char *s = expression;
1171 PyObject *visualizer)
1192 if (pretty_printing)
1194 PyObject *pretty_printer = NULL;
1199 if (! pretty_printer)
1202 error (
_(
"Cannot instantiate printer for default visualizer"));
1206 if (pretty_printer == Py_None)
1209 pretty_printer = NULL;
1222 PyObject *pretty_printer;
1228 Py_INCREF (constructor);
1229 if (constructor == Py_None)
1230 pretty_printer = NULL;
1234 if (! pretty_printer)
1238 constructor = Py_None;
1239 Py_INCREF (constructor);
1242 if (pretty_printer == Py_None)
1245 pretty_printer = NULL;
1300 char *curr_type_str, *new_type_str;
1301 int type_name_changed;
1306 type_name_changed = strcmp (curr_type_str, new_type_str) != 0;
1307 xfree (curr_type_str);
1308 xfree (new_type_str);
1310 if (type_name_changed)
1345 int intentionally_not_fetched = 0;
1360 need_to_fetch = changeable;
1384 if (need_to_fetch && value &&
value_lazy (value))
1390 frozen |= parent->frozen;
1392 if (frozen && initial)
1398 intentionally_not_fetched = 1;
1435 if (!initial && changeable)
1459 else if (var->
value == NULL && value == NULL)
1462 else if (var->
value == NULL || value == NULL)
1478 if (!initial && !changeable)
1484 changed = (var->
value != NULL) != (value != NULL);
1488 if (var->
value != NULL && var->
value != value)
1491 if (value &&
value_lazy (value) && intentionally_not_fetched)
1503 xfree (print_value);
1506 if ((var->
print_value == NULL && print_value != NULL)
1507 || (var->
print_value != NULL && print_value == NULL)
1508 || (var->
print_value != NULL && print_value != NULL
1546 PyObject *mainmod, *globals, *constructor;
1554 mainmod = PyImport_AddModule (
"__main__");
1555 globals = PyModule_GetDict (mainmod);
1556 Py_INCREF (globals);
1559 constructor = PyRun_String (visualizer, Py_eval_input, globals, globals);
1564 error (
_(
"Could not evaluate visualizer expression: %s"), visualizer);
1568 Py_XDECREF (constructor);
1576 error (
_(
"Python support required"));
1605 if (new_value != NULL)
1631 int type_changed = 0;
1633 struct value *newobj;
1642 if (!is_explicit && (*varp)->frozen)
1645 if (!(*varp)->root->is_valid)
1655 if ((*varp)->root->rootvar == *varp)
1741 VEC (
varobj_p) *changed = 0, *type_changed = 0, *unchanged = 0;
1743 int i, children_changed = 0;
1775 &unchanged, &children_changed, 1,
1778 if (children_changed || newobj)
1844 if (c != NULL && !c->
frozen)
1871 int only_children_p)
1876 only_children_p, 1 );
1887 struct varobj *var,
int only_children_p,
1888 int remove_from_parent_p)
1899 if (!remove_from_parent_p)
1906 if (only_children_p)
1915 *delcountp = *delcountp + 1;
1923 if ((remove_from_parent_p) && (var->
parent != NULL))
1940 struct vlist *newvl;
1942 unsigned int index = 0;
1945 for (chp = var->
obj_name; *chp; chp++)
1950 cv = *(varobj_table + index);
1955 error (
_(
"Duplicate variable object name"));
1959 newvl->
next = *(varobj_table + index);
1961 *(varobj_table + index) = newvl;
1967 if (rootlist == NULL)
1971 rootlist = var->
root;
1986 unsigned int index = 0;
1990 for (chp = var->
obj_name; *chp; chp++)
1995 cv = *(varobj_table + index);
2009 (
"Assertion failed: Could not find variable object \"%s\" to delete",
2015 *(varobj_table + index) = cv->
next;
2025 if (rootlist == var->
root)
2031 while ((cr != NULL) && (cr->
rootvar != var))
2038 warning (
_(
"Assertion failed: Could not find "
2039 "varobj \"%s\" in root list"),
2092 if (item->
value != NULL)
2125 var->children = NULL;
2267 if ((*pstack)->name == NULL && (*pstack)->next == NULL)
2272 *pstack = (*pstack)->
next;
2338 static struct value *
2341 struct value *new_val = NULL;
2342 struct varobj *var = *var_handle;
2343 int within_scope = 0;
2403 static struct value *
2408 if (var_handle == NULL)
2426 if (tmp_var == NULL)
2432 if (strcmp (old_type, new_type) == 0)
2452 tmp_var->
to = var->
to;
2456 *var_handle = tmp_var;
2472 if (var->
value == NULL || value == NULL)
2493 static struct value *
2529 const struct varobj *var)
2533 char *thevalue = NULL;
2541 int string_print = 0;
2557 if (value_formatter)
2564 return xstrdup (
"{...}");
2569 struct value *replacement;
2570 PyObject *output = NULL;
2608 if (!strcmp (hint,
"string"))
2614 thevalue = xmemdup (s, len + 1, len + 1);
2634 value = replacement;
2645 else if (string_print)
2741 for (var_root = rootlist; var_root != NULL; var_root = var_root_next)
2743 var_root_next = var_root->
next;
2745 (*func) (var_root->
rootvar, data);
2768 if (tmp_var != NULL)
2797 varobj_table =
xmalloc (sizeof_table);
2798 memset (varobj_table, 0, sizeof_table);
2802 _(
"Set varobj debugging."),
2803 _(
"Show varobj debugging."),
2804 _(
"When non-zero, varobj debugging is enabled."),
int frame_id_p(struct frame_id l)
struct frame_info * frame_find_by_id(struct frame_id id)
int varobj_delete(struct varobj *var, char ***dellist, int only_children)
int varobj_get_frozen(const struct varobj *var)
union exp_element elts[1]
char * gdbpy_get_display_hint(PyObject *printer)
void all_root_varobjs(void(*func)(struct varobj *var, void *data), void *data)
static struct value * value_of_root_1(struct varobj **var_handle)
struct frame_info * get_selected_frame(const char *message)
#define VEC_replace(T, V, I, O)
CORE_ADDR get_frame_pc(struct frame_info *frame)
void add_setshow_zuinteger_cmd(const char *name, enum command_class theclass, unsigned int *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
char *(* value_of_variable)(const struct varobj *var, enum varobj_display_formats format)
struct frame_info * get_current_frame(void)
PyObject * pretty_printer
int varobj_default_value_is_changeable_p(const struct varobj *var)
char * varobj_gen_name(void)
struct frame_info * get_prev_frame(struct frame_info *this_frame)
void warning(const char *fmt,...)
static void install_default_visualizer(struct varobj *var)
int varobj_is_anonymous_child(const struct varobj *child)
void value_incref(struct value *val)
char * ui_file_xstrdup(struct ui_file *file, long *length)
static void uninstall_variable(struct varobj *)
void get_formatted_print_options(struct value_print_options *opts, char format)
const struct builtin_type * builtin_type(struct gdbarch *gdbarch)
void common_val_print(struct value *val, struct ui_file *stream, int recurse, const struct value_print_options *options, const struct language_defn *language)
PyObject * gdbpy_to_string_cst
enum varobj_display_formats varobj_set_display_format(struct varobj *var, enum varobj_display_formats format)
char * varobj_get_formatted_value(struct varobj *var, enum varobj_display_formats format)
void select_frame(struct frame_info *fi)
static void delete_variable_1(struct cpstack **, int *, struct varobj *, int, int)
const struct frame_id null_frame_id
const struct language_defn * language_defn
void varobj_set_child_range(struct varobj *var, int from, int to)
PyObject * apply_varobj_pretty_printer(PyObject *printer_obj, struct value **replacement, struct ui_file *stream)
const struct lang_varobj_ops * lang_ops
void switch_to_thread(ptid_t ptid)
static void install_visualizer(struct varobj_dynamic *var, PyObject *constructor, PyObject *visualizer)
struct value * coerce_ref(struct value *arg)
void value_free(struct value *val)
static char * cppop(struct cpstack **pstack)
static struct varobj * new_root_variable(void)
const struct block * innermost_block
#define CPLUS_FAKE_CHILD(x)
int(* is_path_expr_parent)(const struct varobj *var)
#define VEC_safe_push(T, V, O)
struct varobj_root * next
void varobj_set_visualizer(struct varobj *var, const char *visualizer)
char *(* path_expr_of_child)(const struct varobj *child)
void varobj_invalidate(void)
char * python_string_to_target_string(PyObject *obj)
void varobj_restrict_range(VEC(varobj_p)*children, int *from, int *to)
static int is_path_expr_parent(const struct varobj *var)
static int install_new_value(struct varobj *var, struct value *value, int initial)
char *(* name_of_child)(const struct varobj *parent, int index)
static void do_free_variable_cleanup(void *var)
static struct varobj_iter * varobj_get_iterator(struct varobj *var)
static struct type * new_type(char *)
int(* value_has_mutated)(const struct varobj *var, struct value *new_value, struct type *new_type)
static int varobj_value_has_mutated(const struct varobj *var, struct value *new_value, struct type *new_type)
const struct varobj * parent
struct value * evaluate_expression(struct expression *exp)
int in_thread_list(ptid_t ptid)
int(* number_of_children)(const struct varobj *parent)
static PyObject * instantiate_pretty_printer(PyObject *constructor, struct value *value)
static int number_of_children(const struct varobj *)
int varobj_get_thread_id(const struct varobj *var)
struct value *(* value_of_child)(const struct varobj *parent, int index)
static void varobj_clear_saved_item(struct varobj_dynamic *var)
struct frame_id get_frame_id(struct frame_info *fi)
struct type * check_typedef(struct type *type)
enum varobj_scope_status status
struct varobj_iter * child_iter
ptid_t thread_id_to_pid(int)
#define CATCH(EXCEPTION, MASK)
const struct language_defn * varobj_get_language(const struct varobj *var)
static struct value * value_of_root(struct varobj **var_handle, int *)
void print_value(struct value *val, const struct format_data *fmtp)
void varobj_formatted_print_options(struct value_print_options *opts, enum varobj_display_formats format)
int varobj_default_is_path_expr_parent(const struct varobj *var)
int value_lazy(struct value *value)
static enum varobj_display_formats variable_default_display(struct varobj *)
static void install_dynamic_child(struct varobj *var, VEC(varobj_p)**changed, VEC(varobj_p)**type_changed, VEC(varobj_p)**newobj, VEC(varobj_p)**unchanged, int *cchanged, int index, struct varobj_item *item)
void fprintf_filtered(struct ui_file *stream, const char *format,...)
#define VAROBJ_TABLE_SIZE
char * varobj_get_type(struct varobj *var)
const struct block * get_frame_block(struct frame_info *frame, CORE_ADDR *addr_in_block)
const struct lang_varobj_ops * la_varobj_ops
struct varobj_iter * py_varobj_get_iterator(struct varobj *var, PyObject *printer)
#define varobj_iter_delete(ITER)
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
static int pretty_printing
struct expression * parse_exp_1(const char **, CORE_ADDR pc, const struct block *, int)
#define gdb_assert_not_reached(message)
void free_current_contents(void *ptr)
static struct frame_info * find_frame_addr_in_frame_chain(CORE_ADDR frame_addr)
static int dynamic_varobj_has_child_method(const struct varobj *var)
struct cleanup * make_cleanup(make_cleanup_ftype *function, void *arg)
static char * name_of_child(struct varobj *, int)
static void varobj_invalidate_iter(struct varobj *var, void *unused)
static struct varobj * varobj_add_child(struct varobj *var, struct varobj_item *item)
#define VEC_index(T, V, I)
char * varobj_format_string[]
struct gdbarch * get_type_arch(const struct type *type)
struct value * coerce_array(struct value *arg)
int varobj_value_is_changeable_p(const struct varobj *var)
struct value * value_assign(struct value *toval, struct value *fromval)
struct cleanup * ensure_python_env(struct gdbarch *gdbarch, const struct language_defn *language)
char * varobj_get_expression(const struct varobj *var)
PyObject * value_to_value_object(struct value *val)
struct value * value_cast(struct type *type, struct value *arg2)
int varobj_has_more(const struct varobj *var, int to)
int gdb_python_initialized
int gdbarch_addr_bit(struct gdbarch *gdbarch)
static char * my_value_of_variable(struct varobj *var, enum varobj_display_formats format)
struct varobj_dynamic * dynamic
char * xstrprintf(const char *format,...)
struct cmd_list_element * setdebuglist
static struct varobj * create_child(struct varobj *, int, char *)
struct varobj * varobj_create(char *objname, char *expression, CORE_ADDR frame, enum varobj_type type)
struct ui_file * gdb_stdlog
struct ui_file * mem_fileopen(void)
struct varobj_root * root
static int check_scope(const struct varobj *var)
CORE_ADDR get_frame_base_address(struct frame_info *fi)
struct type * get_target_type(struct type *type)
static struct varobj * create_child_with_value(struct varobj *parent, int index, struct varobj_item *item)
#define VEC_truncate(T, V, I)
char *(* name_of_variable)(const struct varobj *parent)
const char const char int
void release_value_or_incref(struct value *val)
enum varobj_display_formats varobj_get_display_format(const struct varobj *var)
void discard_cleanups(struct cleanup *old_chain)
struct type * builtin_char
void varobj_enable_pretty_printing(void)
int varobj_is_dynamic_p(const struct varobj *var)
const struct language_defn * current_language
PyObject * gdbpy_children_cst
void _initialize_varobj(void)
void value_fetch_lazy(struct value *val)
struct cleanup * make_cleanup_ui_file_delete(struct ui_file *arg)
#define TYPE_CODE(thistype)
int(* value_is_changeable_p)(const struct varobj *var)
static void cppush(struct cpstack **pstack, char *name)
struct varobj * varobj_get_handle(char *objname)
struct ui_file * gdb_stderr
static void free_variable(struct varobj *var)
static struct value * value_of_child(const struct varobj *parent, int index)
const struct block * valid_block
static char * name_of_variable(const struct varobj *)
int varobj_get_num_children(struct varobj *var)
struct cleanup * make_cleanup_restore_current_thread(void)
static void install_new_value_visualizer(struct varobj *var)
int varobj_set_value(struct varobj *var, char *expression)
void gdbpy_print_stack(void)
void get_user_print_options(struct value_print_options *opts)
char * varobj_get_value(struct varobj *var)
static int is_root_p(const struct varobj *var)
char * varobj_value_get_print_value(struct value *value, enum varobj_display_formats format, const struct varobj *var)
static int update_dynamic_varobj_children(struct varobj *var, VEC(varobj_p)**changed, VEC(varobj_p)**type_changed, VEC(varobj_p)**newobj, VEC(varobj_p)**unchanged, int *cchanged, int update_children, int from, int to)
int gdbpy_is_lazy_string(PyObject *result)
static struct cleanup * make_cleanup_free_variable(struct varobj *var)
char * varobj_get_objname(const struct varobj *var)
struct type * varobj_get_gdb_type(const struct varobj *var)
#define varobj_iter_next(ITER)
int pid_to_thread_id(ptid_t ptid)
static struct vlist ** varobj_table
struct type * value_type(const struct value *value)
char * varobj_get_path_expr(const struct varobj *var)
struct cmd_list_element * showdebuglist
struct value * evaluate_type(struct expression *exp)
struct type *(* type_of_child)(const struct varobj *parent, int index)
#define LA_PRINT_STRING(stream, elttype, string, length, encoding, force_ellipses, options)
struct type * varobj_get_value_type(const struct varobj *var)
struct cleanup * varobj_ensure_python_env(const struct varobj *var)
static int update_type_if_necessary(struct varobj *var, struct value *new_value)
char * varobj_get_display_hint(const struct varobj *var)
int val_print_string(struct type *elttype, const char *encoding, CORE_ADDR addr, int len, struct ui_file *stream, const struct value_print_options *options)
struct cleanup * make_cleanup_py_decref(PyObject *py)
static int install_variable(struct varobj *)
void gdbpy_extract_lazy_string(PyObject *string, CORE_ADDR *addr, struct type **str_type, long *length, char **encoding)
void varobj_get_child_range(const struct varobj *var, int *from, int *to)
static struct varobj * new_variable(void)
char * type_to_string(struct type *type)
const struct varobj * varobj_get_path_expr_parent(const struct varobj *var)
PyObject * gdbpy_get_varobj_pretty_printer(struct value *value)
enum varobj_display_formats format
int varobj_floating_p(const struct varobj *var)
int has_stack_frames(void)
int varobj_get_attributes(const struct varobj *var)
struct type * value_actual_type(struct value *value, int resolve_simple_types, int *real_type_found)
void error(const char *fmt,...)
struct gdbarch * get_frame_arch(struct frame_info *this_frame)
static void construct_visualizer(struct varobj *var, PyObject *constructor)
int varobj_editable_p(const struct varobj *var)
static void show_varobjdebug(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
void do_cleanups(struct cleanup *old_chain)
void varobj_set_frozen(struct varobj *var, int frozen)
static struct varobj_root * rootlist
const ULONGEST const LONGEST len
static int delete_variable(struct cpstack **, struct varobj *, int)