mgba/src/debugger/gdb-stub.h

48 lines
989 B
C
Raw Normal View History

/* Copyright (c) 2013-2014 Jeffrey Pfau
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
2014-02-01 11:05:10 +00:00
#ifndef GDB_STUB_H
#define GDB_STUB_H
2014-10-12 01:18:47 +00:00
#include "util/common.h"
#include "debugger/debugger.h"
#include "util/socket.h"
2014-02-01 11:05:10 +00:00
2014-02-01 13:44:40 +00:00
#define GDB_STUB_MAX_LINE 1200
#define GDB_STUB_INTERVAL 32
2014-02-01 11:05:10 +00:00
2014-02-01 12:10:22 +00:00
enum GDBStubAckState {
GDB_ACK_PENDING = 0,
GDB_ACK_RECEIVED,
GDB_NAK_RECEIVED,
GDB_ACK_OFF
};
2014-02-01 11:05:10 +00:00
struct GDBStub {
struct ARMDebugger d;
char line[GDB_STUB_MAX_LINE];
2014-02-01 12:10:22 +00:00
char outgoing[GDB_STUB_MAX_LINE];
enum GDBStubAckState lineAck;
2014-02-01 11:05:10 +00:00
2014-02-04 07:01:26 +00:00
Socket socket;
Socket connection;
bool shouldBlock;
int untilPoll;
2014-02-01 11:05:10 +00:00
};
void GDBStubCreate(struct GDBStub*);
bool GDBStubListen(struct GDBStub*, int port, const struct Address* bindAddress);
2014-02-01 11:05:10 +00:00
void GDBStubHangup(struct GDBStub*);
void GDBStubShutdown(struct GDBStub*);
void GDBStubUpdate(struct GDBStub*);
#endif