src/debugger/gdb-stub.h (view raw)
1/* Copyright (c) 2013-2014 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#ifndef GDB_STUB_H
7#define GDB_STUB_H
8
9#include "util/common.h"
10
11#include "debugger/debugger.h"
12
13#include "util/socket.h"
14
15#define GDB_STUB_MAX_LINE 1200
16#define GDB_STUB_INTERVAL 32
17
18enum GDBStubAckState {
19 GDB_ACK_PENDING = 0,
20 GDB_ACK_RECEIVED,
21 GDB_NAK_RECEIVED,
22 GDB_ACK_OFF
23};
24
25struct GDBStub {
26 struct ARMDebugger d;
27
28 char line[GDB_STUB_MAX_LINE];
29 char outgoing[GDB_STUB_MAX_LINE];
30 enum GDBStubAckState lineAck;
31
32 Socket socket;
33 Socket connection;
34
35 bool shouldBlock;
36 int untilPoll;
37};
38
39void GDBStubCreate(struct GDBStub*);
40int GDBStubListen(struct GDBStub*, int port, const struct Address* bindAddress);
41
42void GDBStubHangup(struct GDBStub*);
43void GDBStubShutdown(struct GDBStub*);
44
45void GDBStubUpdate(struct GDBStub*);
46
47#endif