Jump to content

DBG C ThrdStat: Difference between revisions

From EDM2
Created page with "Debug Command 17 - Get Thread Status Command ;Parameters *Pid= Process ID of debuggee *Tid= Thread ID of thread of interest *Cmd= DBG_C_ThrdStat *Buffer= Pointer to Thr..."
 
Ak120 (talk | contribs)
mNo edit summary
Line 1: Line 1:
Debug Command 17 - Get Thread Status Command  
{{DISPLAYTITLE:DBG_C_ThrdStat}}
Debug Command 17 - Get Thread Status Command


;Parameters  
;Parameters
*Pid= Process ID of debuggee
*Tid= Thread ID of thread of interest
*Cmd= DBG_C_ThrdStat
*Buffer= Pointer to Thread Status buffer
*Len= Length of Thread Status buffer, in bytes. This value is 4.
If Tid is zero, the status of the debuggee thread most recently scheduled to run will be returned.


*Pid= Process ID of debuggee
;Returns
*Tid= Thread ID of thread of interest
Value= Thread ID of "next" active thread to examine
*Cmd= DBG_C_ThrdStat
Tid= Thread ID of thread whose status is returned
*Buffer= Pointer to Thread Status buffer  
Thread Status buffer= Buffer for the thread status, filled in.
*Len= Length of Thread Status buffer, in bytes. This value is 4.  


If Tid is zero, the status of the debuggee thread most recently scheduled to run will be returned.
Thread Status buffer format is as follows:
 
;Returns
 
Value= Thread ID of "next" active thread to examine
Tid= Thread ID of thread whose status is returned
Thread Status buffer= Buffer for the thread status, filled in.
 
Thread Status buffer format is as follows:  
<PRE>
<PRE>
typedef struct _TStat {
typedef struct _TStat {
Line 25: Line 23:
} TStat
} TStat
</PRE>
</PRE>
DbgState in the Thread Status buffer contains information about the current state of debugging, and will have one of the following values upon return:  
DbgState in the Thread Status buffer contains information about the current state of debugging, and will have one of the following values upon return:
 
* 0 DBG_D_Thawed
* 0 DBG_D_Thawed  
* 1 DBG_D_Frozen
* 1 DBG_D_Frozen  
TState in the Thread Status buffer contains information about the scheduling state of the thread, and will have one of the following values upon return:
 
* 0 DBG_T_Runnable
TState in the Thread Status buffer contains information about the scheduling state of the thread, and will have one of the following values upon return:  
* 1 DBG_T_Suspended
* 2 DBG_T_Blocked
* 3 DBG_T_CritSec
TPriority in the Thread Status buffer contains the thread's base scheduling priority. This priority will be expressed as scheduling class and delta values upon return.


* 0 DBG_T_Runnable
The Value field will be filled in with the Thread ID of the "next" thread to look at when traversing threads.
* 1 DBG_T_Suspended
* 2 DBG_T_Blocked
* 3 DBG_T_CritSec


TPriority in the Thread Status buffer contains the thread's base scheduling priority. This priority will be expressed as scheduling class and delta values upon return.
By repeatedly calling the DBG_C_ThrdStat command, replacing the Tid with the last returned Value until a thread ID is repeated, all threads in the process can be traversed. When used in this way, the Tids returned by the DBG_C_ThrdStat command form a loop of the debuggee's thread IDs.
 
The Value field will be filled in with the Thread ID of the "next" thread to look at when traversing threads.
 
By repeatedly calling the DBG_C_ThrdStat command, replacing the Tid with the last returned Value until a thread ID is repeated, all threads in the process can be traversed. When used in this way, the Tids returned by the DBG_C_ThrdStat command form a loop of the debuggee's thread IDs.  
 
[[Category:DBG_C]]
{{DISPLAYTITLE:DBG_C_ThrdStat}}

Revision as of 13:54, 10 March 2020

Debug Command 17 - Get Thread Status Command

Parameters
  • Pid= Process ID of debuggee
  • Tid= Thread ID of thread of interest
  • Cmd= DBG_C_ThrdStat
  • Buffer= Pointer to Thread Status buffer
  • Len= Length of Thread Status buffer, in bytes. This value is 4.

If Tid is zero, the status of the debuggee thread most recently scheduled to run will be returned.

Returns

Value= Thread ID of "next" active thread to examine Tid= Thread ID of thread whose status is returned Thread Status buffer= Buffer for the thread status, filled in.

Thread Status buffer format is as follows:

typedef struct _TStat {
  BYTE      DbgState;
  BYTE      TState;
  USHORT    TPriority;
} TStat

DbgState in the Thread Status buffer contains information about the current state of debugging, and will have one of the following values upon return:

  • 0 DBG_D_Thawed
  • 1 DBG_D_Frozen

TState in the Thread Status buffer contains information about the scheduling state of the thread, and will have one of the following values upon return:

  • 0 DBG_T_Runnable
  • 1 DBG_T_Suspended
  • 2 DBG_T_Blocked
  • 3 DBG_T_CritSec

TPriority in the Thread Status buffer contains the thread's base scheduling priority. This priority will be expressed as scheduling class and delta values upon return.

The Value field will be filled in with the Thread ID of the "next" thread to look at when traversing threads.

By repeatedly calling the DBG_C_ThrdStat command, replacing the Tid with the last returned Value until a thread ID is repeated, all threads in the process can be traversed. When used in this way, the Tids returned by the DBG_C_ThrdStat command form a loop of the debuggee's thread IDs.