2014-12-03 08:39:06 +00:00
|
|
|
/* 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"
|
2014-04-03 06:50:20 +00:00
|
|
|
|
|
|
|
#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
|
2015-01-16 08:50:15 +00:00
|
|
|
#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;
|
2015-01-16 08:50:15 +00:00
|
|
|
|
|
|
|
bool shouldBlock;
|
|
|
|
int untilPoll;
|
2014-02-01 11:05:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void GDBStubCreate(struct GDBStub*);
|
2015-01-22 06:45:48 +00:00
|
|
|
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
|