public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Re: Debugging a Multi-threaded application on PowerPC 82xx...
@ 2003-04-09 20:16 Gautham Thavva
  2003-04-09 20:59 ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Gautham Thavva @ 2003-04-09 20:16 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb


Hi Daniel,

I have read in the archives that you are yet to write a FAQ and already answered this question 5 or 6 times. Please bear with me
for one more time.

A quick recap: I am running a multi-threaded application on
PowerPC 8260 and trying to debug it with gdb-5.3 

In the previous reply, you had asked me to set the solib-absolute-
prefix. I set solib-absolute-prefix and still couldn't debug.
I then built the application as a static executable and tried
to debug it. It got stuck at the system calls in the application.

I then tested the system calls with a test program.
---------------------------------------------
#include <pthread.h>
#include <stdio.h>
#define NUM_THREADS     5


void *PrintHello(void *threadid)
{
<##3##>   printf("\n%d: Hello World!\n", threadid);
   pthread_exit(NULL);
}

int main (int argc, char *argv[])
{
   pthread_t threads[NUM_THREADS];
int rc, t;

<##1##>   system("mkdir story");
   system("rm -rf story");

   for(t=0;t < NUM_THREADS;t++){
<##2##>      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);
-------------------------------------------------------------------

I put a breakpoint at points shown by <##X##> in the above code.
It hit breakpoint 2 and 3 but never hit breakpoint 1
I placed the system calls in the main function to exclude
the possibility of gdb not handling system calls in threads.

Please can you tell me how I can resolve this issue. 
I appreciate your help.

with regards,
Gautham Thavva



On Mon, 24 Mar 2003 15:43:57  
 Daniel Jacobowitz wrote:
>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.
>



____________________________________________________________
Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year.
http://login.mail.lycos.com/brandPage.shtml?pageId=plus&ref=lmtplus

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Debugging a Multi-threaded application on PowerPC 82xx...
  2003-04-09 20:16 Debugging a Multi-threaded application on PowerPC 82xx Gautham Thavva
@ 2003-04-09 20:59 ` Daniel Jacobowitz
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2003-04-09 20:59 UTC (permalink / raw)
  To: Gautham Thavva; +Cc: gdb

On Wed, Apr 09, 2003 at 04:15:39PM -0400, Gautham Thavva wrote:
> 
> Hi Daniel,
> 
> I have read in the archives that you are yet to write a FAQ and already answered this question 5 or 6 times. Please bear with me
> for one more time.
> 
> A quick recap: I am running a multi-threaded application on
> PowerPC 8260 and trying to debug it with gdb-5.3 
> 
> In the previous reply, you had asked me to set the solib-absolute-
> prefix. I set solib-absolute-prefix and still couldn't debug.
> I then built the application as a static executable and tried
> to debug it. It got stuck at the system calls in the application.
> 
> I then tested the system calls with a test program.

> I put a breakpoint at points shown by <##X##> in the above code.
> It hit breakpoint 2 and 3 but never hit breakpoint 1
> I placed the system calls in the main function to exclude
> the possibility of gdb not handling system calls in threads.

Sorry, I have no idea what would cause this problem.  System calls in
threads should not generally be a problem, by the way.


-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Debugging a Multi-threaded application on PowerPC 82xx...
  2003-03-24 20:38 Gautham Thavva
@ 2003-03-24 20:50 ` Daniel Jacobowitz
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2003-03-24 20:50 UTC (permalink / raw)
  To: Gautham Thavva; +Cc: gdb

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Debugging a Multi-threaded application on PowerPC 82xx...
@ 2003-03-24 20:38 Gautham Thavva
  2003-03-24 20:50 ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Gautham Thavva @ 2003-03-24 20:38 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb

[-- Attachment #1: Type: text/plain, Size: 3480 bytes --]


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

[-- Attachment #2: gtest.c --]
[-- Type: text/plain, Size: 538 bytes --]

#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);
}


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Debugging a Multi-threaded application on PowerPC 82xx...
  2003-03-22 21:06 Gautham Thavva
@ 2003-03-22 21:35 ` Daniel Jacobowitz
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel Jacobowitz @ 2003-03-22 21:35 UTC (permalink / raw)
  To: Gautham Thavva; +Cc: gdb

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Debugging a Multi-threaded application on PowerPC 82xx...
@ 2003-03-22 21:06 Gautham Thavva
  2003-03-22 21:35 ` Daniel Jacobowitz
  0 siblings, 1 reply; 6+ messages in thread
From: Gautham Thavva @ 2003-03-22 21:06 UTC (permalink / raw)
  To: gdb


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.

with regards,
Gautham Thavva

ps. Please reply to me directly as I haven't subscribed to the mailing list.



_____________________________________________________________
Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year.
http://login.mail.lycos.com/brandPage.shtml?pageId=plus&ref=lmtplus

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-04-09 20:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-09 20:16 Debugging a Multi-threaded application on PowerPC 82xx Gautham Thavva
2003-04-09 20:59 ` Daniel Jacobowitz
  -- strict thread matches above, loose matches on Subject: below --
2003-03-24 20:38 Gautham Thavva
2003-03-24 20:50 ` Daniel Jacobowitz
2003-03-22 21:06 Gautham Thavva
2003-03-22 21:35 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).