GDB (xrefs)
Loading...
Searching...
No Matches
Classes | Functions | Variables
/tmp/gdb-13.1/gdb/varobj.c File Reference
#include "defs.h"
#include "value.h"
#include "expression.h"
#include "frame.h"
#include "language.h"
#include "gdbcmd.h"
#include "block.h"
#include "valprint.h"
#include "gdbsupport/gdb_regex.h"
#include "varobj.h"
#include "gdbthread.h"
#include "inferior.h"
#include "varobj-iter.h"
#include "parser-defs.h"
#include "gdbarch.h"
#include <algorithm>
#include "observable.h"
#include "python/python.h"
#include "python/python-internal.h"

Go to the source code of this file.

Classes

struct  varobj_root
 
struct  varobj_dynamic
 

Functions

static void show_varobjdebug (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
 
void varobj_enable_pretty_printing (void)
 
static int delete_variable (struct varobj *, bool)
 
static void delete_variable_1 (int *, struct varobj *, bool, bool)
 
static void install_variable (struct varobj *)
 
static void uninstall_variable (struct varobj *)
 
static struct varobjcreate_child (struct varobj *, int, std::string &)
 
static struct varobjcreate_child_with_value (struct varobj *parent, int index, struct varobj_item *item)
 
static enum varobj_display_formats variable_default_display (struct varobj *)
 
static bool update_type_if_necessary (struct varobj *var, struct value *new_value)
 
static bool install_new_value (struct varobj *var, struct value *value, bool initial)
 
static int number_of_children (const struct varobj *)
 
static std::string name_of_variable (const struct varobj *)
 
static std::string name_of_child (struct varobj *, int)
 
static struct valuevalue_of_root (struct varobj **var_handle, bool *)
 
static struct valuevalue_of_child (const struct varobj *parent, int index)
 
static std::string my_value_of_variable (struct varobj *var, enum varobj_display_formats format)
 
static bool is_root_p (const struct varobj *var)
 
static struct varobjvarobj_add_child (struct varobj *var, struct varobj_item *item)
 
static frame_info_ptr find_frame_addr_in_frame_chain (CORE_ADDR frame_addr)
 
struct varobjvarobj_create (const char *objname, const char *expression, CORE_ADDR frame, enum varobj_type type)
 
std::string varobj_gen_name (void)
 
struct varobjvarobj_get_handle (const char *objname)
 
const char * varobj_get_objname (const struct varobj *var)
 
std::string varobj_get_expression (const struct varobj *var)
 
int varobj_delete (struct varobj *var, bool only_children)
 
static PyObject * instantiate_pretty_printer (PyObject *constructor, struct value *value)
 
enum varobj_display_formats varobj_set_display_format (struct varobj *var, enum varobj_display_formats format)
 
enum varobj_display_formats varobj_get_display_format (const struct varobj *var)
 
gdb::unique_xmalloc_ptr< char > varobj_get_display_hint (const struct varobj *var)
 
bool varobj_has_more (const struct varobj *var, int to)
 
int varobj_get_thread_id (const struct varobj *var)
 
void varobj_set_frozen (struct varobj *var, bool frozen)
 
bool varobj_get_frozen (const struct varobj *var)
 
void varobj_restrict_range (const std::vector< varobj * > &children, int *from, int *to)
 
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 bool dynamic_varobj_has_child_method (const struct varobj *var)
 
static std::unique_ptr< varobj_itervarobj_get_iterator (struct varobj *var)
 
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)
 
int varobj_get_num_children (struct varobj *var)
 
const std::vector< varobj * > & varobj_list_children (struct varobj *var, int *from, int *to)
 
std::string varobj_get_type (struct varobj *var)
 
struct typevarobj_get_gdb_type (const struct varobj *var)
 
static bool is_path_expr_parent (const struct varobj *var)
 
bool varobj_default_is_path_expr_parent (const struct varobj *var)
 
const struct varobjvarobj_get_path_expr_parent (const struct varobj *var)
 
const char * varobj_get_path_expr (const struct varobj *var)
 
const struct language_defnvarobj_get_language (const struct varobj *var)
 
int varobj_get_attributes (const struct varobj *var)
 
bool varobj_is_dynamic_p (const struct varobj *var)
 
std::string varobj_get_formatted_value (struct varobj *var, enum varobj_display_formats format)
 
std::string varobj_get_value (struct varobj *var)
 
bool varobj_set_value (struct varobj *var, const char *expression)
 
static void install_visualizer (struct varobj_dynamic *var, PyObject *constructor, PyObject *visualizer)
 
static void install_default_visualizer (struct varobj *var)
 
static void construct_visualizer (struct varobj *var, PyObject *constructor)
 
static void install_new_value_visualizer (struct varobj *var)
 
void varobj_get_child_range (const struct varobj *var, int *from, int *to)
 
void varobj_set_child_range (struct varobj *var, int from, int to)
 
void varobj_set_visualizer (struct varobj *var, const char *visualizer)
 
static bool varobj_value_has_mutated (const struct varobj *var, struct value *new_value, struct type *new_type)
 
std::vector< varobj_update_resultvarobj_update (struct varobj **varp, bool is_explicit)
 
struct typevarobj_get_value_type (const struct varobj *var)
 
static bool check_scope (const struct varobj *var)
 
static struct valuevalue_of_root_1 (struct varobj **var_handle)
 
void varobj_formatted_print_options (struct value_print_options *opts, enum varobj_display_formats format)
 
std::string varobj_value_get_print_value (struct value *value, enum varobj_display_formats format, const struct varobj *var)
 
bool varobj_editable_p (const struct varobj *var)
 
bool varobj_value_is_changeable_p (const struct varobj *var)
 
bool varobj_floating_p (const struct varobj *var)
 
bool varobj_default_value_is_changeable_p (const struct varobj *var)
 
void all_root_varobjs (gdb::function_view< void(struct varobj *var)> func)
 
static void varobj_re_set_iter (struct varobj *var)
 
void varobj_re_set (void)
 
static void varobj_invalidate_if_uses_objfile (struct objfile *objfile)
 
static hashval_t hash_varobj (const void *a)
 
static int eq_varobj_and_string (const void *a, const void *b)
 
void _initialize_varobj ()
 

Variables

unsigned int varobjdebug = 0
 
const char * varobj_format_string []
 
static bool pretty_printing = false
 
static int format_code [] = { 0, 't', 'd', 'x', 'o', 'z' }
 
static std::list< struct varobj_root * > rootlist
 
static htab_t varobj_table
 

Function Documentation

◆ _initialize_varobj()

void _initialize_varobj ( )

Definition at line 2459 of file varobj.c.

Referenced by initialize_all_files().

◆ all_root_varobjs()

void all_root_varobjs ( gdb::function_view< void(struct varobj *var)>  func)

Definition at line 2344 of file varobj.c.

References func, and rootlist.

Referenced by mi_cmd_var_update(), preserve_values(), varobj_invalidate_if_uses_objfile(), and varobj_re_set().

◆ check_scope()

static bool check_scope ( const struct varobj var)
static

◆ construct_visualizer()

static void construct_visualizer ( struct varobj var,
PyObject *  constructor 
)
static

◆ create_child()

static struct varobj * create_child ( struct varobj parent,
int  index,
std::string &  name 
)
static

◆ create_child_with_value()

static struct varobj * create_child_with_value ( struct varobj parent,
int  index,
struct varobj_item item 
)
static

◆ delete_variable()

static int delete_variable ( struct varobj var,
bool  only_children_p 
)
static

Definition at line 1691 of file varobj.c.

References delete_variable_1().

Referenced by varobj_delete().

◆ delete_variable_1()

static void delete_variable_1 ( int *  delcountp,
struct varobj var,
bool  only_children_p,
bool  remove_from_parent_p 
)
static

◆ dynamic_varobj_has_child_method()

static bool dynamic_varobj_has_child_method ( const struct varobj var)
static

◆ eq_varobj_and_string()

static int eq_varobj_and_string ( const void *  a,
const void *  b 
)
static

Definition at line 2449 of file varobj.c.

References name, and varobj::obj_name.

◆ find_frame_addr_in_frame_chain()

static frame_info_ptr find_frame_addr_in_frame_chain ( CORE_ADDR  frame_addr)
static

◆ hash_varobj()

static hashval_t hash_varobj ( const void *  a)
static

Definition at line 2440 of file varobj.c.

References varobj::obj_name.

◆ install_default_visualizer()

static void install_default_visualizer ( struct varobj var)
static

◆ install_dynamic_child()

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

◆ install_new_value()

static bool install_new_value ( struct varobj var,
struct value value,
bool  initial 
)
static

◆ install_new_value_visualizer()

static void install_new_value_visualizer ( struct varobj var)
static

◆ install_variable()

static void install_variable ( struct varobj var)
static

◆ install_visualizer()

static void install_visualizer ( struct varobj_dynamic var,
PyObject *  constructor,
PyObject *  visualizer 
)
static

◆ instantiate_pretty_printer()

static PyObject * instantiate_pretty_printer ( PyObject *  constructor,
struct value value 
)
static

Definition at line 474 of file varobj.c.

References value_to_value_object().

Referenced by construct_visualizer().

◆ is_path_expr_parent()

static bool is_path_expr_parent ( const struct varobj var)
static

◆ is_root_p()

static bool is_root_p ( const struct varobj var)
static

◆ my_value_of_variable()

static std::string my_value_of_variable ( struct varobj var,
enum varobj_display_formats  format 
)
static

◆ name_of_child()

static std::string name_of_child ( struct varobj var,
int  index 
)
static

Definition at line 1939 of file varobj.c.

References varobj_root::lang_ops, lang_varobj_ops::name_of_child, and varobj::root.

Referenced by varobj_list_children().

◆ name_of_variable()

static std::string name_of_variable ( const struct varobj var)
static

Definition at line 1931 of file varobj.c.

References varobj_root::lang_ops, lang_varobj_ops::name_of_variable, and varobj::root.

Referenced by varobj_get_expression().

◆ number_of_children()

static int number_of_children ( const struct varobj var)
static

◆ show_varobjdebug()

static void show_varobjdebug ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
)
static

Definition at line 48 of file varobj.c.

References gdb_printf().

◆ uninstall_variable()

static void uninstall_variable ( struct varobj var)
static

◆ update_dynamic_varobj_children()

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 
)
static

◆ update_type_if_necessary()

static bool update_type_if_necessary ( struct varobj var,
struct value new_value 
)
static

◆ value_of_child()

static struct value * value_of_child ( const struct varobj parent,
int  index 
)
static

Definition at line 2118 of file varobj.c.

References value::parent.

Referenced by create_child(), and varobj_update().

◆ value_of_root()

static struct value * value_of_root ( struct varobj **  var_handle,
bool *  type_changed 
)
static

◆ value_of_root_1()

static struct value * value_of_root_1 ( struct varobj **  var_handle)
static

◆ variable_default_display()

static enum varobj_display_formats variable_default_display ( struct varobj var)
static

Definition at line 1906 of file varobj.c.

References FORMAT_NATURAL.

Referenced by varobj_create(), and varobj_set_display_format().

◆ varobj_add_child()

static struct varobj * varobj_add_child ( struct varobj var,
struct varobj_item item 
)
static

Definition at line 846 of file varobj.c.

References varobj::children, and create_child_with_value().

Referenced by install_dynamic_child().

◆ varobj_create()

struct varobj * varobj_create ( const char *  objname,
const char *  expression,
CORE_ADDR  frame,
enum varobj_type  type 
)

◆ varobj_default_is_path_expr_parent()

bool varobj_default_is_path_expr_parent ( const struct varobj var)

Definition at line 894 of file varobj.c.

◆ varobj_default_value_is_changeable_p()

bool varobj_default_value_is_changeable_p ( const struct varobj var)

Definition at line 2315 of file varobj.c.

References type::code(), CPLUS_FAKE_CHILD, and varobj_get_value_type().

Referenced by ada_value_is_changeable_p().

◆ varobj_delete()

int varobj_delete ( struct varobj var,
bool  only_children 
)

◆ varobj_editable_p()

bool varobj_editable_p ( const struct varobj var)

◆ varobj_enable_pretty_printing()

void varobj_enable_pretty_printing ( void  )

Definition at line 62 of file varobj.c.

References pretty_printing.

Referenced by mi_cmd_enable_pretty_printing().

◆ varobj_floating_p()

bool varobj_floating_p ( const struct varobj var)

Definition at line 2306 of file varobj.c.

References varobj_root::floating, and varobj::root.

Referenced by mi_cmd_var_update_iter().

◆ varobj_formatted_print_options()

void varobj_formatted_print_options ( struct value_print_options opts,
enum varobj_display_formats  format 
)

◆ varobj_gen_name()

std::string varobj_gen_name ( void  )

Definition at line 420 of file varobj.c.

Referenced by mi_cmd_var_create().

◆ varobj_get_attributes()

int varobj_get_attributes ( const struct varobj var)

Definition at line 944 of file varobj.c.

References attributes, and varobj_editable_p().

Referenced by mi_cmd_var_show_attributes().

◆ varobj_get_child_range()

void varobj_get_child_range ( const struct varobj var,
int *  from,
int *  to 
)

Definition at line 1383 of file varobj.c.

References varobj::from, and varobj::to.

Referenced by varobj_update_one().

◆ varobj_get_display_format()

enum varobj_display_formats varobj_get_display_format ( const struct varobj var)

Definition at line 517 of file varobj.c.

References varobj::format.

Referenced by mi_cmd_var_show_format().

◆ varobj_get_display_hint()

gdb::unique_xmalloc_ptr< char > varobj_get_display_hint ( const struct varobj var)

◆ varobj_get_expression()

std::string varobj_get_expression ( const struct varobj var)

Definition at line 456 of file varobj.c.

References name_of_variable().

Referenced by mi_cmd_var_info_expression(), and print_varobj().

◆ varobj_get_formatted_value()

std::string varobj_get_formatted_value ( struct varobj var,
enum varobj_display_formats  format 
)

Definition at line 964 of file varobj.c.

References my_value_of_variable().

Referenced by mi_cmd_var_evaluate_expression().

◆ varobj_get_frozen()

bool varobj_get_frozen ( const struct varobj var)

Definition at line 579 of file varobj.c.

References varobj::frozen.

Referenced by print_varobj().

◆ varobj_get_gdb_type()

struct type * varobj_get_gdb_type ( const struct varobj var)

Definition at line 874 of file varobj.c.

References varobj::type.

Referenced by c_is_path_expr_parent(), and mi_print_value_p().

◆ varobj_get_handle()

struct varobj * varobj_get_handle ( const char *  objname)

◆ varobj_get_iterator()

static std::unique_ptr< varobj_iter > varobj_get_iterator ( struct varobj var)
static

◆ varobj_get_language()

const struct language_defn * varobj_get_language ( const struct varobj var)

Definition at line 938 of file varobj.c.

References varobj_root::exp, and varobj::root.

Referenced by mi_cmd_var_info_expression().

◆ varobj_get_num_children()

int varobj_get_num_children ( struct varobj var)

◆ varobj_get_objname()

const char * varobj_get_objname ( const struct varobj var)

Definition at line 447 of file varobj.c.

References varobj::obj_name.

Referenced by print_varobj(), and varobj_update_one().

◆ varobj_get_path_expr()

const char * varobj_get_path_expr ( const struct varobj var)

◆ varobj_get_path_expr_parent()

const struct varobj * varobj_get_path_expr_parent ( const struct varobj var)

◆ varobj_get_thread_id()

int varobj_get_thread_id ( const struct varobj var)

Definition at line 557 of file varobj.c.

References varobj::root, varobj_root::thread_id, and varobj_root::valid_block.

Referenced by mi_cmd_var_update_iter(), and print_varobj().

◆ varobj_get_type()

std::string varobj_get_type ( struct varobj var)

◆ varobj_get_value()

std::string varobj_get_value ( struct varobj var)

◆ varobj_get_value_type()

struct type * varobj_get_value_type ( const struct varobj var)

◆ varobj_has_more()

bool varobj_has_more ( const struct varobj var,
int  to 
)

◆ varobj_invalidate_if_uses_objfile()

static void varobj_invalidate_if_uses_objfile ( struct objfile objfile)
static

◆ varobj_is_dynamic_p()

bool varobj_is_dynamic_p ( const struct varobj var)

◆ varobj_list_children()

const std::vector< varobj * > & varobj_list_children ( struct varobj var,
int *  from,
int *  to 
)

◆ varobj_re_set()

void varobj_re_set ( void  )

Definition at line 2383 of file varobj.c.

References all_root_varobjs(), and varobj_re_set_iter().

Referenced by symbol_file_command().

◆ varobj_re_set_iter()

static void varobj_re_set_iter ( struct varobj var)
static

◆ varobj_restrict_range()

void varobj_restrict_range ( const std::vector< varobj * > &  children,
int *  from,
int *  to 
)

Definition at line 589 of file varobj.c.

References varobj::children, varobj::from, and varobj::to.

Referenced by ada_value_has_mutated(), and varobj_list_children().

◆ varobj_set_child_range()

void varobj_set_child_range ( struct varobj var,
int  from,
int  to 
)

Definition at line 1393 of file varobj.c.

References varobj::from, and varobj::to.

Referenced by mi_cmd_var_set_update_range().

◆ varobj_set_display_format()

enum varobj_display_formats varobj_set_display_format ( struct varobj var,
enum varobj_display_formats  format 
)

◆ varobj_set_frozen()

void varobj_set_frozen ( struct varobj var,
bool  frozen 
)

Definition at line 566 of file varobj.c.

References varobj::frozen.

Referenced by mi_cmd_var_set_frozen().

◆ varobj_set_value()

bool varobj_set_value ( struct varobj var,
const char *  expression 
)

◆ varobj_set_visualizer()

void varobj_set_visualizer ( struct varobj var,
const char *  visualizer 
)

◆ varobj_update()

std::vector< varobj_update_result > varobj_update ( struct varobj **  varp,
bool  is_explicit 
)

◆ varobj_value_get_print_value()

std::string varobj_value_get_print_value ( struct value value,
enum varobj_display_formats  format,
const struct varobj var 
)

◆ varobj_value_has_mutated()

static bool varobj_value_has_mutated ( const struct varobj var,
struct value new_value,
struct type new_type 
)
static

◆ varobj_value_is_changeable_p()

bool varobj_value_is_changeable_p ( const struct varobj var)

Variable Documentation

◆ format_code

int format_code[] = { 0, 't', 'd', 'x', 'o', 'z' }
static

Definition at line 198 of file varobj.c.

Referenced by varobj_formatted_print_options().

◆ pretty_printing

bool pretty_printing = false
static

◆ rootlist

std::list<struct varobj_root *> rootlist
static

Definition at line 201 of file varobj.c.

Referenced by all_root_varobjs(), install_variable(), and uninstall_variable().

◆ varobj_format_string

const char* varobj_format_string[]
Initial value:
=
{ "natural", "binary", "decimal", "hexadecimal", "octal", "zero-hexadecimal" }

Definition at line 55 of file varobj.c.

Referenced by mi_cmd_var_set_format(), and mi_cmd_var_show_format().

◆ varobj_table

htab_t varobj_table
static

Definition at line 204 of file varobj.c.

Referenced by install_variable(), uninstall_variable(), and varobj_get_handle().

◆ varobjdebug

unsigned int varobjdebug = 0

Definition at line 46 of file varobj.c.

Referenced by mi_cmd_var_create(), and uninstall_variable().