This is the mail archive of the 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]

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

On Tue, Mar 20, 2012 at 05:39:08AM +0100, Vincent Torri wrote:
> On Tue, Mar 20, 2012 at 5:33 AM, Alan Modra <> wrote:
> > On Mon, Mar 19, 2012 at 07:03:04PM +0100, Vincent Torri wrote:
> >> 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)
> >
> > Does addr2line work?
> I actually don't know how to use the addr2line program (I have to pass
> an address and I don't know which value i have to use)

Disassemble some of your binary with objdump to find call sites, plug
in those addresses to addr2line.  Experiment a little with other
addresses near the calls.

There are many possibilites why your stack trace isn't giving you the
lines you expect.  eg.
- You may not realise how stack traces work, ie. that they give
  return addresses, not call site addresses, or
- You may not have any line info in the binary, or
- The line info may be faulty, or
- your binutils BFD may be buggy.

Alan Modra
Australia Development Lab, IBM

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