switchbrew / libnx

Library for Switch Homebrew
https://switchbrew.github.io/libnx/
ISC License
1.27k stars 174 forks source link

thread: set arguments/fields before CreateThread #563

Closed SciresM closed 3 years ago

SciresM commented 3 years ago

This changes threadInit to set thread/argument fields before calling svcCreateThread().

This is desirable because svcCreateThread will cause an attached debugger to receive a DebugEvent, at which point the debugger will begin parsing information about the thread/etc.

As is, it is impossible for the debugger to reconstruct information about the thread on creation; by setting the fields appropriately beforehand, they can be parsed from the ThreadEntryArgs etc.