summaryrefslogtreecommitdiff
path: root/gdb/varobj.c
diff options
context:
space:
mode:
authorVladimir Prus <vladimir@codesourcery.com>2009-06-30 09:24:46 +0000
committerVladimir Prus <vladimir@codesourcery.com>2009-06-30 09:24:46 +0000
commit3aa2232c6f9fc0db796c8de1bb1ab7da46b0ce2c (patch)
tree97da14cabf2b28f0a04f8b78008013a0053cbb99 /gdb/varobj.c
parent0e458f6438021c02ad43e017f7e65006442cc8fc (diff)
downloadgdb-3aa2232c6f9fc0db796c8de1bb1ab7da46b0ce2c.tar.gz
* varobj.c (varobj_get_type): Use type_to_string.
Diffstat (limited to 'gdb/varobj.c')
-rw-r--r--gdb/varobj.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/gdb/varobj.c b/gdb/varobj.c
index a22607a8062..661a74bbebd 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -34,6 +34,7 @@
#include "vec.h"
#include "gdbthread.h"
#include "inferior.h"
+#include "typeprint.h"
#if HAVE_PYTHON
#include "python/python.h"
@@ -1030,29 +1031,13 @@ varobj_add_child (struct varobj *var, const char *name, struct value *value)
char *
varobj_get_type (struct varobj *var)
{
- struct value *val;
- struct cleanup *old_chain;
- struct ui_file *stb;
- char *thetype;
- long length;
-
/* For the "fake" variables, do not return a type. (It's type is
NULL, too.)
Do not return a type for invalid variables as well. */
if (CPLUS_FAKE_CHILD (var) || !var->root->is_valid)
return NULL;
- stb = mem_fileopen ();
- old_chain = make_cleanup_ui_file_delete (stb);
-
- /* 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);
-
- thetype = ui_file_xstrdup (stb, &length);
- do_cleanups (old_chain);
- return thetype;
+ return type_to_string (var->type);
}
/* Obtain the type of an object variable. */