Add GDB target IO support (called Host I/O by gdb), not working yet

This commit is contained in:
TuxSH
2019-04-27 16:50:47 +02:00
parent 593f50de91
commit 54eeb97b24
8 changed files with 583 additions and 1 deletions

View File

@@ -33,10 +33,14 @@
#include "pmdbgext.h"
#include "sock_util.h"
#include "memory.h"
#include "ifile.h"
#define MAX_DEBUG 3
#define MAX_DEBUG_THREAD 127
#define MAX_BREAKPOINT 256
#define MAX_TIO_OPEN_FILE 64
// 512+24 is the ideal size as IDA will try to read exactly 0x100 bytes at a time. Add 4 to this, for $#<checksum>, see below.
// IDA seems to want additional bytes as well.
// 1024 is fine enough to put all regs in the 'T' stop reply packets
@@ -76,6 +80,12 @@ typedef struct PackedGdbHioRequest
bool ctrlC;
} PackedGdbHioRequest;
typedef struct GdbTioFileInfo
{
IFile f;
int flags;
} GdbTioFileInfo;
enum
{
GDB_FLAG_SELECTED = 1,
@@ -149,6 +159,9 @@ typedef struct GDBContext
u32 currentHioRequestTargetAddr;
PackedGdbHioRequest currentHioRequest;
GdbTioFileInfo openTioFileInfos[MAX_TIO_OPEN_FILE];
u32 numOpenTioFiles;
bool enableExternalMemoryAccess;
char *commandData, *commandEnd;
int latestSentPacketSize;

View File

@@ -33,6 +33,7 @@
u8 GDB_ComputeChecksum(const char *packetData, u32 len);
void GDB_EncodeHex(char *dst, const void *src, u32 len);
u32 GDB_DecodeHex(void *dst, const char *src, u32 len);
u32 GDB_EscapeBinaryData(void *dst, const void *src, u32 len, u32 maxLen);
u32 GDB_UnescapeBinaryData(void *dst, const void *src, u32 len);
const char *GDB_ParseIntegerList(u32 *dst, const char *src, u32 nb, char sep, char lastSep, u32 base, bool allowPrefix);
const char *GDB_ParseHexIntegerList(u32 *dst, const char *src, u32 nb, char lastSep);

View File

@@ -0,0 +1,31 @@
/*
* This file is part of Luma3DS
* Copyright (C) 2016-2019 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.
*/
#pragma once
#include "gdb.h"
GDB_DECLARE_VERBOSE_HANDLER(File);