* varobj.c (varobj_get_type): Use type_to_string.
This commit is contained in:
parent
96ded7385d
commit
1a4300e94d
@ -1,3 +1,7 @@
|
|||||||
|
2009-06-30 Vladimir Prus <vladimir@codesourcery.com>
|
||||||
|
|
||||||
|
* varobj.c (varobj_get_type): Use type_to_string.
|
||||||
|
|
||||||
2009-06-29 Pedro Alves <pedro@codesourcery.com>
|
2009-06-29 Pedro Alves <pedro@codesourcery.com>
|
||||||
|
|
||||||
* infrun.c (handle_inferior_event): Context switch to the new
|
* infrun.c (handle_inferior_event): Context switch to the new
|
||||||
|
19
gdb/varobj.c
19
gdb/varobj.c
@ -34,6 +34,7 @@
|
|||||||
#include "vec.h"
|
#include "vec.h"
|
||||||
#include "gdbthread.h"
|
#include "gdbthread.h"
|
||||||
#include "inferior.h"
|
#include "inferior.h"
|
||||||
|
#include "typeprint.h"
|
||||||
|
|
||||||
#if HAVE_PYTHON
|
#if HAVE_PYTHON
|
||||||
#include "python/python.h"
|
#include "python/python.h"
|
||||||
@ -1030,29 +1031,13 @@ varobj_add_child (struct varobj *var, const char *name, struct value *value)
|
|||||||
char *
|
char *
|
||||||
varobj_get_type (struct varobj *var)
|
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
|
/* For the "fake" variables, do not return a type. (It's type is
|
||||||
NULL, too.)
|
NULL, too.)
|
||||||
Do not return a type for invalid variables as well. */
|
Do not return a type for invalid variables as well. */
|
||||||
if (CPLUS_FAKE_CHILD (var) || !var->root->is_valid)
|
if (CPLUS_FAKE_CHILD (var) || !var->root->is_valid)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
stb = mem_fileopen ();
|
return type_to_string (var->type);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Obtain the type of an object variable. */
|
/* Obtain the type of an object variable. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user