This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gdb-gdbserver, non-stop, async - thread identifier more than only a thread id?


Hello,

i've made a startup for a remote debug session on an ARM target by using async, non-stop mode. The environment to control this is Eclipse 3.2 - Embedded Debug (Native).

The settings are the following:
set target-async on
set pagination on
set non-stop on
set sysroot /home/xxx
set solib-search-path /home/yyy
set auto-solib-add on
target extended-remote 192.168.0.243:1234
remote put /home/xxx.so.0 /usr/local/xxx.so.0
remote put /home/xxx.dat
set remote exec-file xxx.dat

This means the main task is xxx.dat and loads a shared library xxx.so.0, which i want to debug. This library is creating a lot of new threads (based on libpthread.so).
In non-stop mode the breakpoint is on the first created thread and step for step i can see how new threads are created. I looks like this example:


  3 Thread 692.694  (running)
  2 Thread 692.693  (running)
* 1 Thread 692.692  SInit () at ../system/module/SMain.cpp:923

There are 3 threads, but it isn't clear which thread represents which functionality (fucntion call) . When a thread is created, isn't it possible to refer the first function call on stack as an reference name of a thread?

Basically a thread represents:

|void *start_routine(void*)
{
 while(1)
 {
  ... thread routines
 }
}|

created by :

|#include<pthread.h <http://pubs.opengroup.org/onlinepubs/007908799/xsh/pthread.h.html>>

int pthread_create(pthread_t */thread/, const pthread_attr_t */attr/,
    void *(*/start_routine/)(void*), void */arg/);|


So on stack the address &start_routine is pushed on first position which could transmitted to gdb which refers by the memory map of the object file the relevant function name start_routine(). So in the gdb session it seems to be more user-friendly than an thread id only. And could shown as:


  3 Thread 692.694  start_routine2(running)
  2 Thread 692.693  start_routine1(running)
* 1 Thread 692.692  SInit () at ../system/module/SMain.cpp:923
|

|Best regards!

--
D. Lehne
Dep. Development

AMK Drives and Controls Ltd.
Bulgaria / Gabrovo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]