This is the mail archive of the gdb@sources.redhat.com 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]

Re: gdbserver on arm and multithreading again


Frank,

Do you need to build gdb as a cross-gdb?

I had to build gdb twice. Once for the ARM target (for gdbserver). And again 
for a gdb that runs on my x86 host but understands arm binaries.

Here is how I built:

tar xzf gdb-5.3-tar.gz
mkdir build-i686-to-arm
mkdir build-arm

cd build-i686-to-arm

../gdb-5.3/configure --host=i686-pc-linux-gnu \
                     --target=arm-linux \
                     --build=i686-pc-linux-gnu
make

cd ../build-arm

HOSTCC=gcc CC='arm-linux-gcc' CFLAGS='-msoft-float' \
../gdb-5.3/configure --host=arm-linux \
                     --target=arm-linux \
                     --build=i686-pc-linux-gnu
make


On Thursday 17 July 2003 04:09 am, unknown wrote:
> Hi
>
> I read many postings about this, but I cannot get it working. :(
>
> My Testprogram:
> --
> #include <stdio.h>
> #include <pthread.h>
> #include <sched.h>
>
> void * Thread1( void * p )
> {
>   char * ptr = 0;
>   *ptr = 0; // Make Segfault in Thread
>   return NULL;
> }
>
>
> int main( int argc, char ** argv )
> {
>   pthread_t pid;
>   pthread_create( &pid, NULL, Thread1, NULL );
>   pthread_join( pid, NULL );
>   return 0;
> }
>
> -----------------------------------------------------------
>
> I built gdbserver like this:
>
> frank@ruhe:/arbeit/gdbserver$ export
> CC=/usr/local/arm-linux/bin/arm-linux-gcc
> frank@ruhe:/arbeit/gdbserver$
> ../gdb+dejagnu-20030716/gdb/gdbserver/configure
> --prefix=/usr/local/arm-linux arm-unknown-linux-gnu
> creating cache ./config.cache
> checking for gcc... /usr/local/arm-linux/bin/arm-linux-gcc
> checking whether the C compiler (/usr/local/arm-linux/bin/arm-linux-gcc
> ) works... yes
> checking whether the C compiler (/usr/local/arm-linux/bin/arm-linux-gcc
> ) is a cross-compiler... yes
> checking whether we are using GNU C... yes
> checking whether /usr/local/arm-linux/bin/arm-linux-gcc accepts -g...
> yes
> checking host system type... arm-unknown-linux-gnu
> checking target system type... arm-unknown-linux-gnu
> checking build system type... arm-unknown-linux-gnu
> checking for a BSD compatible install... /usr/bin/install -c
> checking how to run the C preprocessor...
> /usr/local/arm-linux/bin/arm-linux-gcc -E
> checking for ANSI C header files... yes
> checking for sgtty.h... yes
> checking for termio.h... yes
> checking for termios.h... yes
> checking for sys/reg.h... no
> checking for string.h... yes
> checking for proc_service.h... no
> checking for sys/procfs.h... yes
> checking for thread_db.h... yes
> checking for linux/elf.h... yes
> checking for stdlib.h... yes
> checking for unistd.h... yes
> checking whether strerror must be declared... no
> checking for lwpid_t in sys/procfs.h... yes
> checking for psaddr_t in sys/procfs.h... yes
> checking for prgregset_t in sys/procfs.h... yes
> checking for prfpregset_t in sys/procfs.h... yes
> checking whether prfpregset_t type is broken... yes
> checking for elf_fpregset_t in sys/procfs.h... yes
> checking for libthread_db... -lthread_db
> updating cache ./config.cache
> creating ./config.status
> creating Makefile
> creating config.h
>
> after make...
>
> frank@ruhe:file gdbserver
> gdbserver: ELF 32-bit LSB executable, ARM, version 1 (ARM), for
> GNU/Linux 2.0.0, dynamically linked (uses shared libs), not stripped
>
> -------------------------------------------------------
>
> Ok, then I start gdbserver and connect with gdb.
>
> (gdb) target remote 192.168.0.127:2222
> Remote debugging using 192.168.0.127:2222
> 0x000080e0 in _start ()
> (gdb) c
> Continuing.
> #
> Program received signal SIGSEGV, Segmentation fault.
> 0x0000f354 in __sigsuspend (set=0xbffffc48) at
> ../sysdeps/unix/sysv/linux/sigsuspend.c:55
> 55      ../sysdeps/unix/sysv/linux/sigsuspend.c: Datei oder Verzeichnis
> nicht gefunden.
>         in ../sysdeps/unix/sysv/linux/sigsuspend.c
> (gdb) bt
> #0  0x0000f354 in __sigsuspend (set=0xbffffc48) at
> ../sysdeps/unix/sysv/linux/sigsuspend.c:55
> #1  0x0000a7c4 in __pthread_wait_for_restart_signal (self=0x85b20) at
> pthread.c:942
> #2  0x00008690 in pthread_join (thread_id=1026, thread_return=0x0) at
> restart.h:36
> #3  0x00008240 in main (argc=1, argv=0xbffffde4) at test.c:17
> (gdb)
>
>
> nothing about the thread. What can I do?
>
> Thanks for any answer
> Frank Benoit
>
> ( benoit at tionex dot de )


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