This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ARM EABI Linux, breakpoints cause SIGILL and target dies


Hey all,

I have Ubuntu's userspace code running inside a chroot on top of
Android's Linux kernel on my phone. Using this, I've built GDB 7.3
from Ubuntu's source package. Here's the system details:

# uname -a
Linux localhost 2.6.35.13 #4 PREEMPT Wed Jan 18 20:25:06 PST 2012
armv7l armv7l armv7l GNU/Linux

# cat /proc/cpuinfo
Processor    : ARMv7 Processor rev 2 (v7l)
BogoMIPS Â Â Â Â: 163.57
Features    Â: swp half thumb fastmult vfp edsp thumbee neon vfpv3
CPU implementer : 0x51
CPU architecture: 7
CPU variant   : 0x1
CPU part    Â: 0x00f
CPU revision  Â: 2

Hardware    Â: runnymede
Revision    Â: 0002
EngineerID Â Â Â: 0001
Serial     Â: 0000000000000000

Here's my source file test.c:

#include <stdio.h>

int main(void) {
 printf("Hello, world!\n");
 printf("Goodbye, world!\n");
 return 0;
}

I'm building it on my target with this GCC:

# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/arm-linux-gnueabi/gcc/arm-linux-gnueabi/4.5.2/lto-wrapper
Target: arm-linux-gnueabi
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.5.2-8ubuntu4'
--with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.5 --enable-shared --enable-multiarch
--with-multiarch-defaults=arm-linux-gnueabi --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib/arm-linux-gnueabi
--without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.5
--libdir=/usr/lib/arm-linux-gnueabi --enable-nls --with-sysroot=/
--enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-plugin --enable-gold
--enable-ld=default --with-plugin-ld=ld.gold --enable-objc-gc
--disable-sjlj-exceptions --with-arch=armv7-a --with-float=softfp
--with-fpu=vfpv3-d16 --with-mode=thumb --disable-werror
--enable-checking=release --build=arm-linux-gnueabi
--host=arm-linux-gnueabi --target=arm-linux-gnueabi
Thread model: posix
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)

And this command line:

gcc -g3 -static -o a.out test.c

Running a.out alone or with GDB works fine, but any operation that
causes GDB to set a breakpoint results in the target being killed by
SIGILL:

# gdb a.out
GNU gdb (Ubuntu/Linaro 7.3.1-2011.12-0ubuntu2) 7.3-2011.12
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. ÂType "show copying"
and "show warranty" for details.
This GDB was configured as "arm-linux-gnueabi".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /root/a.out...done.
(gdb) run
Starting program: /root/a.out
Hello, world!
Goodbye, world!
[Inferior 1 (process 14296) exited normally]
(gdb) start
Temporary breakpoint 1 at 0x81f4: file test.c, line 4.
Starting program: /root/a.out

Program received signal SIGILL, Illegal instruction.
0x000081f6 in main () at test.c:4
4 Â Â Â Â printf("Hello, world!\n");
(gdb) next

Program terminated with signal SIGILL, Illegal instruction.
The program no longer exists.

I noticed that this patch was supposed to add support for SIGILL breakpoints:

http://old.nabble.com/RFC%3A-Updates-support-for-breakpoints-that-generate-SIGILL-p27363713.html

And the target-specific code says that it tries to generate a SIGILL
(arm-linux-tdep.c):

/* However, the EABI syscall interface (new in Nov. 2005) does not look at
 Âthe operand of the swi if old-ABI compatibility is disabled. ÂTherefore,
 Âuse an undefined instruction instead. ÂThis is supported as of kernel
 Âversion 2.5.70 (May 2003), so should be a safe assumption for EABI
 Âbinaries. Â*/

So I would expect that this would work. Another piece of the puzzle, I
have a different phone here running a different Linux kernel, but the
same Ubuntu usermode binaries, where GDB breakpoints work perfectly:

$ uname -a
Linux localhost 2.6.37.6-cyanogenmod-01509-g8913be8 #1 PREEMPT Wed Jul
27 21:31:24 EDT 2011 armv7l GNU/Linux

$ cat /proc/cpuinfo

ProcessorÂÂÂÂÂÂ : ARMv7 Processor rev 2 (v7l)
BogoMIPS: 662.40
Features: swp half thumb fastmult vfp edsp thumbee neon
CPU implementer : 0x51
CPU architecture: 7
CPU variantÂÂÂÂ : 0x0
CPU part: 0x00f
CPU revisionÂÂÂ : 2

Hardware: mahimahi
Revision: 0081
Serial : 0000000000000000

How do I begin to debug this problem? I have the source code available
for both kernels if there is something to investigate there.

Thanks,
Nicholas Sherlock


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]