Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* varobj_get_type cleanup
@ 2009-06-30  9:25 Vladimir Prus
  2009-06-30 14:09 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Prus @ 2009-06-30  9:25 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: Text/Plain, Size: 56 bytes --]


I've checked in the below obvious cleanup.

- Volodya


[-- Attachment #2: use_type_to_string.diff --]
[-- Type: text/x-patch, Size: 1894 bytes --]

Index: gdb/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.10655
diff -u -p -r1.10655 ChangeLog
--- gdb/ChangeLog	29 Jun 2009 18:27:23 -0000	1.10655
+++ gdb/ChangeLog	30 Jun 2009 09:19:27 -0000
@@ -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>
 
 	* infrun.c (handle_inferior_event): Context switch to the new
Index: gdb/varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.136
diff -u -p -r1.136 varobj.c
--- gdb/varobj.c	29 Jun 2009 13:24:41 -0000	1.136
+++ gdb/varobj.c	30 Jun 2009 09:19:27 -0000
@@ -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, co
 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.  */

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: varobj_get_type cleanup
  2009-06-30  9:25 varobj_get_type cleanup Vladimir Prus
@ 2009-06-30 14:09 ` Tom Tromey
  2009-07-07  8:46   ` Vladimir Prus
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2009-06-30 14:09 UTC (permalink / raw)
  To: Vladimir Prus; +Cc: gdb-patches

>>>>> "Vladimir" == Vladimir Prus <vladimir@codesourcery.com> writes:

Vladimir> I've checked in the below obvious cleanup.

Vladimir> +#include "typeprint.h"

FYI, this doesn't declare anything of interest.

type_to_string is declared, strangely, in value.h.
(I would have expected gdbtypes.h, myself.)

I think I'll go make this same patch in Python now :-)

Tom


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: varobj_get_type cleanup
  2009-06-30 14:09 ` Tom Tromey
@ 2009-07-07  8:46   ` Vladimir Prus
  0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Prus @ 2009-07-07  8:46 UTC (permalink / raw)
  To: tromey; +Cc: gdb-patches

[-- Attachment #1: Type: Text/Plain, Size: 528 bytes --]

On Tuesday 30 June 2009 Tom Tromey wrote:

> >>>>> "Vladimir" == Vladimir Prus <vladimir@codesourcery.com> writes:
> 
> Vladimir> I've checked in the below obvious cleanup.
> 
> Vladimir> +#include "typeprint.h"
> 
> FYI, this doesn't declare anything of interest.
> 
> type_to_string is declared, strangely, in value.h.
> (I would have expected gdbtypes.h, myself.)

Boo. I don't really understand why a function defined in
typeprint.c is declared in random headers ;-) I've checked
in the below obvious cleanup.

- Volodya




[-- Attachment #2: include.diff --]
[-- Type: text/x-patch, Size: 918 bytes --]

Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.10693
diff -u -p -r1.10693 ChangeLog
--- ChangeLog	7 Jul 2009 07:47:19 -0000	1.10693
+++ ChangeLog	7 Jul 2009 08:46:07 -0000
@@ -1,3 +1,7 @@
+2009-07-07  Vladimir Prus  <vladimir@codesourcery.com>
+
+	* varobj.c: Remove unnecessary include.
+
 2009-07-07  Tristan Gingold  <gingold@adacore.com>
 
 	* config/i386/darwin.mh	(NATDEPFILES): Remove excServer.o.
Index: varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.139
diff -u -p -r1.139 varobj.c
--- varobj.c	2 Jul 2009 17:04:22 -0000	1.139
+++ varobj.c	7 Jul 2009 08:46:07 -0000
@@ -34,7 +34,6 @@
 #include "vec.h"
 #include "gdbthread.h"
 #include "inferior.h"
-#include "typeprint.h"
 
 #if HAVE_PYTHON
 #include "python/python.h"

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-07-07  8:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-30  9:25 varobj_get_type cleanup Vladimir Prus
2009-06-30 14:09 ` Tom Tromey
2009-07-07  8:46   ` Vladimir Prus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox