2005-01-14 Andrew Cagney <cagney@gnu.org>
[deliverable/binutils-gdb.git] / gdb / varobj.c
index c662518c82fa439f273bedfa6c03b91f608428b6..175fd430138b93cc12fea442d87af0a61eb24620 100644 (file)
@@ -1,5 +1,6 @@
 /* Implementation of the GDB variable objects API.
-   Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
+
+   Copyright 1999, 2000, 2001, 2005 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -472,8 +473,8 @@ varobj_create (char *objname,
       if (var->root->exp->elts[0].opcode == OP_TYPE)
        {
          do_cleanups (old_chain);
-         fprintf_unfiltered (gdb_stderr,
-                             "Attempt to use a type name as an expression.");
+         fprintf_unfiltered (gdb_stderr, "Attempt to use a type name"
+                             " as an expression.\n");
          return NULL;
        }
 
@@ -505,7 +506,7 @@ varobj_create (char *objname,
       else
        var->value = evaluate_type (var->root->exp);
 
-      var->type = VALUE_TYPE (var->value);
+      var->type = value_type (var->value);
 
       /* Set language info */
       lang = variable_language (var);
@@ -549,7 +550,7 @@ varobj_gen_name (void)
 
   /* generate a name for this object */
   id++;
-  xasprintf (&obj_name, "var%d", id);
+  obj_name = xstrprintf ("var%d", id);
 
   return obj_name;
 }
@@ -744,7 +745,7 @@ varobj_get_type (struct varobj *var)
   /* To print the type, we simply create a zero ``struct value *'' and
      cast it to our type. We then typeprint this variable. */
   val = value_zero (var->type, not_lval);
-  type_print (VALUE_TYPE (val), "", stb, -1);
+  type_print (value_type (val), "", stb, -1);
 
   thetype = ui_file_xstrdup (stb, &length);
   do_cleanups (old_chain);
@@ -1254,7 +1255,7 @@ create_child (struct varobj *parent, int index, char *name)
     child->error = 1;
   child->parent = parent;
   child->root = parent->root;
-  xasprintf (&childs_name, "%s.%s", parent->obj_name, name);
+  childs_name = xstrprintf ("%s.%s", parent->obj_name, name);
   child->obj_name = childs_name;
   install_variable (child);
 
@@ -1705,7 +1706,7 @@ type_of_child (struct varobj *var)
   /* If the child had no evaluation errors, var->value
      will be non-NULL and contain a valid type. */
   if (var->value != NULL)
-    return VALUE_TYPE (var->value);
+    return value_type (var->value);
 
   /* Otherwise, we must compute the type. */
   return (*var->root->lang->type_of_child) (var->parent, var->index);
@@ -1837,7 +1838,7 @@ c_name_of_child (struct varobj *parent, int index)
   switch (TYPE_CODE (type))
     {
     case TYPE_CODE_ARRAY:
-      xasprintf (&name, "%d", index);
+      name = xstrprintf ("%d", index);
       break;
 
     case TYPE_CODE_STRUCT:
@@ -1856,7 +1857,7 @@ c_name_of_child (struct varobj *parent, int index)
          break;
 
        default:
-         xasprintf (&name, "*%s", parent->name);
+         name = xstrprintf ("*%s", parent->name);
          break;
        }
       break;
@@ -2070,7 +2071,7 @@ c_value_of_variable (struct varobj *var)
     case TYPE_CODE_ARRAY:
       {
        char *number;
-       xasprintf (&number, "[%d]", var->num_children);
+       number = xstrprintf ("[%d]", var->num_children);
        return (number);
       }
       /* break; */
@@ -2093,7 +2094,7 @@ c_value_of_variable (struct varobj *var)
 
            if (VALUE_LAZY (var->value))
              gdb_value_fetch_lazy (var->value);
-           val_print (VALUE_TYPE (var->value),
+           val_print (value_type (var->value),
                       VALUE_CONTENTS_RAW (var->value), 0,
                       VALUE_ADDRESS (var->value), stb,
                       format_code[(int) var->format], 1, 0, 0);
@@ -2378,8 +2379,8 @@ cplus_value_of_child (struct varobj *parent, int index)
            {
              struct value *temp = NULL;
 
-             if (TYPE_CODE (VALUE_TYPE (parent->value)) == TYPE_CODE_PTR
-                 || TYPE_CODE (VALUE_TYPE (parent->value)) == TYPE_CODE_REF)
+             if (TYPE_CODE (value_type (parent->value)) == TYPE_CODE_PTR
+                 || TYPE_CODE (value_type (parent->value)) == TYPE_CODE_REF)
                {
                  if (!gdb_value_ind (parent->value, &temp))
                    return NULL;
@@ -2558,7 +2559,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\
+  deprecated_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);
 }
This page took 0.028696 seconds and 4 git commands to generate.