X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fvarobj.c;h=84588364e2189d9d11455ddd3d8f81b47279bbba;hb=bd712aed2f88ab824d403c55a212c2be3f41a335;hp=a75a40da5720d707f4ccdad69ef5d13e754afc54;hpb=4e969b4f01286290f5d06e41dd8e8a2c738d7650;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/varobj.c b/gdb/varobj.c index a75a40da57..84588364e2 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -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. */ @@ -620,7 +620,7 @@ varobj_create (char *objname, struct frame_info *fi; struct frame_id old_id = null_frame_id; struct block *block; - char *p; + const char *p; enum varobj_languages lang; struct value *value = NULL; volatile struct gdb_exception except; @@ -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) @@ -1472,7 +1469,7 @@ varobj_set_value (struct varobj *var, char *expression) struct expression *exp; struct value *value = NULL; /* Initialize to keep gcc happy. */ int saved_input_radix = input_radix; - char *s = expression; + const char *s = expression; volatile struct gdb_exception except; gdb_assert (varobj_editable_p (var)); @@ -1972,7 +1969,6 @@ varobj_value_has_mutated (struct varobj *var, struct value *new_value, VEC(varobj_update_result) * varobj_update (struct varobj **varp, int explicit) { - int changed = 0; int type_changed = 0; int i; struct value *new; @@ -2848,7 +2844,7 @@ value_get_print_value (struct value *value, enum varobj_display_formats format, { struct ui_file *stb; struct cleanup *old_chain; - gdb_byte *thevalue = NULL; + char *thevalue = NULL; struct value_print_options opts; struct type *type = NULL; long len = 0; @@ -2913,12 +2909,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 +2923,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) { @@ -2962,7 +2956,7 @@ value_get_print_value (struct value *value, enum varobj_display_formats format, /* If the THEVALUE has contents, it is a regular string. */ if (thevalue) - LA_PRINT_STRING (stb, type, thevalue, len, encoding, 0, &opts); + LA_PRINT_STRING (stb, type, (gdb_byte *) thevalue, len, encoding, 0, &opts); else if (string_print) /* Otherwise, if string_print is set, and it is not a regular string, it is a lazy string. */ @@ -4176,13 +4170,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