Reading the symbol table of the currently running executable

Adam R de Boor deboor at buddy.Berkeley.EDU
Mon Sep 4 09:02:35 AEST 1989


Wrong. The core file doesn't contain the symbol table. The way I've always
handled things of this nature is to use argv[0] and look for an executable
file of the same name along $PATH. Useful also for having a configuration 
file that resides in the same directory as the executable, but they
both can be wherever one wants them to be.

True, this plan does have a few flaws (you have to have argv[0]), but you're
not going to get anywhere via /dev/mem short of locating the text-table entry
for the process in the kernel, reading the inode structure to obtain the
inode number, then looking through the filesystem (or $PATH again :) for a file
with that number...

a



More information about the Comp.unix.wizards mailing list