cris: Check UNDEFWEAK_NO_DYNAMIC_RELOC
[deliverable/binutils-gdb.git] / gdb / varobj.c
index 3b2771f5cf54e40df788814e2367f3d5dea268e9..2d850fb5e1af475a5e5ff078cdcd07276eb2f8f4 100644 (file)
@@ -50,7 +50,7 @@ show_varobjdebug (struct ui_file *file, int from_tty,
 }
 
 /* String representations of gdb's format codes.  */
-char *varobj_format_string[] =
+const char *varobj_format_string[] =
   { "natural", "binary", "decimal", "hexadecimal", "octal", "zero-hexadecimal" };
 
 /* True if we want to allow Python-based pretty-printing.  */
@@ -435,17 +435,14 @@ varobj_create (const char *objname,
 
 /* Generates an unique name that can be used for a varobj.  */
 
-char *
+std::string
 varobj_gen_name (void)
 {
   static int id = 0;
-  char *obj_name;
 
   /* Generate a name for this object.  */
   id++;
-  obj_name = xstrprintf ("var%d", id);
-
-  return obj_name;
+  return string_printf ("var%d", id);
 }
 
 /* Given an OBJNAME, returns the pointer to the corresponding varobj.  Call
@@ -724,7 +721,7 @@ varobj_clear_saved_item (struct varobj_dynamic *var)
   if (var->saved_item != NULL)
     {
       value_free (var->saved_item->value);
-      xfree (var->saved_item);
+      delete var->saved_item;
       var->saved_item = NULL;
     }
 }
@@ -799,7 +796,7 @@ update_dynamic_varobj_children (struct varobj *var,
                                 can_mention ? cchanged : NULL, i,
                                 item);
 
-         xfree (item);
+         delete item;
        }
       else
        {
@@ -1478,11 +1475,11 @@ varobj_set_visualizer (struct varobj *var, const char *visualizer)
   gdbpy_enter_varobj enter_py (var);
 
   mainmod = PyImport_AddModule ("__main__");
-  gdbpy_ref globals (PyModule_GetDict (mainmod));
+  gdbpy_ref<> globals (PyModule_GetDict (mainmod));
   Py_INCREF (globals.get ());
 
-  gdbpy_ref constructor (PyRun_String (visualizer, Py_eval_input,
-                                      globals.get (), globals.get ()));
+  gdbpy_ref<> constructor (PyRun_String (visualizer, Py_eval_input,
+                                        globals.get (), globals.get ()));
 
   if (constructor == NULL)
     {
@@ -2136,7 +2133,7 @@ varobj_get_value_type (const struct varobj *var)
 
   type = check_typedef (type);
 
-  if (TYPE_CODE (type) == TYPE_CODE_REF)
+  if (TYPE_IS_REFERENCE (type))
     type = get_target_type (type);
 
   type = check_typedef (type);
@@ -2218,14 +2215,13 @@ value_of_root_1 (struct varobj **var_handle)
   struct value *new_val = NULL;
   struct varobj *var = *var_handle;
   int within_scope = 0;
-  struct cleanup *back_to;
                                                                 
   /*  Only root variables can be updated...  */
   if (!is_root_p (var))
     /* Not a root var.  */
     return NULL;
 
-  back_to = make_cleanup_restore_current_thread ();
+  scoped_restore_current_thread restore_thread;
 
   /* Determine whether the variable is still around.  */
   if (var->root->valid_block == NULL || var->root->floating)
@@ -2264,8 +2260,6 @@ value_of_root_1 (struct varobj **var_handle)
       END_CATCH
     }
 
-  do_cleanups (back_to);
-
   return new_val;
 }
 
@@ -2432,9 +2426,9 @@ varobj_value_get_print_value (struct value *value,
            {
              struct value *replacement;
 
-             gdbpy_ref output (apply_varobj_pretty_printer (value_formatter,
-                                                            &replacement,
-                                                            &stb));
+             gdbpy_ref<> output (apply_varobj_pretty_printer (value_formatter,
+                                                              &replacement,
+                                                              &stb));
 
              /* If we have string like output ...  */
              if (output != NULL)
@@ -2641,8 +2635,7 @@ varobj_invalidate (void)
 {
   all_root_varobjs (varobj_invalidate_iter, NULL);
 }
-\f
-extern void _initialize_varobj (void);
+
 void
 _initialize_varobj (void)
 {
This page took 0.026138 seconds and 4 git commands to generate.