From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30677 invoked by alias); 30 Jun 2009 09:25:37 -0000 Received: (qmail 30648 invoked by uid 22791); 30 Jun 2009 09:25:36 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 30 Jun 2009 09:25:32 +0000 Received: (qmail 17234 invoked from network); 30 Jun 2009 09:25:30 -0000 Received: from unknown (HELO wind.localnet) (vladimir@127.0.0.2) by mail.codesourcery.com with ESMTPA; 30 Jun 2009 09:25:30 -0000 From: Vladimir Prus To: gdb-patches@sources.redhat.com Subject: varobj_get_type cleanup Date: Tue, 30 Jun 2009 09:25:00 -0000 User-Agent: KMail/1.11.90 (Linux/2.6.24-24-generic; KDE/4.2.90; i686; svn-979530; 2009-06-10) MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_ModSKGerMgeE2ap" Message-Id: <200906301325.32442.vladimir@codesourcery.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-06/txt/msg00857.txt.bz2 --Boundary-00=_ModSKGerMgeE2ap Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-length: 56 I've checked in the below obvious cleanup. - Volodya --Boundary-00=_ModSKGerMgeE2ap Content-Type: text/x-patch; charset="UTF-8"; name="use_type_to_string.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="use_type_to_string.diff" Content-length: 1894 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 + + * varobj.c (varobj_get_type): Use type_to_string. + 2009-06-29 Pedro Alves * 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. */ --Boundary-00=_ModSKGerMgeE2ap--