Cleanup new code, add docs and error handling
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
// Copyright 2022 Citra Emulator Project
|
||||
// Copyright 2023 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
@ -11,11 +11,14 @@
|
||||
namespace GDBStub {
|
||||
|
||||
/**
|
||||
* A request from a debugged application to perform some I/O with the GDB client.
|
||||
* This structure is also used to encode the reply back to the application.
|
||||
*
|
||||
* Based on the Rosalina implementation:
|
||||
* https://github.com/LumaTeam/Luma3DS/blob/master/sysmodules/rosalina/include/gdb.h#L46C27-L62
|
||||
*/
|
||||
struct PackedGdbHioRequest {
|
||||
char magic[4]; // "GDB\x00"
|
||||
char magic[4]; // "GDB\0"
|
||||
u32 version;
|
||||
|
||||
// Request
|
||||
@ -31,14 +34,24 @@ struct PackedGdbHioRequest {
|
||||
bool ctrl_c;
|
||||
};
|
||||
|
||||
/**
|
||||
* Set the current HIO request to the given address. This is how the debugged
|
||||
* app indicates to the gdbstub that it wishes to perform a request.
|
||||
*
|
||||
* @param address The memory address of the \ref PackedGdbHioRequest.
|
||||
*/
|
||||
void SetHioRequest(const VAddr address);
|
||||
|
||||
bool HandleHioReply(const u8* const command_buffer, const u32 command_length);
|
||||
/**
|
||||
* If there is a pending HIO request, send it to the client.
|
||||
*
|
||||
* @returns whethere any request was sent to the client.
|
||||
*/
|
||||
bool HandlePendingHioRequestPacket();
|
||||
|
||||
bool HasPendingHioRequest();
|
||||
|
||||
bool WaitingForHioReply();
|
||||
|
||||
std::string BuildHioRequestPacket();
|
||||
/**
|
||||
* Process an HIO reply from the client.
|
||||
*/
|
||||
void HandleHioReply(const u8* const command_buffer, const u32 command_length);
|
||||
|
||||
} // namespace GDBStub
|
||||
|
Reference in New Issue
Block a user