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]

RE: GDB/GDBSERVER 6.8 for ARM targets not working ??


Hi guy's 


Took me some time ...  But ... just got it working by falling back to
6.7.1.


So GDB/GDBSERVER 6.8 must be broken for ARM.

 
Regards Noel.


-----Original Message-----
From: gdb-owner@sourceware.org [mailto:gdb-owner@sourceware.org] On
Behalf Of Vellemans, Noel
Sent: 5Jun09 09:50
To: gdb@sourceware.org
Subject: GDB/GDBSERVER 6.8 for ARM targets not working ??


Hi all,

Someone out there who can try to describe me what is going on with
GDBSERVER?
 
Been trying for (several WEEKS, yes that long :-( ) to 'cross'-debug
something quite simple and can not get this done.

The goal is to debug REMOTE an application. (Between a host x86 and a
target ARM)
 
I've build a simple application (that contains p-threads and can not
debug this with GDBSERVER & GDB) [this application is called
'threading']

Been trying 1000 things... but I guess by explaining my last findings
that I might get some attention/help.


Please FIRST have a look on the following working / not working list.

A)	Running GDB on the ARM-target (native) is: WORKING.  
	(typed  'gdb ./threading' on the TARGET)

B) 	Running GDB on the host and GDBSERVER on the target: FAILS.
{This is what I need}
	( .gdbinit has set solib******* statements.. included }

C)	Running GDB and GBDSERVER on the ARM-target : FAILS
	{yes both on the same target, console 1 'gdbserver *:9000
./threading'
	                              console 2 'gdb' }
	( .gdbinit contains then 'target remote 127.0.0.1:9000')
      

D) 	Running GDB natively on the host : WORKING 
	{ yes I have recompiled the 'threading' application for the host
here :-) }

E)	Running GDBSERVER on host and GDB on host (same [1 pc] or
different [2 pc's]) : WORKING 
	( .gdbinit contains then 'target remote 127.0.0.1:9000' or
'target remote xxx.xxx.xxx.xxx:9000' )

{ I also quad-triple checked all. }
{ STRIPPING - bin's/libs turned off, DEBUG support for threads/pthreads
is ENABLED.. } { libthread_db.* and a lot of other libs are on the
target (via NFS) and are NOT stripped } { symbols are loaded by the gdb
debugger .. paths to libs are fine ...
etc .. etc..}
{ using GDB 6.8 in all cases }

There must be something going on with GDBserver for ARM but what?



Some more DETAILS now:

want to break on line 48 -> this way a can show you what is going wrong.

41      int main()
42      {
43         pthread_t threads[NUM_THREADS];
44         int rc, t;
45         for(t=0;t<NUM_THREADS;t++){
46            printf("Creating thread %d\r\n", t);
47            rc = pthread_create(&threads[t], NULL, PrintHello, (void
*)t);
48            if (rc){
49               printf("ERROR; return code from pthread_create() is
%d\r\n", rc);
50               exit(-1);
51            }
52         }
53
54         printf("Sleeping/printing in main ..... \r\n");
55         {
56                 int n;



****   ****   ****
*A * & *D * & *E * WORKING !
****   ****   ****

If you look at the native GDB run on the TARGET (case A in working/not
working list.) I have the following gdb console log (note the same
applies for native host case D and E)


# gdb ./threading
GNU gdb 6.8
Copyright (C) 2008 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-uclibc"...
(NOEL-GDB)b main.c:48
Reading in symbols for sources/main.c... and sources/main.c...done.
Breakpoint 1 at 0x87f8: file sources/main.c, line 48.
(NOEL-GDB)c
The program is not being run.
(NOEL-GDB)r
Reading symbols from /lib/ld-uClibc.so.0...done.
Reading symbols from /lib/libpthread.so.0...done.
[Thread debugging using libthread_db enabled] [New Thread 0x400 (LWP
942)] Reading symbols from /lib/libgcc_s.so.1...done.
Reading symbols from /lib/libc.so.0...done.
Stopped due to shared library event
(NOEL-GDB)l
37        }
38         pthread_exit(NULL);
39      }
40
41      int main()
42      {
43         pthread_t threads[NUM_THREADS];
44         int rc, t;
45         for(t=0;t<NUM_THREADS;t++){
46            printf("Creating thread %d\r\n", t);
(NOEL-GDB)c
[Switching to Thread 0x400 (LWP 942)]
Stopped due to shared library event
(NOEL-GDB)l
47            rc = pthread_create(&threads[t], NULL, PrintHello, (void
*)t);
48            if (rc){
49               printf("ERROR; return code from pthread_create() is
%d\r\n", rc);
50               exit(-1);
51            }
52         }
53
54         printf("Sleeping/printing in main ..... \r\n");
55         {
56                 int n;
(NOEL-GDB)c
Creating thread 0
[New Thread 0x801 (LWP 945)]
[New Thread 0x402 (LWP 946)]

Breakpoint 1, main () at sources/main.c:48
48            if (rc){
(NOEL-GDB)n
45         for(t=0;t<NUM_THREADS;t++){
(NOEL-GDB)n
46            printf("Creating thread %d\r\n", t);
(NOEL-GDB)n
Creating thread 1
47            rc = pthread_create(&threads[t], NULL, PrintHello, (void
*)t);
(NOEL-GDB)n
[New Thread 0x803 (LWP 947)]

Breakpoint 1, main () at sources/main.c:48
48            if (rc){
(NOEL-GDB)n
45         for(t=0;t<NUM_THREADS;t++){
(NOEL-GDB)n

1: Hello World! 0 

0: Hello World! 0 
46            printf("Creating thread %d\r\n", t);
(NOEL-GDB)n
Creating thread 2
47            rc = pthread_create(&threads[t], NULL, PrintHello, (void
*)t);
(NOEL-GDB)n
[New Thread 0xc04 (LWP 948)]

Breakpoint 1, main () at sources/main.c:48
48            if (rc){
(NOEL-GDB)quit


<< as you can see all is working >>


****   ****
*B * & *C * (NOT WORKING )
****   ****
If you look at the GDBserver/ GDB runs, I  have this result. 
{Please note that the same applies for case B & C (GDBserver/GDB on
TARGET and GDB on host and GDBSERVER on target).


*After starting GDBserver on console1

# gdbserver *:9000 ./threading
Process ./threading created; pid = 958
Listening on port 9000
Remote debugging from host 127.0.0.1

*Starting gdb on console 2

#gdb
GNU gdb 6.8
Copyright (C) 2008 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-uclibc".
Reading symbols from /root/source/threading/threading...done.
Using host libthread_db library "/lib/libthread_db.so.1".
[New Thread 958]
Reading symbols from /lib/ld-uClibc.so.0...done.
0x40000930 in _start () from /lib/ld-uClibc.so.0 (NOEL-GDB)b main.c:48
Reading in symbols for sources/main.c... and sources/main.c...done.
Breakpoint 1 at 0x87f8: file sources/main.c, line 48.
(NOEL-GDB)c
Reading symbols from /lib/libpthread.so.0...done.
Reading symbols from /lib/libgcc_s.so.1...done.
Reading symbols from /lib/libc.so.0...done.
Stopped due to shared library event
(NOEL-GDB)c
Stopped due to shared library event
(NOEL-GDB)l
37        }
38         pthread_exit(NULL);
39      }
40
41      int main()
42      {
43         pthread_t threads[NUM_THREADS];
44         int rc, t;
45         for(t=0;t<NUM_THREADS;t++){
46            printf("Creating thread %d\r\n", t);
(NOEL-GDB)info breakpoints
Num     Type           Disp Enb Address    What
1       breakpoint     keep y   0x000087f8 in main at sources/main.c:48
(NOEL-GDB)c

Breakpoint 1, main () at sources/main.c:48
48            if (rc){
(NOEL-GDB)n
45         for(t=0;t<NUM_THREADS;t++){
(NOEL-GDB)n
46            printf("Creating thread %d\r\n", t);
(NOEL-GDB)n
47            rc = pthread_create(&threads[t], NULL, PrintHello, (void
*)t);
(NOEL-GDB)n

<< HANGING for ever !!!>>


What is going on ???


* Is there anyone that has a similar setup (GDBSEVER and GDB for
target-arm multithreaded aplication) running fine ? If so which version
of GDB/GDBSERVER are you running ??????

* Is there a known WORKING version for this problem ?


Kind regards.
Noel.


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