Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] CDT: Remote debug of multithread application

Hi All,

My (very simple) application runs on an embedded Pentium M under vanilla In order to debug it I launched:
gdbserver :2345 thread.out

On the host side I launched eclipse-cdt (Galileo) and configured the debugger for "GDB (DSF)
remote system process launcher".

If the breakpoint is on the main thread, program is stopped and there is a '->'
on the required line. I can watch local variables.

But if the breakpoint is on a thread, program is stopped but there is no '->' near the breakpoint. It is not clear where the CPU has reached. I can not watch local variables.

It is impossible to debug a multithread application this way.

When I tried to debug the application with gdb (no eclipse) it works fine.
The toolchain,gdb, gdbserver was created using crosstool-ng project.
In the debugger configuration I pointed to the shared libraries, gdb created with crosstool-ng.
I did not use .gdbinit

What am I doing wrong ?
The Makefile, source are attached at the end of this mail.


thread.out: thread.o
gcc -o thread.out thread.o -lpthread

thread.o: thread.c
gcc -g -c thread.c -o thread.o

void *print_message_function( void *ptr )
    char *message = (char *) ptr;
    int rc;

    while (1)
     printf("%s \n", message);
     sleep (1);

int main(void)
   pthread_t thread1, thread2;
   char *message1 = "Thread 1";
   char *message2 = "Thread 2";
   int  iret1, iret2;
   int rc;

iret1 = pthread_create( &thread1, NULL, print_message_function, (void*) message1); iret2 = pthread_create( &thread2, NULL, print_message_function, (void*) message2);

   while (1)
       sleep (1);
    return 0;

Back to the top