The missing frame.

Why is my backtrace-recording code not properly recording backtrace ? And the true question is … is it really not back-tracing correctly ?

  • malloc < new() < __gnu_cxx::new_allocator < Vector_base < std::vector … ” is missing __gnu_cxx::new_allocator.
  • “malloc < new() < TestBasicScript() < main() is missing TestBasicScript.
  • malloc < GameScript ctor < TestBasicScript is complete. good.
  • malloc < operator new  < GameScript ctor < TestBasicScript < main is missing the ctor.

Having a look at the disassembled code explains already some of the things. For instance, remembering me that neither the constructor calls operator new, nor the operator new calls the constructor. No. The function constructing an object, TestBasicScript, calls both the “operator new” (_Znwj) and then the constructor.

Next interesting thing, operator new is systematically the function whose caller is missing. That can be explained if operator new itself is not creating some stack frame.

void TestBasicScript() {
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 56 push %esi
4: 53 push %ebx
5: 83 ec 20 sub $0x20,%esp
/home/pype/DS/tests/BasicScript.cpp:6
BufferReader *ir = new BufferReader("print \"hello\"\nend\n");
8: c7 04 24 0c 00 00 00 movl $0xc,(%esp)
_ZN12BufferReaderD0Ev():
f: e8 fc ff ff ff call _Znwj
14: 89 c3 mov %eax,%ebx
16: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
1d: 00
1a: R_386_32 .rodata
_ZN11InputReaderD2Ev():
1e: 89 1c 24 mov %ebx,(%esp)
21: e8 fc ff ff ff call _ZN12BufferReaderC1EPKc
_ZN12BufferReaderC2EPKc():
26: 89 5d f0 mov %ebx,-0x10(%ebp)

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.