Difference between revisions of "KEventInfo"

From 3dbrew
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[Category:Kernel objects]]
 
[[Category:Kernel objects]]
 +
Size : 0x38 bytes
  
 +
It is converted to [[SVC#struct_DebugEventInfo|struct DebugEventInfo]] by using svcContinueDebugEvent.
  
Size : 0x38 bytes
+
== Object definition ==
  
 
{| class="wikitable" border="1"
 
{| class="wikitable" border="1"
Line 20: Line 22:
 
| 0x8
 
| 0x8
 
| u32
 
| u32
| Unknown
+
| 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
 
| 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
 +
| <code>union { ... }</code>
 +
| Event-specific data, see below (slightly different from DebugEventInfo)
 +
|}
 +
 +
== Event-specific data ==
 +
 +
=== ATTACH PROCESS event ===
 +
 +
{| class="wikitable" border="1"
 +
!  Type
 +
!  Field
 +
|-
 +
| [[KProcess]] *
 +
| Process
 +
|}
 +
 +
=== ATTACH THREAD event ===
 +
 +
{| class="wikitable" border="1"
 +
!  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 ===
 +
 +
{| class="wikitable" border="1"
 +
!  Type
 +
!  Field
 +
|-
 +
| u32
 +
| Exit reason
 +
|}
 +
 +
=== EXCEPTION event ===
 +
 +
{| class="wikitable" border="1"
 +
!  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
 +
|-
 +
| <code>union { ... }</code>
 +
| Type-specific data, see below
 +
|}
 +
 +
==== UNDEFINED INSTRUCTION/PREFETCH ABORT/DATA ABORT/UNALIGNED DATA ACCESS/UNDEFINED SYSCALL/STOP POINT events ====
 +
{| class="wikitable" border="1"
 +
!  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 ====
 +
{| class="wikitable" border="1"
 +
!  Type
 +
!  Field
 +
|-
 
| u32
 
| u32
 +
| Break reason
 +
|-
 +
| u32[2]
 +
| User-provided parameters for debug reasons, or 0
 +
|}
 +
 +
==== DEBUGGER BREAK event ====
 +
{| class="wikitable" border="1"
 +
!  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 ===
 +
 +
{| class="wikitable" border="1"
 +
!  Type
 +
!  Field
 +
|-
 +
| u64
 +
| Clock tick
 +
|-
 +
| u32
 +
| CPU ID
 +
|-
 +
| u32[5]
 
| Unknown
 
| Unknown
 
|-
 
|-
| 0xD
+
| u32 (?)
 +
| Event info, apparently 0
 +
|}
 +
 
 +
=== SYSCALL IN/OUT events ===
 +
 
 +
{| class="wikitable" border="1"
 +
!  Type
 +
!  Field
 +
|-
 +
| u64
 +
| Clock tick
 +
|-
 +
| u32
 +
| Syscall ID
 +
|}
 +
 
 +
=== OUTPUT STRING event ===
 +
 
 +
{| class="wikitable" border="1"
 +
!  Type
 +
!  Field
 +
|-
 +
| u32
 +
| String address
 +
|-
 +
| u32
 +
| String size
 +
|}
 +
 
 +
=== MAP event ===
 +
 
 +
{| class="wikitable" border="1"
 +
!  Type
 +
!  Field
 +
|-
 +
| u32
 +
| Mapped address
 +
|-
 
| u32
 
| u32
| Unknown
+
| Mapped size
 
|-
 
|-
| 0xE
 
 
| u32
 
| u32
| Unknown
+
| MemoryPermission
 
|-
 
|-
| 0xF
 
 
| u32
 
| u32
| Unknown
+
| MemoryState
 
|}
 
|}

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