Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Getting source file name and line number

I think in the end, it's still better to have CDT call addr2line for you. You get the advantage of the abstraction of all the binary formats and such. One format might not need to call addr2line and it will be hidden for you.

Marc-Andre
________________________________________
From: Alexandre Montplaisir [alexmonthy@xxxxxxxxxxxx]
Sent: Friday, 04 September 2015 3:57 PM
To: Marc-André Laperle
Cc: CDT General developers list.
Subject: Re: [cdt-dev] Getting source file name and line number

Hi Marc-André!

My object was getting assigned a ElfBinaryShared type, not the GNUElf-
variant.

That did point me in the direction of org.eclipse.cdt.utils.Addr2line
though, which seemed interesting! Until I noticed it's simply calling
"addr2line" manually via a Process, which I can do on my own. I would
have to anyway, because I need the "--inlines" flag, which Addr2line is
not passing.

I'll play with it a bit more to make sure I'm reading the file
correctly. Once I can narrow it down to a simple self-contained test
case I'll open a bug about the null ISymbol.getFileName().


Thanks,
Alexandre



On 2015-09-04 03:21 PM, Marc-André Laperle wrote:
> Is GNUElfBinaryObject.symbolLoadingAddr2line null by any chance? I'm not sure what the problem would be. Maybe you can create a bug, attach your binary and we can troubleshoot what's going on. Perhaps it is a bug.
>
> Marc-Andre
>
> ________________________________________
> From: cdt-dev-bounces@xxxxxxxxxxx [cdt-dev-bounces@xxxxxxxxxxx] on behalf of Alexandre Montplaisir [alexmonthy@xxxxxxxxxxxx]
> Sent: Friday, 04 September 2015 3:09 PM
> To: cdt-dev@xxxxxxxxxxx
> Subject: [cdt-dev] Getting source file name and line number
>
> Hi all,
>
> I'm trying to use CDT to retrieve the source file name and line number
> for a given offset in a shared object compiled with debugging symbols.
> Basically, the functionality offered by "addr2line".
>
> I've manged to get a IBinaryParser.IBinaryObject for my shared object.
> Then I'm iterating on all its ISymbols. The symbols exist and match what
> I would expect. But for all of them the getFileName() always returns
> null, so I'm not sure how to get the source file name, let alone the
> line numbers. addr2line works on the very same shared object.
>
> The addresses I'm looking for don't exactly match a symbol (function or
> variable name), but I've used ISymbol because that's the only thing I
> saw that has the notion of address -> line number. Could that be the
> problem? Or is my approach wrong?
>
> Thanks!
> Alexandre
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/cdt-dev



Back to the top