This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

getting the line of a function when walking the stack with libbfd


Hey

I'm writting a small tool that traces the stack, using libbfd. I've
found several programs [1] [2] [3] which are doing basically the same
thing :

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 ?

thank you

Vincent Torri

[1] http://linuxgazette.net/151/misc/melinte/addr2line.c
[2] http://code.google.com/p/backtrace-mingw/source/browse/trunk/backtrace.c
[3] https://bitbucket.org/edd/stack_trace/src/0d266476cb67/src/stack.cpp


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]