HBLDR_DebugNextApplicationByForce changes
This commit is contained in:
parent
eef22f8701
commit
687dfddd9f
@ -82,3 +82,16 @@ Result HBLDR_PatchExHeaderInfo(ExHeader_Info *exheaderInfo)
|
|||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result HBLDR_DebugNextApplicationByForce(bool dryRun)
|
||||||
|
{
|
||||||
|
u32* cmdbuf = getThreadCommandBuffer();
|
||||||
|
|
||||||
|
cmdbuf[0] = IPC_MakeHeader(5, 1, 0); // 0x50040
|
||||||
|
cmdbuf[1] = dryRun ? 1 : 0;
|
||||||
|
|
||||||
|
Result rc = svcSendSyncRequest(hbldrHandle);
|
||||||
|
if (R_SUCCEEDED(rc)) rc = cmdbuf[1];
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
@ -11,3 +11,4 @@ Result HBLDR_LoadProcess(Handle *outCodeSet, u32 textAddr, u32 kernelFlags, u64
|
|||||||
Result HBLDR_SetTarget(const char* path);
|
Result HBLDR_SetTarget(const char* path);
|
||||||
Result HBLDR_SetArgv(const void* buffer, size_t size);
|
Result HBLDR_SetArgv(const void* buffer, size_t size);
|
||||||
Result HBLDR_PatchExHeaderInfo(ExHeader_Info *exheaderInfo);
|
Result HBLDR_PatchExHeaderInfo(ExHeader_Info *exheaderInfo);
|
||||||
|
Result HBLDR_DebugNextApplicationByForce(bool dryRun);
|
||||||
|
@ -318,11 +318,13 @@ void HBLDR_HandleCommands(void *ctx)
|
|||||||
case 5: // DebugNextApplicationByForce
|
case 5: // DebugNextApplicationByForce
|
||||||
{
|
{
|
||||||
res = 0;
|
res = 0;
|
||||||
|
if (gdbServer.referenceCount == 0)
|
||||||
|
res = MAKERESULT(RL_PERMANENT, RS_INVALIDSTATE, RM_LDR, RD_NOT_INITIALIZED);
|
||||||
|
else if (cmdbuf[1] == 0)
|
||||||
|
{
|
||||||
GDB_LockAllContexts(&gdbServer);
|
GDB_LockAllContexts(&gdbServer);
|
||||||
if (nextApplicationGdbCtx != NULL)
|
if (nextApplicationGdbCtx != NULL)
|
||||||
res = MAKERESULT(RL_PERMANENT, RS_NOP, RM_LDR, RD_ALREADY_DONE);
|
res = MAKERESULT(RL_PERMANENT, RS_NOP, RM_LDR, RD_ALREADY_DONE);
|
||||||
else if (gdbServer.referenceCount == 0)
|
|
||||||
res = MAKERESULT(RL_PERMANENT, RS_INVALIDSTATE, RM_LDR, RD_NOT_INITIALIZED);
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nextApplicationGdbCtx = GDB_SelectAvailableContext(&gdbServer, GDB_PORT_BASE + 3, GDB_PORT_BASE + 4);
|
nextApplicationGdbCtx = GDB_SelectAvailableContext(&gdbServer, GDB_PORT_BASE + 3, GDB_PORT_BASE + 4);
|
||||||
@ -342,6 +344,7 @@ void HBLDR_HandleCommands(void *ctx)
|
|||||||
res = MAKERESULT(RL_PERMANENT, RS_OUTOFRESOURCE, RM_LDR, RD_OUT_OF_RANGE);
|
res = MAKERESULT(RL_PERMANENT, RS_OUTOFRESOURCE, RM_LDR, RD_OUT_OF_RANGE);
|
||||||
}
|
}
|
||||||
GDB_UnlockAllContexts(&gdbServer);
|
GDB_UnlockAllContexts(&gdbServer);
|
||||||
|
}
|
||||||
cmdbuf[1] = res;
|
cmdbuf[1] = res;
|
||||||
cmdbuf[0] = IPC_MakeHeader(5, 1, 0);
|
cmdbuf[0] = IPC_MakeHeader(5, 1, 0);
|
||||||
break;
|
break;
|
||||||
|
@ -174,11 +174,13 @@ void DebuggerMenu_DebugNextApplicationByForce(void)
|
|||||||
Result res = 0;
|
Result res = 0;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
|
|
||||||
|
if(initialized)
|
||||||
|
{
|
||||||
GDB_LockAllContexts(&gdbServer);
|
GDB_LockAllContexts(&gdbServer);
|
||||||
|
|
||||||
if (nextApplicationGdbCtx != NULL)
|
if (nextApplicationGdbCtx != NULL)
|
||||||
strcpy(buf, "Operation already performed.");
|
strcpy(buf, "Operation already performed.");
|
||||||
else if(initialized)
|
else
|
||||||
{
|
{
|
||||||
nextApplicationGdbCtx = GDB_SelectAvailableContext(&gdbServer, GDB_PORT_BASE + 3, GDB_PORT_BASE + 4);
|
nextApplicationGdbCtx = GDB_SelectAvailableContext(&gdbServer, GDB_PORT_BASE + 3, GDB_PORT_BASE + 4);
|
||||||
if (nextApplicationGdbCtx != NULL)
|
if (nextApplicationGdbCtx != NULL)
|
||||||
@ -199,9 +201,10 @@ void DebuggerMenu_DebugNextApplicationByForce(void)
|
|||||||
else
|
else
|
||||||
strcpy(buf, "Failed to allocate a slot.\nPlease unselect a process in the process list first");
|
strcpy(buf, "Failed to allocate a slot.\nPlease unselect a process in the process list first");
|
||||||
}
|
}
|
||||||
|
GDB_UnlockAllContexts(&gdbServer);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
strcpy(buf, "Debugger not enabled.");
|
strcpy(buf, "Debugger not enabled.");
|
||||||
GDB_UnlockAllContexts(&gdbServer);
|
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user