Re: instrumenting ELF executables (Piercarlo Grandi)
26 Mar 2001 13:41:55 -0500

          From comp.compilers

Related articles
instrumenting ELF executables (Dipak Rath) (2001-03-22)
Re: instrumenting ELF executables (2001-03-26)
Re: instrumenting ELF executables (Manoj Plakal) (2001-03-27)
Re: Re: instrumenting ELF executables (Mihai Christodorescu) (2001-03-27)
| List of all articles for this month |

From: (Piercarlo Grandi)
Newsgroups: comp.compilers,comp.arch
Date: 26 Mar 2001 13:41:55 -0500
Organization: Geeks-R-Us
References: 01-03-114
Keywords: linker, performance
Posted-Date: 26 Mar 2001 13:41:55 EST

>>> On 22 Mar 2001 01:22:18 -0500, Dipak Rath <> said:

drath> I am working on a problem to generate the execution profile of a
drath> program, now that requires instrumenting the code with some
drath> profiling func calls at appropriate positions. Here I am dealing
drath> with sun executables(in ELF format). The question is how do I do
drath> the required using the elf library routines. [ ... ]

It seems a bit painful to actually read in an executable and then
write out a modified version. Still, there are at least two freeware
tools that might help you in that, 'libelf':


and 'libbfd' (from the GNU binary utilities package). A Sun version of
'libelf' is also bundled with SunOS or Solaris, IIRC.

Do you _really_ want to do this? There are alternatives, e.g.
sampling the program counter, that don't require modifying an
executable, if you have sources you can instrument the source, or the
assembler output instead, for example:


(there is also a much older one for Edition 8 or 9 of UNIX, IIRC, and
it has been cloned by someone else, but I can't remember the name).

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.