From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from xseries02.selcomgroup.com (mail.selcomgroup.com [85.18.34.51]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5674EDE3AF for ; Wed, 27 Aug 2008 23:58:21 +1000 (EST) Message-ID: <48B55D6F.3080101@selcomgroup.com> Date: Wed, 27 Aug 2008 15:58:07 +0200 From: Daniele Bosi MIME-Version: 1.0 To: Wolfgang Denk Subject: Re: gdb problems with threads on mpc512x References: <48B28A65.2050409@selcomgroup.com> <20080825182053.B804B248CA@gemini.denx.de> In-Reply-To: <20080825182053.B804B248CA@gemini.denx.de> Content-Type: text/html; charset=ISO-8859-1 Cc: linuxppc-dev@ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , I attach the listing of our program, I tried it on ELDK4.2 Freescale (kernel 2.6.24.6 by Freescale, your rootfs) and it's still giving me problems: if I issue
br PrintHello
then cont-inue for some times, after a while gdb stops responding and is not even getting CTRL-C or CTRL-Z.

Of course the same works fine on i686.

I tried both gdbserver and gdb and even rebuilt the file with the target gcc.

Thank you,
Daniele

==== CUT HERE ====
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>

#define NUM_THREADS     5

void *PrintHello(void *threadid)
{
    int c = 0;
   int tid;
   tid = (int)threadid;

   while (++c < 100) {
   printf("Hello World! It's me, thread #%d!\n", tid);
   sleep (1);
   }
   pthread_exit(NULL);
}

int main (int argc, char *argv[])
{
    printf ("Hello world\n");
   pthread_t threads[NUM_THREADS];
   int rc, t;
   for(t=0; t<NUM_THREADS; t++){
      printf("In main: 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);
}

==== CUT HERE ====

Wolfgang Denk ha scritto:
Dear Daniele Bosi,

In message <48B28A65.2050409@selcomgroup.com> you wrote:
  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    

Please post plain text only on mailing lists.

  
I encountered several problem debugging multithreated software with gdb
on mpc512x, remotely (gdbserver) and locally.<br>
I built gdb 6.8 from scratch, but it's crashing when I stop execution
into a thread.<br>
<br>
Did anyone get it to work correctly?<br>
    

We use GDB 6.7 in our ELDK 4.2; we didn't encounter such problems in
our tests.

Best regards,

Wolfgang Denk

  

--



Daniele Bosi

DIGITEK S.p.A.

Via L. Romagnoli 24,
41033 Concordia sulla Secchia
Modena (MO), Italy

Tel: +39-(0)53556942 Fax. +39-(0)53554550

Web:     http://www.digitek.it

Mail to: d.bosi@selcomgroup.com