help-gplusplus
[Top][All Lists]
Advanced

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

Re: backtrace and demangling symbols at runtime


From: Bernd Strieder
Subject: Re: backtrace and demangling symbols at runtime
Date: Fri, 12 May 2006 09:23:35 +0200
User-agent: KNode/0.10.2

Mehturt@gmail.com wrote:

> Consider this example:
> 
> class A
> {
> public:
> A() {}
> };
> 
> class B
> {
> public:
> B() {}
> private:
> A a;
> };
> 
> int main()
> {
> B b;
> return 0;
> }
> 
> Note that class A is implemented in a shared library linked
> dynamically
> to my example.  I see the backtrace from A's constructor, but I don't
> see anything about B, the backtrace looks like this:
> 
> (stuff called from A's constructor)
> A::A
> __gxx_personality_v0
> __gxx_personality_v0
> __libc_start_main
> __gxx_personality_v0
> 
> So my problem is I don't see where A is created from.

Probably due to inlining. You have all the code in one compilation unit.
If a constructor only calls another constructor, only that call might
be left after inlining. There are other optimization techniques with a
great influence on the call stack, e.g. tail call optimization, and I
don't know how well backtrace does with all of it. In my experience
even gdb can produce quite confusing displays on optimized code,
although it probably has better chances to get reasonable results.

Try compiling with -O0, or try different compilation units, or add code
to print messages.

Bernd Strieder




reply via email to

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