2017-06-05 02:02:04 +02:00
|
|
|
/*
|
|
|
|
* This file is part of Luma3DS
|
|
|
|
* Copyright (C) 2016-2017 Aurora Wright, TuxSH
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
|
|
|
|
* * Requiring preservation of specified reasonable legal notices or
|
|
|
|
* author attributions in that material or in the Appropriate Legal
|
|
|
|
* Notices displayed by works containing it.
|
|
|
|
* * Prohibiting misrepresentation of the origin of that material,
|
|
|
|
* or requiring that modified versions of such material be marked in
|
|
|
|
* reasonable ways as different from the original version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "gdb.h"
|
|
|
|
#include "gdb/net.h"
|
|
|
|
|
|
|
|
void GDB_InitializeContext(GDBContext *ctx)
|
|
|
|
{
|
2017-06-14 10:04:09 +02:00
|
|
|
RecursiveLock_Init(&ctx->lock);
|
2017-06-05 02:02:04 +02:00
|
|
|
|
2017-06-14 10:04:09 +02:00
|
|
|
RecursiveLock_Lock(&ctx->lock);
|
2017-06-05 02:02:04 +02:00
|
|
|
|
2017-06-14 10:04:09 +02:00
|
|
|
svcCreateEvent(&ctx->continuedEvent, RESET_ONESHOT);
|
|
|
|
svcCreateEvent(&ctx->clientAcceptedEvent, RESET_STICKY);
|
2017-06-05 02:02:04 +02:00
|
|
|
|
2017-06-14 10:04:09 +02:00
|
|
|
ctx->eventToWaitFor = ctx->clientAcceptedEvent;
|
|
|
|
ctx->continueFlags = (DebugFlags)(DBG_SIGNAL_FAULT_EXCEPTION_EVENTS | DBG_INHIBIT_USER_CPU_EXCEPTION_HANDLERS);
|
2017-06-05 02:02:04 +02:00
|
|
|
|
2017-06-14 10:04:09 +02:00
|
|
|
RecursiveLock_Unlock(&ctx->lock);
|
2017-06-05 02:02:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void GDB_FinalizeContext(GDBContext *ctx)
|
|
|
|
{
|
2017-06-14 10:04:09 +02:00
|
|
|
RecursiveLock_Lock(&ctx->lock);
|
2017-06-05 02:02:04 +02:00
|
|
|
|
2017-06-14 10:04:09 +02:00
|
|
|
svcClearEvent(ctx->clientAcceptedEvent);
|
2017-06-05 02:02:04 +02:00
|
|
|
|
2017-06-14 10:04:09 +02:00
|
|
|
svcCloseHandle(ctx->clientAcceptedEvent);
|
|
|
|
svcCloseHandle(ctx->continuedEvent);
|
2017-06-05 02:02:04 +02:00
|
|
|
|
2017-06-14 10:04:09 +02:00
|
|
|
RecursiveLock_Unlock(&ctx->lock);
|
2017-06-05 02:02:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
GDB_DECLARE_HANDLER(Unsupported)
|
|
|
|
{
|
2017-06-14 10:04:09 +02:00
|
|
|
return GDB_ReplyEmpty(ctx);
|
2017-06-05 02:02:04 +02:00
|
|
|
}
|