Re: instrumenting ELF executables

pg+nm@sabi.Clara.co.UK (Piercarlo Grandi)
26 Mar 2001 13:41:55 -0500

          From comp.compilers

Related articles
instrumenting ELF executables drath@delsoft.com (Dipak Rath) (2001-03-22)
Re: instrumenting ELF executables pg+nm@sabi.Clara.co.UK (2001-03-26)
Re: instrumenting ELF executables plakal@cs.wisc.edu (Manoj Plakal) (2001-03-27)
Re: Re: instrumenting ELF executables mihai@cs.wisc.edu (Mihai Christodorescu) (2001-03-27)
| List of all articles for this month |
From: pg+nm@sabi.Clara.co.UK (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 <drath@delsoft.com> 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':


    http://WWW.stud.Uni-Hannover.DE/~michael/software/


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:


    http://WWW.INRIA.FR/rrrt/rr-2980.html


(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.