From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18183 invoked by alias); 30 Jul 2007 13:41:32 -0000 Received: (qmail 18171 invoked by uid 22791); 30 Jul 2007 13:41:31 -0000 X-Spam-Check-By: sourceware.org Received: from esparsett.troll.no (HELO esparsett.troll.no) (62.70.27.18) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 30 Jul 2007 13:41:28 +0000 Received: from esparsett.troll.no (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id 0A3B3742DE; Mon, 30 Jul 2007 15:41:26 +0200 (CEST) Received: from gar.local (unknown [10.4.0.24]) by esparsett.troll.no (Postfix) with ESMTP id DF00A742C3; Mon, 30 Jul 2007 15:41:25 +0200 (CEST) From: =?iso-8859-1?q?Andr=E9_P=F6nitz?= To: gdb-patches@sourceware.org Subject: Type information in -data-evaluate-expression Date: Mon, 30 Jul 2007 13:52:00 -0000 User-Agent: KMail/1.9.6 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_rperGKgWpmSjkSE" Message-Id: <200707301540.59361.apoenitz@trolltech.com> X-IsSubscribed: yes 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: 2007-07/txt/msg00311.txt.bz2 --Boundary-00=_rperGKgWpmSjkSE Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 1010 Hi all. While playing around with gdb's "mi" interface (which looks rather nice for scripting btw...) I came across a few places where I think the interface might be made even more convienient without much effort. One example: As far as I can see currently the only way to obtain the type of an expression is to use -var-create & -var-delete. It would be more convienient for me if I could get that information with a single command without creating a variable which will be thrown away immediatedly afterwards. A possibility to do so would be to "enhance" "-data-evaluate-expression" to return not only the value, but also the type information which is is available after the evaluation process anyway. I came up with a tiny patch that "seem to work for me". But as this is the first time I look gdb source I am unsure whether this is done properly or if some kind of cleanup is needed, and, of course, whether there is a chance to get such patches included in gdb proper at some point of time. Andre' --Boundary-00=_rperGKgWpmSjkSE Content-Type: text/x-diff; charset="us-ascii"; name="t" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="t" Content-length: 536 Index: mi-main.c =================================================================== RCS file: /cvs/src/src/gdb/mi/mi-main.c,v retrieving revision 1.100 diff -u -r1.100 mi-main.c --- mi-main.c 16 Jun 2007 17:16:26 -0000 1.100 +++ mi-main.c 30 Jul 2007 13:08:51 -0000 @@ -706,6 +706,11 @@ stb->stream, 0, 0, 0, 0); ui_out_field_stream (uiout, "value", stb); + + type_print (value_type (val), "", stb->stream, -1); + + ui_out_field_stream (uiout, "type", stb); + ui_out_stream_delete (stb); do_cleanups (old_chain); --Boundary-00=_rperGKgWpmSjkSE--