This is the mail archive of the
mailing list for the binutils project.
getting the line of a function when walking the stack with libbfd
- From: Vincent Torri <vincent dot torri at gmail dot com>
- To: binutils at sourceware dot org
- Date: Mon, 19 Mar 2012 19:03:04 +0100
- Subject: getting the line of a function when walking the stack with libbfd
I'm writting a small tool that traces the stack, using libbfd. I've
found several programs    which are doing basically the same
1) initialize bfd, dbghelp and other stuff
2) call StackWalk()
3) for each frame, call bfd_find_nearest_line() to get the line, and
function and file names
But all of them do not find the correct line where the function is
called. It seems that the line is actually the one finishing the
function (that is a 'return' call or the closing curly bracket)
Is it normal (of course in bfd_find_nearest_line() name, there is
'nearest' ...) ?
Is there a solution to get the correct line where the function calls are done ?