Reading the symbol table of the currently running executable

Clifford Neuman bcn at cs.washington.edu
Thu Aug 31 06:22:32 AEST 1989


Does anyone know how to read the symbol table of a program from within
that program itself?  More precisely, from within a procedure in a
library which was used in linking the executable.  The simplest way is
to read the symbol table from the executable.  Unfortunately, I might
not know the name of the executable.  I can solve my problem in any of
several ways, and I would appreciate suggested solutions to any of
these problems.

  1) Directly reading the symbol table from within the running program

  2) Obtaining the full path name of the presently running executable.
     Remember, argv[0] will not contain the full path if the executable was
     found through the search path.  Also, the program may have been
     started by execl with an argv[0] that is unrelated to the file name.

  3) Obtaining a file descriptor for the currently running executable
     (i.e. I don't need the name as long as I can read it).

Please respond to me directly since I do not normally read this list.
I will summarize any personal responses I receive.  Thanks,

	~ Cliff

PS: I am presently using a Vax running Ultrix 3.0, but I will
    will ultimately need to do this under other versions of
    Unix as well.



More information about the Comp.unix.wizards mailing list