From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14926 invoked by alias); 27 Jul 2002 15:35:22 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 14919 invoked from network); 27 Jul 2002 15:35:21 -0000 Received: from unknown (HELO gaea.projecticarus.com) (195.10.228.71) by sources.redhat.com with SMTP; 27 Jul 2002 15:35:21 -0000 Received: from [192.168.128.13] (host213-1-140-162.in-addr.btopenworld.com [213.1.140.162]) by gaea.projecticarus.com (8.11.6/8.11.6) with ESMTP id g6RFZKK18771 for ; Sat, 27 Jul 2002 16:35:20 +0100 Subject: bug in 5.2.1 (and latest cvs) From: Andrew Walrond To: gdb@sources.redhat.com Content-Type: text/plain Content-Transfer-Encoding: 7bit Date: Sat, 27 Jul 2002 08:35:00 -0000 Message-Id: <1027783729.27596.20.camel@pan> Mime-Version: 1.0 X-SW-Source: 2002-07/txt/msg00296.txt.bz2 I have discussed this before, gone away and tried to fathom the problem myself, but the learning curve was too steep for the time I have available, so I present the bug here, and in the bug database. gcc (g++) 3.x might be significant if you want to try it... With newly built gdb 5.2.1 and gcc 3.1.1 (On several intel gnu/linux test platforms - it's not just me!)... struct Base { int a; //Take out this line and it works virtual void fn()=0; }; struct Intermediate : virtual Base //remove virtual and it works { }; struct Derived : Intermediate { virtual void fn(); }; void Derived::fn() { int a=1; int b=2; int c = a+b; } //....here! (see below) int main(int argc,char* argv[]) { Derived d; Base* p = &d; p->fn(); //'s' here ends up.... return 0; } [thunk]$ g++ -g2 -o thunk thunk.cpp [thunk]$ gdb thunk GNU gdb 5.2.1 Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"... (gdb) break main Breakpoint 1 at 0x8048650: file thunk.cpp, line 26. (gdb) run Starting program: /home/daedalus/src/thunk/thunk Breakpoint 1, main (argc=1, argv=0xbffffa34) at thunk.cpp:26 26 Derived d; (gdb) n 27 Base* p = &d; (gdb) n 28 p->fn(); //'s' here ends up.... (gdb) s virtual thunk to Derived::fn() () at thunk.cpp:22 22 } //....here! (see below) (gdb) s main (argc=1, argv=0xbffffa34) at thunk.cpp:29 29 return 0; (gdb) n 30 } (gdb) c Continuing. With more complex programmes and multiple files, the step can end up anywhere. It doesn't always land on the exiting brace. Anyway I hope that someone who understands gdb better might be able to sort this out (and if you do, please let me know!) Andrew Walrond