[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About debugging constructors

From: Paul Pluzhnikov
Subject: Re: About debugging constructors
Date: Mon, 24 Sep 2007 22:05:45 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

"" <> writes:

> MY platform is Linux, RH3

There was a RedHat-3.0.3 release (dated May 1st, 1996).
I very much doubt that that's your platform.

More likely you are using 'Red Hat Enterprise Linux v3', which is
usually abbreviated RHEL-3.

> I forgot to mention that, the GDB is showing some other file too.
> Actually, I am working on a huge compiler that creates an exectuable.


> I am running the executable, which is a pure object code and will some
> time call, the ctors. Now the solution to compile all the
> problem file doing the #include of the header file having the
> constructor will be a bit of work. it will take a lot of time for me
> to do so.
> No the ctor is not inlined

If the ctor is not inlined, then recompiling anything but the file
in which it is defined, is pointless.

Try newer version of gdb; or try setting the breakpoint on machine
address of the first instruction of the ctor. Since it appears that
you don't know how to do so, here is an example:

$ cat
struct Foo {
    int x;

Foo::Foo() : x(42)

int main()
   Foo f;
   return f.x;

$ g++ -g
$ gdb -q ./a.out
Using host libthread_db library "/lib/tls/".
(gdb) p &'Foo::Foo()' 
$1 = (<text variable, no debug info> *) 0x8048372 <Foo>
(gdb) b *0x8048372
Breakpoint 1 at 0x8048372: file, line 6.
(gdb) r

Breakpoint 1, Foo (this=0x1) at
6       Foo::Foo() : x(42)
(gdb) bt
#0  Foo (this=0x1) at
#1  0x0804839c in main () at
(gdb) c

Program exited with code 052.
(gdb) quit

In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]