Finding the address of a symbol in a release build

Peter Waller peter.waller@gmail.com
Sun Aug 26 10:56:00 GMT 2007


Thank you Brian. I don't believe I have learnt so much from a single
posting in a very long time. That was very informative, cheers :)

On 26/08/07, Brian Dessent <brian@dessent.net> wrote:
> If it's open source then why not modify the game to provide
> instrumentation hooks to do what you want instead of just poking
> directly at locations in memory and hoping they correspond to what you
> think?

Well, mainly because my way is more 'fun' and I have learnt a
tremendous amount this way. (Hence, my mentioning 'educational' :)

> Assuming your platform is linux[1] and you're using a recent binutils,
> you can in fact create a separate file containing only the debug
> information.  See the comments in the manual for the strip
> --only-keep-debug option for a step-by-step procedure for how to do
> this: <http://sourceware.org/binutils/docs-2.17/binutils/strip.html>

This looks most useful :)

> nm is built on libbfd, so I suppose you could use libbfd directly
> yourself, however this library is traditionally fairly tightly
> integrated with the binutils and so it might not be very easy to use in
> a standalone manner.
>
> There are also standalone DWARF readers[2] such as libdwarf:
> <http://reality.sgiweb.org/davea/dwarf.html>

Interesting, I shall have to investigate.

> [1] You didn't state, and gcc targets dozens of platforms, so be
> specific.  We have no idea what platform you're using unless you say so.

Ah, of course. I will be more specific in the future. Thanks for
taking a good educated guess ;)

Regards,

- Peter



More information about the Gcc-help mailing list