how do i find the source code line of a running program compiled with gcc -O5?

Discussion in 'Programming/Scripts' started by glok_twen, Jul 14, 2008.

  1. glok_twen

    glok_twen New Member

    hi. i have a job that's been running in prod on an ubnutu box for a while. it's written in c++, compiled with gcc -O5.

    then it froze up. so i attached gdb and did a bt. can i use any of these hex numbers to cross reference back to my source code in some way? even if i need to re-compile it with a different paramter that ties either the assembly or the address space to source code? way back in the day on a now extinct platform we could compile code with the assembly and line offsets, then use the hex address of a running program to determine in exactly which source line a process was executing at that momement. can i do such a thing with my linux gcc app?

    Code:
    #0  0xb7f6a410 in __kernel_vsyscall ()
    #1  0xb7d992f3 in write () from /lib/tls/i686/cmov/libc.so.6
    #2  0xb7d375a4 in _IO_file_write () from /lib/tls/i686/cmov/libc.so.6
    #3  0xb7d37255 in ?? () from /lib/tls/i686/cmov/libc.so.6
    #4  0xb7d3754f in _IO_do_write () from /lib/tls/i686/cmov/libc.so.6
    #5  0xb7d37d36 in _IO_file_sync () from /lib/tls/i686/cmov/libc.so.6
    #6  0xb7d2c860 in fflush () from /lib/tls/i686/cmov/libc.so.6
    #7  0xb7ed8a10 in ?? () from /usr/lib/libstdc++.so.6
    #8  0xb7eda1d2 in std::ostream::flush () from /usr/lib/libstdc++.so.6
    #9  0xb7edc0a9 in std::endl<char, std::char_traits<char> > () from /usr/lib/libstdc++.so.6
    #10 0x0806a289 in Ctest01::Cgonow ()
     

Share This Page