[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How does one get static procedure names?
From: |
Bruce Korb |
Subject: |
Re: How does one get static procedure names? |
Date: |
Tue, 27 Oct 2009 12:43:13 -0700 |
On Tue, Oct 27, 2009 at 12:37 PM, Daniel Jacobowitz <address@hidden> 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!