54 {
"natural",
"binary",
"decimal",
"hexadecimal",
"octal",
"zero-hexadecimal" };
170 struct value *new_value);
205 #define VAROBJ_TABLE_SIZE 227 302 var->root->floating =
true;
328 if (var->root->exp->elts[0].opcode == OP_TYPE
329 || var->root->exp->elts[0].opcode == OP_TYPEOF
330 || var->root->exp->elts[0].opcode == OP_DECLTYPE)
333 " as an expression.\n");
354 error (
_(
"Failed to find the specified frame"));
381 int real_type_found = 0;
389 var->root->lang_ops = var->root->exp->language_defn->la_varobj_ops;
394 var->root->rootvar = var.get ();
404 if ((var != NULL) && (objname != NULL))
406 var->obj_name = objname;
414 return var.release ();
437 unsigned int index = 0;
440 for (chp = objname; *chp; chp++)
450 error (
_(
"Variable object not found"));
487 PyObject *val_obj = NULL;
494 printer = PyObject_CallFunctionObjArgs (constructor, val_obj, NULL);
609 int len = children.size ();
611 if (*from < 0 || *to < 0)
632 std::vector<varobj *> *changed,
633 std::vector<varobj *> *type_changed,
634 std::vector<varobj *> *newobj,
635 std::vector<varobj *> *unchanged,
647 newobj->push_back (child);
658 if (type_changed != NULL)
659 type_changed->push_back (existing);
663 if (!type_updated && changed != NULL)
664 changed->push_back (existing);
666 else if (!type_updated && unchanged != NULL)
667 unchanged->push_back (existing);
698 requested an iterator from a non-dynamic varobj"));
706 if (
var->saved_item != NULL)
709 delete var->saved_item;
710 var->saved_item = NULL;
716 std::vector<varobj *> *changed,
717 std::vector<varobj *> *type_changed,
718 std::vector<varobj *> *newobj,
719 std::vector<varobj *> *unchanged,
721 bool update_children,
746 for (; to < 0 || i < to + 1; ++i)
761 if (item != NULL && item->
value != NULL)
773 if (to < 0 || i < to)
775 bool can_mention = from < 0 || i >= from;
778 can_mention ? type_changed : NULL,
779 can_mention ? newobj : NULL,
780 can_mention ? unchanged : NULL,
781 can_mention ? cchanged : NULL, i,
796 if (i < var->children.size ())
839 const std::vector<varobj *> &
846 bool children_changed;
852 &children_changed,
false, 0, *to);
975 return var->
root->
exp->language_defn;
985 attributes |= 0x00000001;
1018 struct value *val = NULL;
1088 PyObject *visualizer)
1111 PyObject *pretty_printer = NULL;
1116 if (! pretty_printer)
1119 error (
_(
"Cannot instantiate printer for default visualizer"));
1123 if (pretty_printer == Py_None)
1126 pretty_printer = NULL;
1139 PyObject *pretty_printer;
1145 Py_INCREF (constructor);
1146 if (constructor == Py_None)
1147 pretty_printer = NULL;
1151 if (! pretty_printer)
1155 constructor = Py_None;
1156 Py_INCREF (constructor);
1159 if (pretty_printer == Py_None)
1162 pretty_printer = NULL;
1217 if (curr_type_str != new_type_str)
1251 bool changed =
false;
1252 bool intentionally_not_fetched =
false;
1266 need_to_fetch = changeable;
1284 need_to_fetch =
true;
1304 intentionally_not_fetched =
true;
1342 if (!initial && changeable)
1364 else if (var->
value == NULL &&
value == NULL)
1367 else if (var->
value == NULL ||
value == NULL)
1383 if (!initial && !changeable)
1389 changed = (var->
value != NULL) != (
value != NULL);
1455 mainmod = PyImport_AddModule (
"__main__");
1457 Py_INCREF (globals.
get ());
1459 gdbpy_ref<> constructor (PyRun_String (visualizer, Py_eval_input,
1460 globals.
get (), globals.
get ()));
1462 if (constructor == NULL)
1465 error (
_(
"Could not evaluate visualizer expression: %s"), visualizer);
1474 error (
_(
"Python support required"));
1503 if (new_value != NULL)
1526 std::vector<varobj_update_result>
1529 bool type_changed =
false;
1530 struct value *newobj;
1531 std::vector<varobj_update_result>
stack;
1532 std::vector<varobj_update_result> result;
1539 if (!is_explicit && (*varp)->frozen)
1542 if (!(*varp)->root->is_valid)
1548 if ((*varp)->root->rootvar == *varp)
1559 type_changed =
true;
1572 result.push_back (std::move (r));
1577 stack.push_back (std::move (r));
1580 stack.emplace_back (*varp);
1583 while (!
stack.empty ())
1626 std::vector<varobj *> changed, type_changed, unchanged, newobj;
1627 bool children_changed =
false;
1645 &
dummy,
false, 0, 0);
1651 result.push_back (std::move (r));
1659 &unchanged, &children_changed,
true,
1662 if (children_changed || !newobj.empty ())
1665 r.
newobj = std::move (newobj);
1671 for (
int i = type_changed.size () - 1; i >= 0; --i)
1680 stack.push_back (std::move (r));
1682 for (
int i = changed.size () - 1; i >= 0; --i)
1689 stack.push_back (std::move (r));
1691 for (
int i = unchanged.size () - 1; i >= 0; --i)
1693 if (!unchanged[i]->frozen)
1699 stack.push_back (std::move (r));
1703 result.push_back (std::move (r));
1713 for (
int i = v->
children.size () - 1; i >= 0; --i)
1718 if (c != NULL && !c->
frozen)
1719 stack.emplace_back (c);
1723 result.push_back (std::move (r));
1752 bool remove_from_parent_p)
1760 if (!remove_from_parent_p)
1768 if (only_children_p)
1776 *delcountp = *delcountp + 1;
1784 if ((remove_from_parent_p) && (var->
parent != NULL))
1799 struct vlist *newvl;
1801 unsigned int index = 0;
1814 error (
_(
"Duplicate variable object name"));
1845 unsigned int index = 0;
1849 for (chp = var->
obj_name.c_str (); *chp; chp++)
1868 (
"Assertion failed: Could not find variable object \"%s\" to delete",
1890 while ((cr != NULL) && (cr->
rootvar != var))
1897 warning (
_(
"Assertion failed: Could not find " 1898 "varobj \"%s\" in root list"),
1933 std::swap (child->
name, item->
name);
1943 child->
name.c_str ());
1949 if (item->
value != NULL)
2098 static struct value *
2101 struct value *new_val = NULL;
2102 struct varobj *var = *var_handle;
2103 bool within_scope =
false;
2114 within_scope =
true;
2161 static struct value *
2166 if (var_handle == NULL)
2183 if (tmp_var == NULL)
2206 tmp_var->
to = var->
to;
2210 *var_handle = tmp_var;
2212 *type_changed =
true;
2238 *type_changed =
true;
2245 static struct value *
2281 const struct varobj *var)
2289 bool string_print =
false;
2304 if (value_formatter)
2313 struct value *replacement;
2328 &
type, &len, &encoding);
2329 string_print =
true;
2350 if (!strcmp (hint.get (),
"string"))
2351 string_print =
true;
2355 len = thevalue.size ();
2370 value = replacement;
2379 if (!thevalue.empty ())
2381 len, encoding.get (), 0, &opts);
2382 else if (string_print)
2390 return std::move (stb.string ());
2475 for (var_root =
rootlist; var_root != NULL; var_root = var_root_next)
2477 var_root_next = var_root->
next;
2479 (*func) (var_root->
rootvar, data);
2502 if (tmp_var != NULL)
2532 _(
"Set varobj debugging."),
2533 _(
"Show varobj debugging."),
2534 _(
"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)
struct varobj * varobj_get_handle(const char *objname)
void all_root_varobjs(void(*func)(struct varobj *var, void *data), void *data)
static bool is_root_p(const struct varobj *var)
static void install_dynamic_child(struct varobj *var, std::vector< varobj *> *changed, std::vector< varobj *> *type_changed, std::vector< varobj *> *newobj, std::vector< varobj *> *unchanged, bool *cchanged, int index, struct varobj_item *item)
static struct value * value_of_root_1(struct varobj **var_handle)
struct frame_info * get_selected_frame(const char *message)
CORE_ADDR get_frame_pc(struct frame_info *frame)
struct frame_info * get_current_frame(void)
PyObject * pretty_printer
std::string(* name_of_variable)(const struct varobj *parent)
bool varobj_set_value(struct varobj *var, const char *expression)
gdb::unique_xmalloc_ptr< expression > expression_up
struct frame_info * get_prev_frame(struct frame_info *this_frame)
bool(* value_has_mutated)(const struct varobj *var, struct value *new_value, struct type *new_type)
const char * varobj_get_objname(const struct varobj *var)
void warning(const char *fmt,...)
std::string varobj_gen_name(void)
static struct value * value_of_root(struct varobj **var_handle, bool *)
enum varobj_scope_status status
static void install_default_visualizer(struct varobj *var)
void value_incref(struct value *val)
static struct varobj * create_child(struct varobj *, int, std::string &)
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)
static void delete_variable_1(int *, struct varobj *, bool, bool)
void select_frame(struct frame_info *fi)
const struct frame_id null_frame_id
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
static void install_visualizer(struct varobj_dynamic *var, PyObject *constructor, PyObject *visualizer)
int value_lazy(const struct value *value)
struct value * coerce_ref(struct value *arg)
void value_free(struct value *val)
expression_up parse_exp_1(const char **, CORE_ADDR pc, const struct block *, int)
const struct block * innermost_block
#define CPLUS_FAKE_CHILD(x)
struct varobj_root * next
void varobj_set_visualizer(struct varobj *var, const char *visualizer)
std::string varobj_get_type(struct varobj *var)
static std::string name_of_child(struct varobj *, int)
void varobj_invalidate(void)
static bool install_new_value(struct varobj *var, struct value *value, bool initial)
static bool is_path_expr_parent(const struct varobj *var)
bool(* is_path_expr_parent)(const struct varobj *var)
bool varobj_default_value_is_changeable_p(const struct varobj *var)
static struct varobj_iter * varobj_get_iterator(struct varobj *var)
static struct type * new_type(char *)
static bool update_dynamic_varobj_children(struct varobj *var, std::vector< varobj *> *changed, std::vector< varobj *> *type_changed, std::vector< varobj *> *newobj, std::vector< varobj *> *unchanged, bool *cchanged, bool update_children, int from, int to)
#define TYPE_IS_REFERENCE(t)
const std::vector< varobj * > & varobj_list_children(struct varobj *var, int *from, int *to)
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_const_sfunc_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
struct value * evaluate_expression(struct expression *exp)
int(* number_of_children)(const struct varobj *parent)
gdbpy_enter_varobj(const struct varobj *var)
static PyObject * instantiate_pretty_printer(PyObject *constructor, struct value *value)
void switch_to_thread(ptid_t ptid)
static int number_of_children(const struct varobj *)
int varobj_get_thread_id(const struct varobj *var)
static void varobj_clear_saved_item(struct varobj_dynamic *var)
bool varobj_has_more(const struct varobj *var, int to)
struct frame_id get_frame_id(struct frame_info *fi)
struct type * check_typedef(struct type *type)
struct varobj_iter * child_iter
#define CATCH(EXCEPTION, MASK)
const struct language_defn * varobj_get_language(const struct varobj *var)
static bool install_variable(struct varobj *)
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)
std::unique_ptr< T, xfree_deleter< T > > unique_xmalloc_ptr
void varobj_set_frozen(struct varobj *var, bool frozen)
static enum varobj_display_formats variable_default_display(struct varobj *)
void fprintf_filtered(struct ui_file *stream, const char *format,...)
#define VAROBJ_TABLE_SIZE
const char * varobj_format_string[]
const struct block * get_frame_block(struct frame_info *frame, CORE_ADDR *addr_in_block)
struct varobj_iter * py_varobj_get_iterator(struct varobj *var, PyObject *printer)
std::string varobj_get_expression(const struct varobj *var)
static bool varobj_value_has_mutated(const struct varobj *var, struct value *new_value, struct type *new_type)
void fprintf_unfiltered(struct ui_file *stream, const char *format,...)
#define varobj_iter_delete(ITER)
#define gdb_assert_not_reached(message)
gdb::unique_xmalloc_ptr< char > varobj_get_display_hint(const struct varobj *var)
static struct frame_info * find_frame_addr_in_frame_chain(CORE_ADDR frame_addr)
bool varobj_is_anonymous_child(const struct varobj *child)
bool varobj_get_frozen(const struct varobj *var)
int varobj_delete(struct varobj *var, bool only_children)
static void varobj_invalidate_iter(struct varobj *var, void *unused)
int ptid_to_global_thread_id(ptid_t ptid)
static struct varobj * varobj_add_child(struct varobj *var, struct varobj_item *item)
struct gdbarch * get_type_arch(const struct type *type)
struct value * coerce_array(struct value *arg)
struct value * value_assign(struct value *toval, struct value *fromval)
std::vector< struct varobj * > newobj
PyObject * value_to_value_object(struct value *val)
struct value * value_cast(struct type *type, struct value *arg2)
int gdb_python_initialized
int gdbarch_addr_bit(struct gdbarch *gdbarch)
struct varobj_dynamic * dynamic
std::string varobj_get_value(struct varobj *var)
bool varobj_value_is_changeable_p(const struct varobj *var)
struct cmd_list_element * setdebuglist
std::string(* name_of_child)(const struct varobj *parent, int index)
struct varobj_root * root
void varobj_restrict_range(const std::vector< varobj *> &children, int *from, int *to)
std::string(* value_of_variable)(const struct varobj *var, enum varobj_display_formats format)
bool varobj_editable_p(const struct varobj *var)
std::vector< varobj_update_result > varobj_update(struct varobj **varp, bool is_explicit)
ptid_t global_thread_id_to_ptid(int num)
static bool dynamic_varobj_has_child_method(const struct varobj *var)
CORE_ADDR get_frame_base_address(struct frame_info *fi)
struct type * get_target_type(struct type *type)
static int delete_variable(struct varobj *, bool)
static struct varobj * create_child_with_value(struct varobj *parent, int index, struct varobj_item *item)
std::string varobj_get_formatted_value(struct varobj *var, enum varobj_display_formats format)
void release_value_or_incref(struct value *val)
enum varobj_display_formats varobj_get_display_format(const struct varobj *var)
varobj(varobj_root *root_)
void gdbpy_extract_lazy_string(PyObject *string, CORE_ADDR *addr, struct type **str_elt_type, long *length, gdb::unique_xmalloc_ptr< char > *encoding)
struct type * builtin_char
void varobj_enable_pretty_printing(void)
const struct language_defn * current_language
PyObject * gdbpy_children_cst
void _initialize_varobj(void)
void value_fetch_lazy(struct value *val)
#define TYPE_CODE(thistype)
gdb::unique_xmalloc_ptr< char > gdbpy_get_display_hint(PyObject *printer)
bool(* value_is_changeable_p)(const struct varobj *var)
static struct value * value_of_child(const struct varobj *parent, int index)
const struct block * valid_block
std::vector< varobj * > children
int varobj_get_num_children(struct varobj *var)
static void install_new_value_visualizer(struct varobj *var)
void gdbpy_print_stack(void)
void get_user_print_options(struct value_print_options *opts)
std::string varobj_value_get_print_value(struct value *value, enum varobj_display_formats format, const struct varobj *var)
bool varobj_default_is_path_expr_parent(const struct varobj *var)
int gdbpy_is_lazy_string(PyObject *result)
bool varobj_floating_p(const struct varobj *var)
std::string string_printf(const char *fmt,...)
static bool pretty_printing
static std::string my_value_of_variable(struct varobj *var, enum varobj_display_formats format)
int ptid_equal(const ptid_t &ptid1, const ptid_t &ptid2)
struct type * varobj_get_gdb_type(const struct varobj *var)
#define varobj_iter_next(ITER)
static std::string name_of_variable(const struct varobj *)
static struct vlist ** varobj_table
bool varobj_is_dynamic_p(const struct varobj *var)
struct type * value_type(const struct value *value)
struct varobj * varobj_create(const char *objname, const char *expression, CORE_ADDR frame, enum varobj_type type)
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)
static bool check_scope(const struct varobj *var)
gdb::unique_xmalloc_ptr< char > python_string_to_target_string(PyObject *obj)
struct type * varobj_get_value_type(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)
std::string type_to_string(struct type *type)
void varobj_get_child_range(const struct varobj *var, int *from, int *to)
static bool update_type_if_necessary(struct varobj *var, struct value *new_value)
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 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,...)
std::string(* path_expr_of_child)(const struct varobj *child)
const char * varobj_get_path_expr(const struct varobj *var)
struct gdbarch * get_frame_arch(struct frame_info *this_frame)
static void construct_visualizer(struct varobj *var, PyObject *constructor)
static void show_varobjdebug(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static struct varobj_root * rootlist