Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-debug-dev] Collect more thread information - About "info thread" output ?

Hi,


We have a problem to retrieve the thread information based on current CDT3.1. For our system, we want to know the underlying thread ID and other thread information when user selects an IThread in the Debug view (or LaunchView). However, there is no way through the API to retrieve such information (let me know if there is one :-)).

 

The current org.eclipse.cdt.debug.mi.core.output.CLIInfoThreadsInfo only keeps the thread id assigned by GDB. For example:
The info thread command for a standard GDB will return the following output for pthread:
  3 Thread -1217840208 (LWP 23518)  0xb7f6c17c in clone () from /lib/tls/libc.so.6
* 2 Thread -1209451600 (LWP 23517)  do_nothing (null=0x0) at pthread_Test.c:12
  1 Thread -1208182528 (LWP 23514)  0xb7f6c17c in clone () from /lib/tls/libc.so.6

For our system, our GDB will return the following output for a thread:
  6 Thread 121 (state=STOP, ID=0x0000100, name="THREAD No.1", priority=211)

CLIInfoThreadInfo only keeps the id (the first digit of above output lines). All the information besides the thread id will be also useful to us. However, we could not find a way to access the output by using current API.

Here is our solution:
 - Add a String[] to the CLIInfoThreadsInfo class:
   class CLIInfiThreadsInfo{
      protected String[] infos;
      public String[] getThreadInfos(){
         return infos;
      }
   }
   The infos[] will be sorted together with threadIds[].


  - Change the org.eclispe.cdt.debug.mi.core.cdi.model.Thread constructor:
   class Thread{
      protected String info;
      public String getThreadInfo(){
         return info;
      }
      public Thread(Target target, int threadId, String info) implements ICDIThread{
         this(target, threadId, null, info);
      }
      public Thread(Target target, int threadId, String threadName, String threadInfo){
         super(target);
         id=threadId;
         name=threadName;
         info = threadInfo;
      }
   }
   And refactor the caller of Thread (only few places in mi.core package need change).

 
 - Add an adapter factory to the CThread.class, so that it can return an ICDIThread when user select IThread in Debug view. This is done in the org.eclipse.cdt.debug.internal.core.model package.

 
I think the above change does not break the other modules. I am not sure if this is a good solution or not. If is there any other solution available without changing the CDT code, please let me know. If above changes make sense, I can send you a patch.

 
Thanks

-Chengdong

 

 


Back to the top