[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

(NEED HELP) Problem to multi-thread remote debugging with gdbserver



Hi,

  I've got a problem with GDBserver. Although it seems to be not specific with Debian, I would like to seek help from somebody who can help me out.

  I've heard that GDB 5.3 onwards has supported remote
debugging multiple thread programs, but I still fail
to do so. I wonder what I have done wrong.

  I work with a x86 host and a x86 target, both with
linux kernel 2.4.22. I worked on a test program below,
linked with glibc:

    #include <pthread.h>
    #include <stdio.h>
    #define NUM_THREADS 5

    void *thread_function(void *arg)
    {
       printf("Hello World from %d!\n", arg);
       sleep(10);
       pthread_exit(NULL);
    }

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

       for (i = 0; i < NUM_THREADS; i++)
         pthread_create(&threads[i], NULL,
thread_function, (void *)i);
      
       for (i = 0; i < NUM_THREADS; i++)
          pthread_join(threads[i], NULL);

       return 0;
    }

First we set everything up and connect:

    (gdb) set solib-search-path
/usr/local/cris/r59/cris-axis-linux-gnu/lib/
    (gdb) set solib-absolute-prefix /dev/null/
    (gdb) set remotetimeout 60
    (gdb) target remote 10.84.130.10:2222
    Remote debugging using 10.84.130.10:2222
    0x35557608 in ?? ()

Next we set a breakpoint in main after all threads
have been created:

    (gdb) break 20
    Breakpoint 1 at 0x80568: file hello.c, line 20.

Now send the program on its way:

    (gdb) c
    Continuing.
  

  On the host computer, I fail to see other threads,
other than the main thread. As a result, I fail to set
breakpoint on the other threads.

  I wonder what I have done wrong.

  Pls advise. Thank you for  your attention.

Regards.
Peter Choi



		
______________________________________

===================================================================
§K¶O365 Daily English¡A¥ß§Y¬d¸ß¡I
http://adimages.sina.com.hk/Lingua_0510.html
Á¿°­¬G¡H¶KÆF·Ó¡H°eiPod nano¡I
http://adimages.sina.com.hk/Halo_0510.html
¤w³Q¦¬Å¥150,000¦¸¡Iºôµ¸ºq¦±ÀH®ÉÅ¥¡I
http://adimages.sina.com.hk/iSong_0510.html
===================================================================



Reply to: