From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2969 invoked by alias); 31 Jul 2008 09:33:36 -0000 Received: (qmail 2959 invoked by uid 22791); 31 Jul 2008 09:33:36 -0000 X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 31 Jul 2008 09:33:06 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KOUWp-0006NQ-86 for gdb@sources.redhat.com; Thu, 31 Jul 2008 09:32:59 +0000 Received: from 78.158.192.230 ([78.158.192.230]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 31 Jul 2008 09:32:59 +0000 Received: from vladimir by 78.158.192.230 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 31 Jul 2008 09:32:59 +0000 To: gdb@sources.redhat.com From: Vladimir Prus Subject: Re: "print object on" and MI interface Date: Thu, 31 Jul 2008 09:43:00 -0000 Message-ID: References: <200807311105.38705.apoenitz@trolltech.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8Bit User-Agent: KNode/0.10.9 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-07/txt/msg00347.txt.bz2 André Pönitz wrote: > > Hi all. > > I have a problem with accessing the dynamic type of a variable using > gdb's MI interface. > > Given the following code > > struct base { virtual ~base() {}; int x; }; > > struct derived : public base { }; > > int main() > { > base *b = new derived; > b->x = 1; > } > > > I get using "gdb -i mi" the following session (skipping the prompts > to improve readability) > > ~"GNU gdb 6.8-debian\n" > ~"Copyright (C) 2008 Free Software Foundation, Inc.\n" > ~"License GPLv3+: GNU GPL version 3 or later \n" > ~"This is free software: you are free to change and redistribute it.\n" > ~"There is NO WARRANTY, to the extent permitted by law. Type \"show copying\"\n" > ~"and \"show warranty\" for details.\n" > ~"This GDB was configured as \"x86_64-linux-gnu\"...\n" > > set print object on > ^done > > break main.cpp:10 > ~"Breakpoint 1 at 0x4008ca: file /tmp/p/main.cpp, line 10.\n" > ^done > > run > ~"Starting program: /tmp/p/p \n" > ~"[Thread debugging using libthread_db enabled]\n" > ~"[New Thread 0x2ac921fdcf20 (LWP 32536)]\n" > ~"[Switching to Thread 0x2ac921fdcf20 (LWP 32536)]\n" > ~"\n" > ~"Breakpoint 1, main () at /tmp/p/main.cpp:10\n" > ~"10\t}\n" > ^done > > p b > ~"$1 = (derived *) 0x602780\n" > ^done > > -var-create b * b > ^done,name="b",numchild="1",value="0x602780",type="base *" > > -var-info-type b > ^done,type="base *" > > -symbol-type b > ^error,msg="Undefined mi command: symbol-type (missing implementation)" > > > So the CLI seems to know the dynamic type of 'b', namely 'derived'. The MI > interface only seems to provide the static type, or warns about a missing > implementation. The "-symbol-type" command is documented at > http://sourceware.org/gdb/current/onlinedocs/gdb_25.html, though. > > What could I do to convince the MI interface to give me the dynamic type, too? Nothing, it's not implemented yet. It's one of two high-priority issues in my queue, however. - Volodya