This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFC] Simplify varobj type printing

The patch below simplifies, a bit, the logic that MI
uses to get char* give type*. I see no regressions, but still
appreciate if somebody offer any ideas on two points:

1. Why the current code works this way. It appears to
be like this since initial commit in 2000, and I don't
see any reason why creating value_zero and then taking its
type is gonna change anything.

2. Is there no way, outside MI code, to get char* representation
of a type? If so, shall I add a function to typeprint.h? 

- Volodya

Index: gdb/varobj.c
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.135
diff -u -p -r1.135 varobj.c
--- gdb/varobj.c	17 Jun 2009 18:49:36 -0000	1.135
+++ gdb/varobj.c	29 Jun 2009 12:23:03 -0000
@@ -1045,10 +1045,7 @@ varobj_get_type (struct varobj *var)
   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);
+  type_print (var->type, "", stb, -1);
   thetype = ui_file_xstrdup (stb, &length);
   do_cleanups (old_chain);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]