n64: use different GDB signals for different exceptions #1667
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When debugging homebrew with gdb, it might be annoying if gdb stops at exceptions that are correctly handled by the running application. This is a bit hard to know so, besides providing some (debatable) default, we need a way to selectively ignore specific exceptions.
This commit generates different GDB signals for different families of exceptions. The mapping between MIPS exceptions and UNIX signals is completely arbitrary; it tries to "sort of" match the meaning of the exception where possible, and otherwise just use a random signal.
The GDB client can configure which signals should be logged, which should cause the application to stop, and which should be ignored, using the "handle" command.
By default, we want to ignore exceptions generated by interrupts (as those are normally handled by the application) and those handled by the operating system (like the COP1 exception which both libultra and libdragon use to speed up context switching). To do so, we assign to them signals that are ignored by default by gdb (SIGWINCH and SIGURG respectively).