Merge origin into this branch
This commit is contained in:
commit
58ff96dc83
@ -530,7 +530,7 @@ static inline bool patchLayeredFs(u64 progId, u8 *code, u32 size, u32 textSize,
|
|||||||
|
|
||||||
romfsRedirPatchSubstituted1 = *(u32 *)(code + fsOpenFileDirectly);
|
romfsRedirPatchSubstituted1 = *(u32 *)(code + fsOpenFileDirectly);
|
||||||
romfsRedirPatchHook1 = MAKE_BRANCH(payloadOffset + (u32)&romfsRedirPatchHook1 - (u32)romfsRedirPatch, fsOpenFileDirectly + 4);
|
romfsRedirPatchHook1 = MAKE_BRANCH(payloadOffset + (u32)&romfsRedirPatchHook1 - (u32)romfsRedirPatch, fsOpenFileDirectly + 4);
|
||||||
romfsRedirPatchSubstituted1 = *(u32 *)(code + fsTryOpenFile);
|
romfsRedirPatchSubstituted2 = *(u32 *)(code + fsTryOpenFile);
|
||||||
romfsRedirPatchHook2 = MAKE_BRANCH(payloadOffset + (u32)&romfsRedirPatchHook2 - (u32)romfsRedirPatch, fsTryOpenFile + 4);
|
romfsRedirPatchHook2 = MAKE_BRANCH(payloadOffset + (u32)&romfsRedirPatchHook2 - (u32)romfsRedirPatch, fsTryOpenFile + 4);
|
||||||
romfsRedirPatchCustomPath = pathAddress;
|
romfsRedirPatchCustomPath = pathAddress;
|
||||||
romfsRedirPatchFsMountArchive = 0x100000 + fsMountArchive;
|
romfsRedirPatchFsMountArchive = 0x100000 + fsMountArchive;
|
||||||
|
@ -23,7 +23,7 @@ romfsRedirPatch:
|
|||||||
.word 0xdead0002 @ Substituted opcode
|
.word 0xdead0002 @ Substituted opcode
|
||||||
.global romfsRedirPatchHook2
|
.global romfsRedirPatchHook2
|
||||||
romfsRedirPatchHook2:
|
romfsRedirPatchHook2:
|
||||||
.word 0xdead0002 @ Branch to hooked function
|
.word 0xdead0003 @ Branch to hooked function
|
||||||
|
|
||||||
@ Mounts the archive and registers it as 'lf:'
|
@ Mounts the archive and registers it as 'lf:'
|
||||||
mountArchive:
|
mountArchive:
|
||||||
@ -31,7 +31,7 @@ romfsRedirPatch:
|
|||||||
bne romfsRedirPatchSubstituted1
|
bne romfsRedirPatchSubstituted1
|
||||||
stmfd sp!, {r0-r4, lr}
|
stmfd sp!, {r0-r4, lr}
|
||||||
sub sp, sp, #4
|
sub sp, sp, #4
|
||||||
adr r1, romfsRedirPatchArchiveId
|
ldr r1, romfsRedirPatchArchiveId
|
||||||
mov r0, sp
|
mov r0, sp
|
||||||
ldr r4, romfsRedirPatchFsMountArchive
|
ldr r4, romfsRedirPatchFsMountArchive
|
||||||
blx r4
|
blx r4
|
||||||
|
@ -143,9 +143,6 @@ void GDB_DetachFromProcess(GDBContext *ctx)
|
|||||||
memset(ctx->threadListData, 0, sizeof(ctx->threadListData));
|
memset(ctx->threadListData, 0, sizeof(ctx->threadListData));
|
||||||
ctx->threadListDataPos = 0;
|
ctx->threadListDataPos = 0;
|
||||||
|
|
||||||
svcClearEvent(ctx->processAttachedEvent);
|
|
||||||
ctx->eventToWaitFor = ctx->processAttachedEvent;
|
|
||||||
|
|
||||||
//svcSignalEvent(server->statusUpdated);
|
//svcSignalEvent(server->statusUpdated);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -184,8 +181,6 @@ void GDB_DetachFromProcess(GDBContext *ctx)
|
|||||||
|
|
||||||
ctx->currentHioRequestTargetAddr = 0;
|
ctx->currentHioRequestTargetAddr = 0;
|
||||||
memset(&ctx->currentHioRequest, 0, sizeof(PackedGdbHioRequest));
|
memset(&ctx->currentHioRequest, 0, sizeof(PackedGdbHioRequest));
|
||||||
|
|
||||||
ctx->state = GDB_STATE_CONNECTED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Result GDB_CreateProcess(GDBContext *ctx, const FS_ProgramInfo *progInfo, u32 launchFlags)
|
Result GDB_CreateProcess(GDBContext *ctx, const FS_ProgramInfo *progInfo, u32 launchFlags)
|
||||||
|
@ -45,6 +45,9 @@ static void GDB_DetachImmediatelyExtended(GDBContext *ctx)
|
|||||||
RecursiveLock_Lock(&ctx->lock);
|
RecursiveLock_Lock(&ctx->lock);
|
||||||
ctx->state = GDB_STATE_DETACHING;
|
ctx->state = GDB_STATE_DETACHING;
|
||||||
|
|
||||||
|
svcClearEvent(ctx->processAttachedEvent);
|
||||||
|
ctx->eventToWaitFor = ctx->processAttachedEvent;
|
||||||
|
|
||||||
svcClearEvent(ctx->parent->statusUpdateReceived);
|
svcClearEvent(ctx->parent->statusUpdateReceived);
|
||||||
svcSignalEvent(ctx->parent->statusUpdated);
|
svcSignalEvent(ctx->parent->statusUpdated);
|
||||||
RecursiveLock_Unlock(&ctx->lock);
|
RecursiveLock_Unlock(&ctx->lock);
|
||||||
|
@ -192,6 +192,8 @@ int GDB_AcceptClient(GDBContext *ctx)
|
|||||||
int GDB_CloseClient(GDBContext *ctx)
|
int GDB_CloseClient(GDBContext *ctx)
|
||||||
{
|
{
|
||||||
RecursiveLock_Lock(&ctx->lock);
|
RecursiveLock_Lock(&ctx->lock);
|
||||||
|
svcClearEvent(ctx->processAttachedEvent);
|
||||||
|
ctx->eventToWaitFor = ctx->processAttachedEvent;
|
||||||
svcClearEvent(ctx->parent->statusUpdateReceived);
|
svcClearEvent(ctx->parent->statusUpdateReceived);
|
||||||
svcSignalEvent(ctx->parent->statusUpdated); // note: monitor will be waiting for lock
|
svcSignalEvent(ctx->parent->statusUpdated); // note: monitor will be waiting for lock
|
||||||
RecursiveLock_Unlock(&ctx->lock);
|
RecursiveLock_Unlock(&ctx->lock);
|
||||||
@ -199,8 +201,20 @@ int GDB_CloseClient(GDBContext *ctx)
|
|||||||
svcWaitSynchronization(ctx->parent->statusUpdateReceived, -1LL);
|
svcWaitSynchronization(ctx->parent->statusUpdateReceived, -1LL);
|
||||||
|
|
||||||
RecursiveLock_Lock(&ctx->lock);
|
RecursiveLock_Lock(&ctx->lock);
|
||||||
GDB_DetachFromProcess(ctx);
|
if (ctx->state >= GDB_STATE_ATTACHED)
|
||||||
|
GDB_DetachFromProcess(ctx);
|
||||||
|
|
||||||
|
ctx->localPort = 0;
|
||||||
|
ctx->enableExternalMemoryAccess = false;
|
||||||
|
ctx->flags = 0;
|
||||||
ctx->state = GDB_STATE_DISCONNECTED;
|
ctx->state = GDB_STATE_DISCONNECTED;
|
||||||
|
|
||||||
|
ctx->catchThreadEvents = false;
|
||||||
|
|
||||||
|
memset(&ctx->latestDebugEvent, 0, sizeof(DebugEventInfo));
|
||||||
|
memset(ctx->memoryOsInfoXmlData, 0, sizeof(ctx->memoryOsInfoXmlData));
|
||||||
|
memset(ctx->processesOsInfoXmlData, 0, sizeof(ctx->processesOsInfoXmlData));
|
||||||
|
|
||||||
RecursiveLock_Unlock(&ctx->lock);
|
RecursiveLock_Unlock(&ctx->lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -260,19 +274,7 @@ GDBContext *GDB_GetClient(GDBServer *server, u16 port)
|
|||||||
void GDB_ReleaseClient(GDBServer *server, GDBContext *ctx)
|
void GDB_ReleaseClient(GDBServer *server, GDBContext *ctx)
|
||||||
{
|
{
|
||||||
(void)server;
|
(void)server;
|
||||||
RecursiveLock_Lock(&ctx->lock);
|
(void)ctx;
|
||||||
ctx->localPort = 0;
|
|
||||||
ctx->enableExternalMemoryAccess = false;
|
|
||||||
ctx->flags = 0;
|
|
||||||
ctx->state = GDB_STATE_DISCONNECTED;
|
|
||||||
|
|
||||||
ctx->catchThreadEvents = false;
|
|
||||||
|
|
||||||
memset(&ctx->latestDebugEvent, 0, sizeof(DebugEventInfo));
|
|
||||||
memset(ctx->memoryOsInfoXmlData, 0, sizeof(ctx->memoryOsInfoXmlData));
|
|
||||||
memset(ctx->processesOsInfoXmlData, 0, sizeof(ctx->processesOsInfoXmlData));
|
|
||||||
|
|
||||||
RecursiveLock_Unlock(&ctx->lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct
|
static const struct
|
||||||
@ -344,9 +346,20 @@ int GDB_DoPacket(GDBContext *ctx)
|
|||||||
else
|
else
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
RecursiveLock_Unlock(&ctx->lock);
|
|
||||||
if(ctx->state == GDB_STATE_DETACHING)
|
if(ctx->state == GDB_STATE_DETACHING)
|
||||||
return (ctx->flags & GDB_FLAG_EXTENDED_REMOTE) ? ret : -1;
|
{
|
||||||
|
if(ctx->flags & GDB_FLAG_EXTENDED_REMOTE)
|
||||||
|
{
|
||||||
|
ctx->state = GDB_STATE_CONNECTED;
|
||||||
|
RecursiveLock_Unlock(&ctx->lock);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RecursiveLock_Unlock(&ctx->lock);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if((oldFlags & GDB_FLAG_PROCESS_CONTINUING) && !(ctx->flags & GDB_FLAG_PROCESS_CONTINUING))
|
if((oldFlags & GDB_FLAG_PROCESS_CONTINUING) && !(ctx->flags & GDB_FLAG_PROCESS_CONTINUING))
|
||||||
{
|
{
|
||||||
@ -356,5 +369,6 @@ int GDB_DoPacket(GDBContext *ctx)
|
|||||||
else if(!(oldFlags & GDB_FLAG_PROCESS_CONTINUING) && (ctx->flags & GDB_FLAG_PROCESS_CONTINUING))
|
else if(!(oldFlags & GDB_FLAG_PROCESS_CONTINUING) && (ctx->flags & GDB_FLAG_PROCESS_CONTINUING))
|
||||||
svcSignalEvent(ctx->continuedEvent);
|
svcSignalEvent(ctx->continuedEvent);
|
||||||
|
|
||||||
|
RecursiveLock_Unlock(&ctx->lock);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user