Difference between revisions of "KEventInfo"

From 3dbrew
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 35: Line 35:
 
|-
 
|-
 
| 0xE
 
| 0xE
| u8
+
| bool
| "Other" flag for ATTACH PROCESS events, 0 in all observed cases
+
| Ignore continue
 
|-
 
|-
 
| 0xF
 
| 0xF
Line 105: Line 105:
 
|}
 
|}
  
For UNDEFINED INSTRUCTION/PREFETCH ABORT/DATA ABORT/UNALIGNED DATA ACCESS/UNDEFINED SYSCALL/STOP POINT:
+
==== UNDEFINED INSTRUCTION/PREFETCH ABORT/DATA ABORT/UNALIGNED DATA ACCESS/UNDEFINED SYSCALL/STOP POINT events ====
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
!  Type
 
!  Type
Line 118: Line 118:
 
|}
 
|}
  
For USER BREAK:
+
==== USER BREAK event ====
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
!  Type
 
!  Type
Line 130: Line 130:
 
|}
 
|}
  
For DEBUGGER BREAK:
+
==== DEBUGGER BREAK event ====
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
 
!  Type
 
!  Type
 
!  Field
 
!  Field
 
|-
 
|-
| [[KThread]]*[nbCores]
+
| s32[4]
| Pointers to the current threads at the time svcBreakDebugProcess was called
+
| IDs of the attached process's threads that were running on each core at the time of the @ref svcBreakDebugProcess call, or -1 (only the first 2 values are meaningful on O3DS).
 
|}
 
|}
  
=== SCHEDULE/SYSCALL IN/OUT events ===
+
=== SCHEDULE IN/OUT events ===
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 149: Line 149:
 
|-
 
|-
 
| u32
 
| u32
| CPU ID (SCHEDULE events) / syscall (SYSCALL events)
+
| CPU ID
 
|-
 
|-
 
| u32[5]
 
| u32[5]
Line 156: Line 156:
 
| u32 (?)
 
| u32 (?)
 
| Event info, apparently 0
 
| Event info, apparently 0
 +
|}
 +
 +
=== SYSCALL IN/OUT events ===
 +
 +
{| class="wikitable" border="1"
 +
!  Type
 +
!  Field
 +
|-
 +
| u64
 +
| Clock tick
 +
|-
 +
| u32
 +
| Syscall ID
 
|}
 
|}
  

Latest revision as of 01:09, 3 June 2020

Size : 0x38 bytes

It is converted to struct DebugEventInfo by using svcContinueDebugEvent.

Object definition[edit]

Offset Type Description
0x0 u32 Event type
0x4 u32 Current KThread ID
0x8 u32 Flags.

In all observed cases, bit0 means that svcContinueDebugEvent needs to be called for this event (except for EXIT PROCESS events, for which you need to call svcContinueDebugEvent even if this bit is clear)

0xC u8 ATTACH PROCESS/THREAD events: 1 if the object was attached by svcDebugActiveProcess, 0 otherwise (this is always 1 for processes)
0xD u8 Equal to bit0 of field 0x8 in all observed cases:

indicates that svcContinueDebugEvent needs to be called for this event (except for EXIT PROCESS events, for which you need to call svcContinueDebugEvent even if this bit is clear)

0xE bool Ignore continue
0xF u8 Indicates that the event has been handled and should be deleted
0x10 union { ... } Event-specific data, see below (slightly different from DebugEventInfo)

Event-specific data[edit]

ATTACH PROCESS event[edit]

Type Field
KProcess * Process

ATTACH THREAD event[edit]

Type Field
u32 Creator thread ID (0 if attached by svcDebugActiveProcess)
void * Thread local storage
u32 * Entrypoint = .text load address of the parent process

EXIT THREAD/PROCESS events[edit]

Type Field
u32 Exit reason

EXCEPTION event[edit]

Type Field
u32 Exception type
u32 Exception address
u32 Exception category: 4 for DEBUGGER BREAK, 3 for USER BREAK, 2 for STOP POINT,

1 for DATA ABORT/UNALIGNED DATA ACCESS/UNDEFINED SYSCALL, 0 otherwise

union { ... } Type-specific data, see below

UNDEFINED INSTRUCTION/PREFETCH ABORT/DATA ABORT/UNALIGNED DATA ACCESS/UNDEFINED SYSCALL/STOP POINT events[edit]

Type Field
u32 Fault information: Fault Address Register (for watchpoints, DATA ABORT and UNALIGNED DATA ACCESS),

attempted SVC ID (for UNDEFINED SYSCALL), otherwise 0

u32 Stop point type that caused the event (when applicable): 0 = svc 0xFF, 1 = breakpoint, 2 = watchpoint

USER BREAK event[edit]

Type Field
u32 Break reason
u32[2] User-provided parameters for debug reasons, or 0

DEBUGGER BREAK event[edit]

Type Field
s32[4] IDs of the attached process's threads that were running on each core at the time of the @ref svcBreakDebugProcess call, or -1 (only the first 2 values are meaningful on O3DS).

SCHEDULE IN/OUT events[edit]

Type Field
u64 Clock tick
u32 CPU ID
u32[5] Unknown
u32 (?) Event info, apparently 0

SYSCALL IN/OUT events[edit]

Type Field
u64 Clock tick
u32 Syscall ID

OUTPUT STRING event[edit]

Type Field
u32 String address
u32 String size

MAP event[edit]

Type Field
u32 Mapped address
u32 Mapped size
u32 MemoryPermission
u32 MemoryState