[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdt-debug-dev] Collect more thread information - About "info thread" output?
|
Hi Chengdong,
There is support for optionally displaying thread names in the CDT debug
view. This feature was added in the patch
http://dev.eclipse.org/mhonarc/lists/cdt-patch/msg02506.html and
described in the corresponding bug report
https://bugs.eclipse.org/bugs/show_bug.cgi?id=69711.
This patch was initiated by a discussion of this issue found here:
http://dev.eclipse.org/mhonarc/lists/cdt-debug-dev/msg00462.html
The conclusion was that there is no reliable way to retrieve thread
names and other thread metadata from the output of the "info threads"
command in a platform-independent manner. Instead, we choose to only
provide the foundation for a third party to do this.
I think you can use the mechanism described in bug report 69711 to
display thread names and any other thread metadata you may have.
Regards,
/Stefan
chengdong li wrote:
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
------------------------------------------------------------------------
_______________________________________________
cdt-debug-dev mailing list
cdt-debug-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-debug-dev