I am trying to figure out the backtrace of my program when a certain function is being called. There are three examples of this procedure
here. In no case do any of the examples produce functions with line numbers. If and when I have a backtrace with function names and offsets or straight addresses I would like to be able to get a function name and line number.
It turns out addr2line and objdump [apparently a port of dump(CP)] do exist on my flavor on Linux, so I will check them out to see if I can get what I want out of them.
[I'll gladly accept advice on getting the backtrace with line numbers. What I've been doing with some success has been to invoke gdb against my own process and make gdb give me the backtrace. In my particular case it seems the atexit() function has been called twice so a certain function atexitFunc() is called twice. Inside atexitFunc() I'm using system() to call a shell script with my pid -- gdb uses my pid to attach to the caller of system() and then do a backtrace. Unfortunately, this solution does not work in all cases -- the first time around the backtrace via gdb looks good -- the second time gdb says the process does not exist. My solution in this case is to use the LinuxJournal article's example 1 and generate a backtrace within the program -- unfortunately I do not get line numbers, hence the desire to convert addresses of executable code to function names and line numbers.]
Thank you for any help you can render on this issue. It would be nice if there were more support for backtraces with line numbers!