opensubscriber
   Find in this group all groups
 
Unknown more information…

g : gdb@gnu.org 28 October 2009 • 3:43AM -0400

Re: How does one get static procedure names?
by Bruce Korb

REPLY TO AUTHOR
 
REPLY TO GROUP




On Tue, Oct 27, 2009 at 12:37 PM, Daniel Jacobowitz <drow@fals...> wrote:
> On Tue, Oct 27, 2009 at 12:33:39PM -0700, Bruce Korb wrote:
>> Exactly.  I know it'd be some work.  I think I need to
>> call:  dlopen(NULL, RTLD_NOW)
>
> No.  You need to open the file and have your own ELF and symbol table
> reader.  They are not in the area mapped by dlopen.

OK.  Still not terribly hard:

    {
        static char const exe_fmt[] =
            "/proc/%d/exe";
        char bf[sizeof (exe_fmt) + 12];
        sprintf(bf, exe_fmt, getpid());
        path_len = readlink(bf, exe_path, sizeof (exe_path) - 1);
    }

(This is for Linux only...)

> GDB is almost certainly not where you want to get this code from.  We
> just use BFD...

Ah!  There we go.  That's what I was looking for.  Thank you!



Bookmark with:

Delicious   Digg   reddit   Facebook   StumbleUpon

Related Messages

opensubscriber is not affiliated with the authors of this message nor responsible for its content.