Difference between revisions of "KDebug"

From 3dbrew
Jump to navigation Jump to search
m
 
(18 intermediate revisions by 2 users not shown)
Line 34: Line 34:
 
| [[KSendableInterruptEvent]]
 
| [[KSendableInterruptEvent]]
 
| Process termination event
 
| Process termination event
 +
|-
 +
| 0x1C
 +
| u8
 +
| Indicates an ATTACH PROCESS event has been signaled to this object
 +
|-
 +
| 0x1D
 +
| u8
 +
| Debug string length >> 31, always 0
 +
|-
 +
| 0x1E
 +
| u8
 +
| Indicates that a debug event is currently being signaled to this object
 +
|-
 +
| 0x1F
 +
| u8
 +
| Indicates that the parent process is paused (using svcBreakDebugProcess).
 +
svcContinueDebugEvent will ignore all debug events other than EXIT PROCESS, and some other debug SVCs will return an error.
 +
|-
 +
| 0x20
 +
| [[SVC|DebugEventType]]
 +
| Type of the latest debug event
 +
|-
 +
| 0x24
 +
| u32
 +
| Unknown, probably unused
 +
|-
 +
| 0x28
 +
| [[KThread]] *
 +
| Thread having exclusive access to this object
 
|-
 
|-
 
| 0x2C
 
| 0x2C
 
| u32
 
| u32
| Debug event flags
+
| Debug event flags set by svcContinueDebugEvents
 +
Bit0: no exception dumps are made if this is set.
 +
Bit1 and following: report EXCEPTION (this flag is bypassed for svc 0xFF), SCHEDULE, SYSCALL, MAP debug events, respectively.
 +
|-
 +
| 0x30
 +
| u32
 +
| Stop point type that caused the event: 0 = svc 0xFF, 1 = breakpoint, 2 = watchpoint (otherwise it's not updated).
 
|-
 
|-
 
| 0x34
 
| 0x34
 
| u32
 
| u32
| Count of KEventInfo object nodes associated with this KDebug object
+
| Count of KEventInfo object nodes to be fetched with svcGetProcessDebugEvent (associated with this KDebug object)
 
|-
 
|-
 
| 0x38
 
| 0x38
| KLinkedListNode*
+
| [[KLinkedListNode]]*
| Pointer to first KLinkedListNode in linked list of KEventInfo objects
+
| Pointer to first KLinkedListNode in linked list of KEventInfo objects to be fetched with svcGetProcessDebugEvent
 
|-
 
|-
 
| 0x3C
 
| 0x3C
| KLinkedListNode*
+
| [[KLinkedListNode]]*
| Pointer to last KLinkedListNode in linked list of KEventInfo objects
+
| Pointer to last KLinkedListNode in linked list of KEventInfo objects to be fetched with svcGetProcessDebugEvent
 +
|-
 +
| 0x40
 +
| u32
 +
| Count of KEventInfo object nodes to be fetched with svcContinueDebugEvent (associated with this KDebug object)
 +
|-
 +
| 0x44
 +
| [[KLinkedListNode]]*
 +
| Pointer to first KLinkedListNode in linked list of KEventInfo objects to be fetched with svcContinueDebugEvent
 +
|-
 +
| 0x48
 +
| [[KLinkedListNode]]*
 +
| Pointer to last KLinkedListNode in linked list of KEventInfo objects to be fetched with svcContinueDebugEvent
 
|-
 
|-
 
| 0x4C
 
| 0x4C
| KProcess*
+
| [[KProcess]]*
| Process the thread belongs to (virtual address)
+
| Parent process
 +
|-
 +
| 0x50
 +
| [[KThread]]*
 +
| Current KThread- thread being debugged
 +
|-
 +
| 0x54
 +
| [[KThread]]*
 +
| Thread using ContinueDebugEvent
 +
|-
 +
| 0x58
 +
| s32
 +
| Cpu core of thread using ContinueDebugEvent
 
|-
 
|-
 
| 0x5C
 
| 0x5C
Line 69: Line 128:
 
| 0x68
 
| 0x68
 
| u32
 
| u32
| Count of KDebug object nodes
+
| List size; this [[KLinkedList]] of all the [[KThread]] instances of the parent process: the currently running threads followed the others,
 +
by core then by dynamic priority.
 
|-
 
|-
 
| 0x6C
 
| 0x6C
 
| KLinkedListNode*
 
| KLinkedListNode*
| Pointer to first KLinkedListNode in linked list of KDebug objects
+
| Pointer to first KLinkedListNode in the above list
 
|-
 
|-
 
| 0x70
 
| 0x70
 
| KLinkedListNode*
 
| KLinkedListNode*
| Pointer to last KLinkedListNode in linked list of KDebug objects
+
| Pointer to last KLinkedListNode in the above list
 
|-
 
|-
 
| 0x74
 
| 0x74
| [[KObjectMutex]]
+
| [[KRecursiveLock]]
| Mutex
+
| Recursive lock
 +
|-
 +
| 0x7C
 +
| [[KThread]]*
 +
| Current KThread- used in svcBreak
 +
|-
 +
| 0x80
 +
| u8
 +
| Cleared when an EXCEPTION debug event was (attempted to be) signaled (i.e. even when bit2 of the debug flag is clear)
 +
|-
 +
| 0x81
 +
| u8
 +
| Indicates that an EXCEPTION debug event was signaled
 +
|-
 +
| 0x82
 +
| u8
 +
| Indicates that all threads should be unlocked
 +
|-
 +
| 0x83
 +
| u8
 +
| Indicates that an EXCEPTION debug event different from USER_BREAK was continued, while the process was paused
 
|-
 
|-
 
| 0x84
 
| 0x84
 
| u8
 
| u8
| Set to 1 to indicate the KProcess it belongs to exited
+
| Indicates that a USER_BREAK debug event was continued while the process was paused
 
|-
 
|-
 
| 0x85
 
| 0x85
 
| u8
 
| u8
| Set to 1 to indicate the KProcess it belongs to has been terminated
+
| Indicates that the KProcess instance it belongs to has exited (normally ?)
 +
|-
 +
| 0x86
 +
| u8
 +
| Indicates that the KProcess instance it belongs to has been terminated
 +
|-
 +
| 0x87
 +
| u8
 +
| Indicates that svcBreak was used and not yet handled by svcContinueDebugEvent, with type != (UN)LOAD_RO
 
|-
 
|-
 
| 0x88
 
| 0x88
Line 98: Line 186:
 
| u32
 
| u32
 
| [[SVC#EXCEPTION_event|Exception type]]
 
| [[SVC#EXCEPTION_event|Exception type]]
 +
|-
 +
| 0x90
 +
| u16
 +
| Number of "EXCEPTION" events encountered (0 or 1)
 
|-
 
|-
 
| 0x92
 
| 0x92
 
| u16
 
| u16
 
| ID of the invalid SVC that was attempted
 
| ID of the invalid SVC that was attempted
 +
|-
 +
| 0x94
 +
| u16
 +
| Total number of debug events associated with this object awaiting svcContinueDebugEvent
 +
|-
 +
| 0x96
 +
| u16
 +
| Number of EXIT PROCESS debug events associated with this object awaiting svcContinueDebugEvent
 +
|-
 +
| 0x98
 +
| const char *
 +
| Debug string
 +
|-
 +
| 0x9C
 +
| u32
 +
| Debug string length
 
|}
 
|}
 
Exception fields are set for the latest notified exception that occured in userland.
 

Latest revision as of 00:10, 3 June 2020

class KDebug extends KSynchronizationObject and KSendableInterruptEvent;

Size : 0xA0 bytes

Offset Type Description
0x0 u32 Pointer to vtable
0x4 u32 Reference count
0x8 u32 Count of KThreads that sync with this object - number of nodes in the linked list below
0xC KLinkedListNode* Pointer to first KLinkedListNode in node list of KThreads that sync with this object
0x10 KLinkedListNode* Pointer to last KLinkedListNode in node list of KThreads that sync with this object
0x14 KSendableInterruptEvent Process termination event
0x1C u8 Indicates an ATTACH PROCESS event has been signaled to this object
0x1D u8 Debug string length >> 31, always 0
0x1E u8 Indicates that a debug event is currently being signaled to this object
0x1F u8 Indicates that the parent process is paused (using svcBreakDebugProcess).

svcContinueDebugEvent will ignore all debug events other than EXIT PROCESS, and some other debug SVCs will return an error.

0x20 DebugEventType Type of the latest debug event
0x24 u32 Unknown, probably unused
0x28 KThread * Thread having exclusive access to this object
0x2C u32 Debug event flags set by svcContinueDebugEvents

Bit0: no exception dumps are made if this is set. Bit1 and following: report EXCEPTION (this flag is bypassed for svc 0xFF), SCHEDULE, SYSCALL, MAP debug events, respectively.

0x30 u32 Stop point type that caused the event: 0 = svc 0xFF, 1 = breakpoint, 2 = watchpoint (otherwise it's not updated).
0x34 u32 Count of KEventInfo object nodes to be fetched with svcGetProcessDebugEvent (associated with this KDebug object)
0x38 KLinkedListNode* Pointer to first KLinkedListNode in linked list of KEventInfo objects to be fetched with svcGetProcessDebugEvent
0x3C KLinkedListNode* Pointer to last KLinkedListNode in linked list of KEventInfo objects to be fetched with svcGetProcessDebugEvent
0x40 u32 Count of KEventInfo object nodes to be fetched with svcContinueDebugEvent (associated with this KDebug object)
0x44 KLinkedListNode* Pointer to first KLinkedListNode in linked list of KEventInfo objects to be fetched with svcContinueDebugEvent
0x48 KLinkedListNode* Pointer to last KLinkedListNode in linked list of KEventInfo objects to be fetched with svcContinueDebugEvent
0x4C KProcess* Parent process
0x50 KThread* Current KThread- thread being debugged
0x54 KThread* Thread using ContinueDebugEvent
0x58 s32 Cpu core of thread using ContinueDebugEvent
0x5C u32 Count of KDebugThread object nodes associated with this KDebug object
0x60 KLinkedListNode* Pointer to first KLinkedListNode in linked list of KDebugThread objects
0x64 KLinkedListNode* Pointer to last KLinkedListNode in linked list of KDebugThread objects
0x68 u32 List size; this KLinkedList of all the KThread instances of the parent process: the currently running threads followed the others,

by core then by dynamic priority.

0x6C KLinkedListNode* Pointer to first KLinkedListNode in the above list
0x70 KLinkedListNode* Pointer to last KLinkedListNode in the above list
0x74 KRecursiveLock Recursive lock
0x7C KThread* Current KThread- used in svcBreak
0x80 u8 Cleared when an EXCEPTION debug event was (attempted to be) signaled (i.e. even when bit2 of the debug flag is clear)
0x81 u8 Indicates that an EXCEPTION debug event was signaled
0x82 u8 Indicates that all threads should be unlocked
0x83 u8 Indicates that an EXCEPTION debug event different from USER_BREAK was continued, while the process was paused
0x84 u8 Indicates that a USER_BREAK debug event was continued while the process was paused
0x85 u8 Indicates that the KProcess instance it belongs to has exited (normally ?)
0x86 u8 Indicates that the KProcess instance it belongs to has been terminated
0x87 u8 Indicates that svcBreak was used and not yet handled by svcContinueDebugEvent, with type != (UN)LOAD_RO
0x88 u32 * Register dump
0x8C u32 Exception type
0x90 u16 Number of "EXCEPTION" events encountered (0 or 1)
0x92 u16 ID of the invalid SVC that was attempted
0x94 u16 Total number of debug events associated with this object awaiting svcContinueDebugEvent
0x96 u16 Number of EXIT PROCESS debug events associated with this object awaiting svcContinueDebugEvent
0x98 const char * Debug string
0x9C u32 Debug string length