ARM EABI / Thumb vs. gdb
Khem Raj
raj.khem at gmail.com
Thu Jul 17 15:37:29 UTC 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Johannes Stezenbach wrote:
> Hi,
>
> I've built an ARM EABI toolchain with uClibc compiled as
> Thumb code using buildroot (BR2_TARGET_OPTIMIZATION="-Os -mthumb").
>
> This works fine except that in gdb (6.8), if you stop your program
> with some threads blocked in syscalls, gdb is unable to display
> a call stack for those threads.
>
> The reason for this is that gdb's calculation of the stack
> frame size is off because of the "push {r7}" used in the syscall code.
> (INTERNAL_SYSCALL in uClibc/libc/sysdeps/linux/arm/bits/syscalls.h)
>
> Rather than fixing gdb (specifically thumb_analyze_prologue() in
> arm-tdep.c), I made a local change to avoid changing the stack
> pointer in INTERNAL_SYSCALL, like so:
>
> - asm volatile ("push {r7}\n" \
> - "\tmov r7, v3\n" \
> - "\tswi 0 @ syscall " #name "\n" \
> - "\tpop {r7}" \
>
> + __asm__ volatile ("push {r7}\n" \
> + "\tmov r7, v3\n" \
> + "\tpop {v3}\n" \
> + "\tswi 0 @ syscall " #name "\n" \
> + "\tmov r7, v3\n" \
>
> But just before posting here I took a peek into the NPTL
> branch and noticed that there is a better patch which avoids
> the "push {r7}" altogether:
Good you found it. otherwise thats what I would have pointed you to.
>
>
> Please consider merging this change into trunk.
uclibc-nptl branch soon collapse into trunk so this changeset will make through.
>
>
> Thanks,
> Johannes
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://busybox.net/cgi-bin/mailman/listinfo/uclibc
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFIf2c5HnJKy6V6em4RAiscAKCSkJRbI+Z1xUNG1+RERfxjjlZ9WACeOM3K
7W11rMuK0eff0r5i5OSZTCA=
=zOx3
-----END PGP SIGNATURE-----
More information about the uClibc
mailing list