public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* bug in 5.2.1 (and latest cvs)
@ 2002-07-27  8:35 Andrew Walrond
  0 siblings, 0 replies; only message in thread
From: Andrew Walrond @ 2002-07-27  8:35 UTC (permalink / raw)
  To: gdb

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-07-27 15:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-27  8:35 bug in 5.2.1 (and latest cvs) Andrew Walrond

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).