mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-05 06:23:58 +08:00
Re-indent.
This commit is contained in:
@ -1,3 +1,7 @@
|
||||
2001-10-31 Andrew Cagney <ac131313@redhat.com>
|
||||
|
||||
* varobj.c: Re-indent.
|
||||
|
||||
2001-10-31 Andrew Cagney <ac131313@redhat.com>
|
||||
|
||||
* x86-64-tdep.c (value_push, x86_64_push_arguments): Replace
|
||||
|
114
gdb/varobj.c
114
gdb/varobj.c
@ -33,18 +33,17 @@ int varobjdebug = 0;
|
||||
|
||||
/* String representations of gdb's format codes */
|
||||
char *varobj_format_string[] =
|
||||
{"natural", "binary", "decimal", "hexadecimal", "octal"};
|
||||
{ "natural", "binary", "decimal", "hexadecimal", "octal" };
|
||||
|
||||
/* String representations of gdb's known languages */
|
||||
char *varobj_language_string[] =
|
||||
{"unknown", "C", "C++", "Java"};
|
||||
char *varobj_language_string[] = { "unknown", "C", "C++", "Java" };
|
||||
|
||||
/* Data structures */
|
||||
|
||||
/* Every root variable has one of these structures saved in its
|
||||
varobj. Members which must be free'd are noted. */
|
||||
struct varobj_root
|
||||
{
|
||||
{
|
||||
|
||||
/* Alloc'd expression for this parent. */
|
||||
struct expression *exp;
|
||||
@ -67,13 +66,13 @@ struct varobj_root
|
||||
|
||||
/* Next root variable */
|
||||
struct varobj_root *next;
|
||||
};
|
||||
};
|
||||
|
||||
/* Every variable in the system has a structure of this type defined
|
||||
for it. This structure holds all information necessary to manipulate
|
||||
a particular object variable. Members which must be freed are noted. */
|
||||
struct varobj
|
||||
{
|
||||
{
|
||||
|
||||
/* Alloc'd name of the variable for this object.. If this variable is a
|
||||
child, then this name will be the child's source name.
|
||||
@ -111,44 +110,44 @@ struct varobj
|
||||
|
||||
/* The format of the output for this object */
|
||||
enum varobj_display_formats format;
|
||||
};
|
||||
};
|
||||
|
||||
/* Every variable keeps a linked list of its children, described
|
||||
by the following structure. */
|
||||
/* FIXME: Deprecated. All should use vlist instead */
|
||||
|
||||
struct varobj_child
|
||||
{
|
||||
{
|
||||
|
||||
/* Pointer to the child's data */
|
||||
struct varobj *child;
|
||||
|
||||
/* Pointer to the next child */
|
||||
struct varobj_child *next;
|
||||
};
|
||||
};
|
||||
|
||||
/* A stack of varobjs */
|
||||
/* FIXME: Deprecated. All should use vlist instead */
|
||||
|
||||
struct vstack
|
||||
{
|
||||
{
|
||||
struct varobj *var;
|
||||
struct vstack *next;
|
||||
};
|
||||
};
|
||||
|
||||
struct cpstack
|
||||
{
|
||||
{
|
||||
char *name;
|
||||
struct cpstack *next;
|
||||
};
|
||||
};
|
||||
|
||||
/* A list of varobjs */
|
||||
|
||||
struct vlist
|
||||
{
|
||||
{
|
||||
struct varobj *var;
|
||||
struct vlist *next;
|
||||
};
|
||||
};
|
||||
|
||||
/* Private function prototypes */
|
||||
|
||||
@ -280,7 +279,7 @@ static char *java_value_of_variable (struct varobj *var);
|
||||
/* The language specific vector */
|
||||
|
||||
struct language_specific
|
||||
{
|
||||
{
|
||||
|
||||
/* The language of this variable */
|
||||
enum varobj_languages language;
|
||||
@ -308,12 +307,11 @@ struct language_specific
|
||||
|
||||
/* The current value of VAR. */
|
||||
char *(*value_of_variable) (struct varobj * var);
|
||||
};
|
||||
};
|
||||
|
||||
/* Array of known source language routines. */
|
||||
static struct language_specific
|
||||
languages[vlang_end][sizeof (struct language_specific)] =
|
||||
{
|
||||
languages[vlang_end][sizeof (struct language_specific)] = {
|
||||
/* Unknown (try treating as C */
|
||||
{
|
||||
vlang_unknown,
|
||||
@ -324,8 +322,7 @@ static struct language_specific
|
||||
c_value_of_child,
|
||||
c_type_of_child,
|
||||
c_variable_editable,
|
||||
c_value_of_variable
|
||||
}
|
||||
c_value_of_variable}
|
||||
,
|
||||
/* C */
|
||||
{
|
||||
@ -337,8 +334,7 @@ static struct language_specific
|
||||
c_value_of_child,
|
||||
c_type_of_child,
|
||||
c_variable_editable,
|
||||
c_value_of_variable
|
||||
}
|
||||
c_value_of_variable}
|
||||
,
|
||||
/* C++ */
|
||||
{
|
||||
@ -350,8 +346,7 @@ static struct language_specific
|
||||
cplus_value_of_child,
|
||||
cplus_type_of_child,
|
||||
cplus_variable_editable,
|
||||
cplus_value_of_variable
|
||||
}
|
||||
cplus_value_of_variable}
|
||||
,
|
||||
/* Java */
|
||||
{
|
||||
@ -363,21 +358,19 @@ static struct language_specific
|
||||
java_value_of_child,
|
||||
java_type_of_child,
|
||||
java_variable_editable,
|
||||
java_value_of_variable
|
||||
}
|
||||
java_value_of_variable}
|
||||
};
|
||||
|
||||
/* A little convenience enum for dealing with C++/Java */
|
||||
enum vsections
|
||||
{
|
||||
{
|
||||
v_public = 0, v_private, v_protected
|
||||
};
|
||||
};
|
||||
|
||||
/* Private data */
|
||||
|
||||
/* Mappings of varobj_display_formats enums to gdb's format codes */
|
||||
static int format_code[] =
|
||||
{0, 't', 'd', 'x', 'o'};
|
||||
static int format_code[] = { 0, 't', 'd', 'x', 'o' };
|
||||
|
||||
/* Header of the list of root variable objects */
|
||||
static struct varobj_root *rootlist;
|
||||
@ -401,8 +394,7 @@ static struct vlist **varobj_table;
|
||||
|
||||
struct varobj *
|
||||
varobj_create (char *objname,
|
||||
char *expression, CORE_ADDR frame,
|
||||
enum varobj_type type)
|
||||
char *expression, CORE_ADDR frame, enum varobj_type type)
|
||||
{
|
||||
struct varobj *var;
|
||||
struct frame_info *fi;
|
||||
@ -423,8 +415,7 @@ varobj_create (char *objname,
|
||||
of the variable's data as possible */
|
||||
|
||||
/* Allow creator to specify context of variable */
|
||||
if ((type == USE_CURRENT_FRAME)
|
||||
|| (type == USE_SELECTED_FRAME))
|
||||
if ((type == USE_CURRENT_FRAME) || (type == USE_SELECTED_FRAME))
|
||||
fi = selected_frame;
|
||||
else
|
||||
fi = find_frame_addr_in_frame_chain (frame);
|
||||
@ -612,7 +603,8 @@ varobj_delete (struct varobj *var, char ***dellist, int only_children)
|
||||
}
|
||||
|
||||
if (mycount || (*cp != NULL))
|
||||
warning ("varobj_delete: assertion failed - mycount(=%d) <> 0", mycount);
|
||||
warning ("varobj_delete: assertion failed - mycount(=%d) <> 0",
|
||||
mycount);
|
||||
}
|
||||
|
||||
return delcount;
|
||||
@ -850,7 +842,8 @@ varobj_list (struct varobj ***varlist)
|
||||
*cv = NULL;
|
||||
|
||||
if (mycount || (croot != NULL))
|
||||
warning ("varobj_list: assertion failed - wrong tally of root vars (%d:%d)",
|
||||
warning
|
||||
("varobj_list: assertion failed - wrong tally of root vars (%d:%d)",
|
||||
rootcount, mycount);
|
||||
|
||||
return rootcount;
|
||||
@ -927,7 +920,8 @@ varobj_update (struct varobj **varp, struct varobj ***changelist)
|
||||
/* If values are not equal, note that it's changed.
|
||||
There a couple of exceptions here, though.
|
||||
We don't want some types to be reported as "changed". */
|
||||
else if (type_changeable (*varp) && !my_value_equal ((*varp)->value, new, &error2))
|
||||
else if (type_changeable (*varp)
|
||||
&& !my_value_equal ((*varp)->value, new, &error2))
|
||||
{
|
||||
vpush (&result, *varp);
|
||||
changed++;
|
||||
@ -1012,8 +1006,8 @@ varobj_update (struct varobj **varp, struct varobj ***changelist)
|
||||
if (changed > 1)
|
||||
{
|
||||
/* Now we revert the order. */
|
||||
for (i=0; i < changed; i++)
|
||||
*(*changelist + i) = *(templist + changed -1 - i);
|
||||
for (i = 0; i < changed; i++)
|
||||
*(*changelist + i) = *(templist + changed - 1 - i);
|
||||
*(*changelist + changed) = NULL;
|
||||
}
|
||||
|
||||
@ -1050,8 +1044,9 @@ delete_variable (struct cpstack **resultp, struct varobj *var,
|
||||
and the parent is not removed we dump core. It must be always
|
||||
initially called with remove_from_parent_p set */
|
||||
static void
|
||||
delete_variable_1 (struct cpstack **resultp, int *delcountp, struct varobj *var,
|
||||
int only_children_p, int remove_from_parent_p)
|
||||
delete_variable_1 (struct cpstack **resultp, int *delcountp,
|
||||
struct varobj *var, int only_children_p,
|
||||
int remove_from_parent_p)
|
||||
{
|
||||
struct varobj_child *vc;
|
||||
struct varobj_child *next;
|
||||
@ -1084,8 +1079,7 @@ delete_variable_1 (struct cpstack **resultp, int *delcountp, struct varobj *var,
|
||||
(as indicated by remove_from_parent_p) we don't bother doing an
|
||||
expensive list search to find the element to remove when we are
|
||||
discarding the list afterwards */
|
||||
if ((remove_from_parent_p) &&
|
||||
(var->parent != NULL))
|
||||
if ((remove_from_parent_p) && (var->parent != NULL))
|
||||
{
|
||||
remove_child_from_parent (var->parent, var);
|
||||
}
|
||||
@ -1171,7 +1165,9 @@ uninstall_variable (struct varobj *var)
|
||||
|
||||
if (cv == NULL)
|
||||
{
|
||||
warning ("Assertion failed: Could not find variable object \"%s\" to delete", var->obj_name);
|
||||
warning
|
||||
("Assertion failed: Could not find variable object \"%s\" to delete",
|
||||
var->obj_name);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1199,7 +1195,9 @@ uninstall_variable (struct varobj *var)
|
||||
}
|
||||
if (cr == NULL)
|
||||
{
|
||||
warning ("Assertion failed: Could not find varobj \"%s\" in root list", var->obj_name);
|
||||
warning
|
||||
("Assertion failed: Could not find varobj \"%s\" in root list",
|
||||
var->obj_name);
|
||||
return;
|
||||
}
|
||||
if (prer == NULL)
|
||||
@ -1245,8 +1243,9 @@ create_child (struct varobj *parent, int index, char *name)
|
||||
child->error = 1;
|
||||
child->parent = parent;
|
||||
child->root = parent->root;
|
||||
childs_name = (char *) xmalloc ((strlen (parent->obj_name) + strlen (name) + 2)
|
||||
* sizeof (char));
|
||||
childs_name =
|
||||
(char *) xmalloc ((strlen (parent->obj_name) + strlen (name) + 2) *
|
||||
sizeof (char));
|
||||
sprintf (childs_name, "%s.%s", parent->obj_name, name);
|
||||
child->obj_name = childs_name;
|
||||
install_variable (child);
|
||||
@ -1632,7 +1631,7 @@ value_of_root (struct varobj **var_handle, int *type_changed)
|
||||
return NULL;
|
||||
}
|
||||
new_type = varobj_get_type (tmp_var);
|
||||
if (strcmp(old_type, new_type) == 0)
|
||||
if (strcmp (old_type, new_type) == 0)
|
||||
{
|
||||
varobj_delete (tmp_var, NULL, 0);
|
||||
*type_changed = 0;
|
||||
@ -1844,7 +1843,8 @@ c_name_of_child (struct varobj *parent, int index)
|
||||
break;
|
||||
|
||||
default:
|
||||
name = (char *) xmalloc ((strlen (parent->name) + 2) * sizeof (char));
|
||||
name =
|
||||
(char *) xmalloc ((strlen (parent->name) + 2) * sizeof (char));
|
||||
sprintf (name, "*%s", parent->name);
|
||||
break;
|
||||
}
|
||||
@ -1958,7 +1958,8 @@ c_value_of_child (struct varobj *parent, int index)
|
||||
{
|
||||
case TYPE_CODE_STRUCT:
|
||||
case TYPE_CODE_UNION:
|
||||
value = value_struct_elt (&temp, NULL, name, NULL, "vstructure");
|
||||
value =
|
||||
value_struct_elt (&temp, NULL, name, NULL, "vstructure");
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -2166,8 +2167,7 @@ cplus_class_num_children (struct type *type, int children[3])
|
||||
for (i = TYPE_N_BASECLASSES (type); i < TYPE_NFIELDS (type); i++)
|
||||
{
|
||||
/* If we have a virtual table pointer, omit it. */
|
||||
if (TYPE_VPTR_BASETYPE (type) == type
|
||||
&& TYPE_VPTR_FIELDNO (type) == i)
|
||||
if (TYPE_VPTR_BASETYPE (type) == type && TYPE_VPTR_FIELDNO (type) == i)
|
||||
continue;
|
||||
|
||||
if (TYPE_FIELD_PROTECTED (type, i))
|
||||
@ -2212,7 +2212,8 @@ cplus_name_of_child (struct varobj *parent, int index)
|
||||
/* FIXME: This assumes that type orders
|
||||
inherited, public, private, protected */
|
||||
int i = index + TYPE_N_BASECLASSES (type);
|
||||
if (STREQ (parent->name, "private") || STREQ (parent->name, "protected"))
|
||||
if (STREQ (parent->name, "private")
|
||||
|| STREQ (parent->name, "protected"))
|
||||
i += children[v_public];
|
||||
if (STREQ (parent->name, "protected"))
|
||||
i += children[v_private];
|
||||
@ -2472,10 +2473,7 @@ _initialize_varobj (void)
|
||||
varobj_table = xmalloc (sizeof_table);
|
||||
memset (varobj_table, 0, sizeof_table);
|
||||
|
||||
add_show_from_set (
|
||||
add_set_cmd ("debugvarobj", class_maintenance, var_zinteger,
|
||||
(char *) &varobjdebug,
|
||||
"Set varobj debugging.\n\
|
||||
add_show_from_set (add_set_cmd ("debugvarobj", class_maintenance, var_zinteger, (char *) &varobjdebug, "Set varobj debugging.\n\
|
||||
When non-zero, varobj debugging is enabled.", &setlist),
|
||||
&showlist);
|
||||
}
|
||||
|
Reference in New Issue
Block a user