]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/varobj.c
Update years in copyright notice for the GDB files.
[thirdparty/binutils-gdb.git] / gdb / varobj.c
index a75a40da5720d707f4ccdad69ef5d13e754afc54..9d92bc48a3fae26d0dc8849fa2e09cc63b1a7d14 100644 (file)
@@ -1,6 +1,6 @@
 /* Implementation of the GDB variable objects API.
 
-   Copyright (C) 1999-2012 Free Software Foundation, Inc.
+   Copyright (C) 1999-2013 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
@@ -49,7 +49,7 @@ typedef int PyObject;
 
 /* Non-zero if we want to see trace of varobj level stuff.  */
 
-int varobjdebug = 0;
+unsigned int varobjdebug = 0;
 static void
 show_varobjdebug (struct ui_file *file, int from_tty,
                  struct cmd_list_element *c, const char *value)
@@ -84,7 +84,7 @@ struct varobj_root
   struct expression *exp;
 
   /* Block for which this expression is valid.  */
-  struct block *valid_block;
+  const struct block *valid_block;
 
   /* The frame for this expression.  This field is set iff valid_block is
      not NULL.  */
@@ -1114,9 +1114,6 @@ update_dynamic_varobj_children (struct varobj *var,
 
       make_cleanup_py_decref (children);
 
-      if (!PyIter_Check (children))
-       error (_("Returned value is not iterable"));
-
       Py_XDECREF (var->child_iter);
       var->child_iter = PyObject_GetIter (children);
       if (!var->child_iter)
@@ -2913,12 +2910,10 @@ value_get_print_value (struct value *value, enum varobj_display_formats format,
                       string_print.  Otherwise just return the extracted
                       string as a value.  */
 
-                   PyObject *py_str
-                     = python_string_to_target_python_string (output);
+                   char *s = python_string_to_target_string (output);
 
-                   if (py_str)
+                   if (s)
                      {
-                       char *s = PyString_AsString (py_str);
                        char *hint;
 
                        hint = gdbpy_get_display_hint (value_formatter);
@@ -2929,10 +2924,10 @@ value_get_print_value (struct value *value, enum varobj_display_formats format,
                            xfree (hint);
                          }
 
-                       len = PyString_Size (py_str);
+                       len = strlen (s);
                        thevalue = xmemdup (s, len + 1, len + 1);
                        type = builtin_type (gdbarch)->builtin_char;
-                       Py_DECREF (py_str);
+                       xfree (s);
 
                        if (!string_print)
                          {
@@ -4176,13 +4171,13 @@ _initialize_varobj (void)
   varobj_table = xmalloc (sizeof_table);
   memset (varobj_table, 0, sizeof_table);
 
-  add_setshow_zinteger_cmd ("debugvarobj", class_maintenance,
-                           &varobjdebug,
-                           _("Set varobj debugging."),
-                           _("Show varobj debugging."),
-                           _("When non-zero, varobj debugging is enabled."),
-                           NULL, show_varobjdebug,
-                           &setlist, &showlist);
+  add_setshow_zuinteger_cmd ("debugvarobj", class_maintenance,
+                            &varobjdebug,
+                            _("Set varobj debugging."),
+                            _("Show varobj debugging."),
+                            _("When non-zero, varobj debugging is enabled."),
+                            NULL, show_varobjdebug,
+                            &setlist, &showlist);
 }
 
 /* Invalidate varobj VAR if it is tied to locals and re-create it if it is