From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 999 invoked by alias); 31 Jul 2008 09:03:46 -0000 Received: (qmail 989 invoked by uid 22791); 31 Jul 2008 09:03:43 -0000 X-Spam-Check-By: sourceware.org Received: from hoat.troll.no (HELO hoat.troll.no) (62.70.27.150) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 31 Jul 2008 09:03:13 +0000 Received: from hoat.troll.no (tedur.troll.no [62.70.27.154]) by hoat.troll.no (Postfix) with SMTP id C03AA20545 for ; Thu, 31 Jul 2008 11:03:10 +0200 (CEST) Received: from gar.trolltech.de (gar.trolltech.de [10.4.0.24]) by hoat.troll.no (Postfix) with ESMTP id A825020163 for ; Thu, 31 Jul 2008 11:03:10 +0200 (CEST) From: =?iso-8859-1?q?Andr=E9_P=F6nitz?= To: gdb@sources.redhat.com Subject: "print object on" and MI interface Date: Thu, 31 Jul 2008 09:29:00 -0000 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200807311105.38705.apoenitz@trolltech.com> 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/msg00345.txt.bz2 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 =3D new derived; b->x =3D 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 copyin= g\"\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 =3D (derived *) 0x602780\n" ^done -var-create b * b ^done,name=3D"b",numchild=3D"1",value=3D"0x602780",type=3D"base *" -var-info-type b ^done,type=3D"base *" -symbol-type b ^error,msg=3D"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, t= oo? Thank you for your help in advance, Andr=E9=20