[Ltrace-devel] ltrace: Try to fix MIPS arch (tested against git-fcf256c)

Sedat Dilek sedat.dilek at gmail.com
Sat Sep 1 00:48:06 UTC 2012


On Sat, Sep 1, 2012 at 2:15 AM, Petr Machata <pmachata at redhat.com> wrote:
> Sedat Dilek <sedat.dilek at gmail.com> writes:
>
>> My experiments were done on a Ubuntu/precise AMD64 host.
>> The MIPSEL toolchain consists of binutils-2.22, gcc-4.6.3 and
>> uClibc-0.9.32.1 and was provided as a so-called download-toolchain
>> provided by the Freetz project.
>>
>> So a quick walk-trough my "patch" (it is compile-tested but not tested
>> on bare metal!!!):
>
> It's a first step.  It will at least save whoever will do the actual
> porting a bit of trouble.
>
>> [ breakpoints.c ]
>>
>> MIPS arch has no own "breakpoints.c".
>> IIRC sth, was wrong with "list_of_symbols" in
>> enable_all_breakpoints()... "Process" has no member "list_of_symbols",
>> so cut off the mips-ifdef part.
>> Just testing compiles or not.
>
> Cutting this actually seems reasonable.  There was a similar ifdef for
> PPC, and that is now gone as well (and PPC works fine).  I believe
> ltrace now handles delaying breakpoint enablement.
>
>> [ handle_event.c ]
>>
>> Fix "pred" uninitialized in pending_new_remove().
>
> That should go into a separate patch.  It's a good catch, but
> conceptually has nothing to do with cleaning up MIPS.
>
>> Same as for breakpoints.c cut off the mips-ifdef, seen
>> "list_of_symbols" errors in handle_breakpoint().
>
> Hmm, that seems like an implementation of the delayed start.  I think
> this can be removed as well, with the same rationale as above.
>
>> [ ltrace-elf.h ]
>>
>> Unfortunately, the ARCH_HAVE_LTELF_DATA defined in
>> "sysdeps/linux-gnu/mipsel/arch.h" is somehow not recognized.
>> Restore the mips-ifdef part thrown out in struct ltelf {}.
>> See commit e67635d6dcec ("Move arch-specific bits from ltrace-elf.c to
>> PPC and MIPS back ends") for more details.
>
> This is not acceptable.  If what you are seeing is redefinition error,
> then arch.h might be included twice.  Note that it has no inclusion
> guard.  The proper way to fix this is to put inclusion guards to that
> file.
>
>> [ sysdeps/linux-gnu/mipsel/plt.c ]
>>
>> Add missing "library.h" include
>>
>> [ sysdeps/linux-gnu/mipsel/trace.c ]
>>
>> Add missing "backend.h" include
>>
>> Furthermore, I added the diff to original ltrace.mk and outputs of
>> "make dirclean|unpacked|precompiled" of libelf and ltrace (depends on
>> libelf) packages.
>
> ltrace.mk is not part of ltrace distribution, so this is out of scope.
>
>> As a bonbon I added syscallent.h.diff (signalent.h.diff was empty).
>
> That should also go to a separate patch.
>

That highly depends on the target's Linux kernel version (see attached
linux-2.6.13.1_syscallent.h.diff, the previous one was linux-2.6.32).

[ freetz/make/ltrace/ltrace.mk ]
...
# Copy original header files and regenerate them using
mksyscallent_mips and mksignalent scripts
$(PKG)_CONFIGURE_PRE_CMDS += ( \
       cd sysdeps/linux-gnu/mips ; \
       cp syscallent.h syscallent.h.orig ; \
       cp signalent.h signalent.h.orig ; \
       ../mksyscallent_mips
$(TARGET_TOOLCHAIN_STAGING_DIR)/usr/include/asm/unistd.h >
syscallent.h ; \
       ../mksignalent
$(TARGET_TOOLCHAIN_STAGING_DIR)/usr/include/asm/signal.h > signalent.h
; \
       );
...

I can't say if such a hack is required for ltrace's upstream build-system.

> Would you please split your work into three patches as indicated, format
> them using git format-patch, and post them to the list so that I can
> include them in the distribution?
>

Dunno, if I have understood correctly what you mean with 3 patches.
Please, check them and tell me if it's OK or not.

NOTE: Together with your patch and my 3 patches as follow-ups (see
attachments), I can build ltrace-git on MIPS.

Thank you for your help.

- Sedat -

> Thank you,
> PM
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-mips-Remove-ifdef-for-MIPS-in-breakpoints.c.patch
Type: application/octet-stream
Size: 1857 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/ltrace-devel/attachments/20120901/265707ae/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-mips-Remove-ifdef-for-MIPS-in-handle_event.c.patch
Type: application/octet-stream
Size: 1683 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/ltrace-devel/attachments/20120901/265707ae/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-handle_event.c-Fix-error-pred-uninitialized-in-pendi.patch
Type: application/octet-stream
Size: 887 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/ltrace-devel/attachments/20120901/265707ae/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-mips-arch-from-pmachata.patch
Type: application/octet-stream
Size: 1356 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/ltrace-devel/attachments/20120901/265707ae/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: linux-2.6.13.1_syscallent.h.diff
Type: application/octet-stream
Size: 2622 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/ltrace-devel/attachments/20120901/265707ae/attachment-0004.obj>


More information about the Ltrace-devel mailing list