[Ltrace-devel] [patch] Will let versions of ltrace that need "_start" worked with stripped target program.

PAUL GILLIAM pgilliam at us.ibm.com
Mon Apr 24 18:44:49 UTC 2006


Some versions of ltrace (only ppc so far) need to set a breakpoint at
"_start", or somewhere, so that breakpoints can be set *after* the
dynamic loader has run.  By default, ltrace looks for "_start" in the
symbol table.  But if the target program has been stripped, there is
none.

This patch changes things so that if "_start" (or whatever the user
specified using -X) could not be found, the value of "e_entry" in the
elf header will be assumed to be that address.

This patch *also* makes all the "_start" stuff conditional on
E_ENTRY_NAME.  If an architecture doesn't need this stuff, then it
doesn't define E_ENTRY_NAME in it's "arch.h" file (which is copied
to sysdep/linux-gnu/sysdep.h)

I have tested this on ppc and x86 using the testsuite.

I will commit this before I go home tonight, unless someone objects.

-=# Paul #=-

Here is a copy of the ChangeLog entry:

        * elf.c: Use E_ENTRY_NAME for those architectures that need to
        re-initialize breakpoints after the dynamic linker has run.
        Also, use value of "e_entry" for address of E_ENTRY_NAME if the
        target program has been stripped.
        * ltrace.1: Note that fact that "-X" is only available on
        architectures that need it.
        * options.c: Use E_ENTRY_NAME for those architectures that need
        to
        re-initialize breakpoints after the dynamic linker has run.
        * process_event.c: ditto.
        * sysdeps/linux-gnu/ppc/arch.h: This is the only such
        architecture.
        * sysdeps/linux-gnu/arm/arch.h: Delete use of E_ENTRY_NAME.
        * sysdeps/linux-gnu/m68k/arch.h: ditto.
        * sysdeps/linux-gnu/alpha/arch.h: ditto.
        * sysdeps/linux-gnu/i386/arch.h: ditto.
        * sysdeps/linux-gnu/x86_64/arch.h: ditto.
        * sysdeps/linux-gnu/s390/arch.h: ditto.
        * sysdeps/linux-gnu/ia64/arch.h: ditto.
        * sysdeps/linux-gnu/sparc/arch.h: ditto.
        
        
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stripped.diff
Type: text/x-patch
Size: 10707 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/ltrace-devel/attachments/20060424/8f141df0/stripped.bin


More information about the Ltrace-devel mailing list