[EMAIL PROTECTED] 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


_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to