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: Debugging a Multi-threaded application on PowerPC 82xx...


How does DDD invoke GDB?  I bet it uses --symbols or the symbol-file
command.  Don't Do That!  Use "file" or just "gdb gtest" instead.
Fix DDD or say "file gtest" before saying "target remote".

You also need to have your target libraries present on the host system
and pointed to by solib-absolute-prefix or solib-search-path.

And I (or someone else!) should write more bulletproof documentation
about this since it is obviously a FAQ.

On Mon, Mar 24, 2003 at 03:38:08PM -0500, Gautham Thavva wrote:
> 
> Hi Daniel,
> 
> I have attached a sample test program for illustrating 
> what happened during the session.
> 
> In the sample program, I placed a breakpoint in the PrintHello 
> function and a breakpoint at the point where the threads 
> are created in the main function.
> 
> I started the gdbserver on the remote machine.
> ---------------------------------------------------
> ./gdbserver 172.16.133.39:5555 gtest
> Process gtest created; pid = 4165
> Remote debugging from host 172.16.133.39
> Creating thread 0
> ---------------------------------------------------
> At the host machine, I started ddd. 
> ---------------------------------------------------
> Copyright ) 1995-1999 Technische Universitdt Braunschweig, Germany.
> Copyright ) 1999-2001 Universitdt Passau, Germany.
> (gdb) target remote 172.16.133.223:5555
> 0x30012f40 in ?? ()
> (gdb) break gtest.c:7
> Breakpoint 1 at 0x100004bc: file gtest.c, line 7.
> (gdb) cont
> 
> Program received signal SIG32, Real-time event 32.
> 0x0febb370 in ?? ()
> (gdb) 
> ---------------------------------------------------
> The debug cursor hits the breakpoint in the main function
> but doesn't enter the PrintHello breakpoint. It receives
> a signal SIG32. (it doesn't give any more information)
> 
> The message in my intended application is as follows:
> ---------------------------------------------------
> Program received signal SIGTRAP, Trace/breakpoint trap.
> 0x0ff12e00 in ngettext () from /lib/libc.so.6
> ---------------------------------------------------
> 
> It is the same case if I debug using a natively built
> gdb on the target machine.
> 
> I hope I have been able to explain the scenario. The
> main problem is that it is not reaching the breakpoint
> in the thread but reaches the one in the main function.
> 
> with regards,
> Gautham Thavva
> 
> On Sat, 22 Mar 2003 16:35:08  
>  Daniel Jacobowitz wrote:
> >On Sat, Mar 22, 2003 at 04:06:33PM -0500, Gautham Thavva wrote:
> >> 
> >> Hi,
> >> 
> >> I downloaded gdb5.3 having read in the announcement that it supports multi-threaded debugging for powerpc-*-linux. I found similar queries in the archives (a week back) but would like to know the current status.
> >> 
> >> I built gdb and gdbserver(following the README)
> >> gdb: ./configure --target=powerpc-linux
> >> 
> >> gdbserver: set the cross-compiler and then ran
> >>      ./configure --target=powerpc-linux
> >> 
> >> I copied gdbserver into the target and initiated the communication between gdb and gdbserver through TCP/IP(following the documentation)
> >> 
> >> I am able to place breakpoints on the main routine as well as on other threads. The debug cursor doesn't show up at the thread's place.
> >> 
> >> I then built gdb in the target environment i.e built it natively on the target machine. The result was the same. I couldn't switch between the threads.
> >> 
> >> I read in the archive about a patch PREPARE_TO_PROCEED Patch. I applied the patch and rebuilt gdb and gdbserver. Even then, the
> >> thread switching didn't take place.
> >> 
> >> I would like to know how to go about so that debugging the multi-threaded application is possible. I will look forward to valuable
> >> responses from this mailing list.
> >
> >You didn't explain the problem.  Please give us a session transcript
> >illustrating what doesn't work.
> >
> >-- 
> >Daniel Jacobowitz
> >MontaVista Software                         Debian GNU/Linux Developer
> >
> 
> 
> _____________________________________________________________
> Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year.
> http://login.mail.lycos.com/brandPage.shtml?pageId=plus&ref=lmtplus
> #include <pthread.h>
> #include <stdio.h>
> #define NUM_THREADS     5
> 
> void *PrintHello(void *threadid)
> {
>    printf("\n%d: Hello World!\n", threadid);
>    pthread_exit(NULL);
> }
> 
> int main (int argc, char *argv[])
> {
>    pthread_t threads[NUM_THREADS];
> int rc, t;
>    for(t=0;t < NUM_THREADS;t++){
>       printf("Creating thread %d\n", t);
>       rc = pthread_create(&threads[t], NULL, PrintHello, (void *)t);
> if (rc){
>          printf("ERROR; return code from pthread_create() is %d\n", rc);
>          exit(-1);
>       }
>    }
>    pthread_exit(NULL);
> }
> 


-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


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