This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS5.3 issue when debugging multi-threaded ( more than 70 threads) process.

Other Parts Discussed in Thread: OMAPL138

3364.example.c
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>
#include <pthread.h>
#include <sys/syscall.h>
#define gettid() syscall(__NR_gettid)
#define NUMBER_OF_THREADS 70
int my_test_func(unsigned int num)
{
unsigned int i=0;
unsigned int total=0;
for(i=0; i<num; i++)
total += i;
return total;
}
void * thread(void * arg)
{
while(1)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Hi TI experts:
      When I use CCS5.3 to debug linux application. I observed an unaccepted slow-speed issue If the debugged application is a multi-threaded (more than 70 threads) process. Could you kindly advise on it.
I had the example code attached and following is my test envrionment and reproduce steps by using the attached example code.

Test Envrionment:
       CCS version: 5.3.0.00090
       Hardware paltform: OmapL138 board.
       Linux version : 2.6.34.7
      gdb version: 7.5
      gdbsever version: 7.5
      uclibc version: 0.9.32 (NPTL thread library)

Test steps:
1. compile the multi-threaded example code and copy the executable file to the board.
2. start the application on the target board.
3. use gdbserver to attach the running example application.
4. configure CCS5.3 and launch a gdb debug session, then CCS will connect to the gdbserver.
5. after succefully lauch the debug sesseion. then make a breakpoint in function my_test_func().
6. once the breakpoint is hit, all the threads will stop, that is what we expected for gdb stop mode debugging, the problem is it takes long time to suspend all the created threads under this process.
7. if I single step in the soruce code, the same problem can be observed as well.

I am not sure whether this is a know problem or anything I need to configure for multi-thread debugging case. looking forward for kindly help, thanks in advance.

example source code:

#include <stdio.h>
#include <pthread.h>
#include <sys/syscall.h>

#define gettid() syscall(__NR_gettid)
#define NUMBER_OF_THREADS 70

int my_test_func(unsigned int num)
{
 unsigned int i=0;
 unsigned int total=0;
 for(i=0; i<num; i++)
  total += i;
 return total;
}

void * thread(void * arg)
{
 while(1)
 {
  printf("I am pthread %d.\n", gettid());
  
  if( (unsigned int)arg == NUMBER_OF_THREADS )
  {
   my_test_func(100);
   sleep(5);
  }
  else
  {
   sleep((unsigned int)arg * 30);
  }
 }
}

int main(void)
{
 pthread_t id;
 int i,ret;
 for( i=1; i<=NUMBER_OF_THREADS; i++)
 {
  ret=pthread_create(&id,NULL,(void *)thread,(void*)(i));
  if(ret!=0){
   printf ("Create pthread error!\n");
   return -1;
  }
 }

 printf("This is the main process %d.\n", gettid());
 pthread_join(id,NULL);
 return (0);
}