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
17enum GDBStubAckState {
18 GDB_ACK_PENDING = 0,
19 GDB_ACK_RECEIVED,
20 GDB_NAK_RECEIVED,
21 GDB_ACK_OFF
22};
23
24struct GDBStub {
25 struct ARMDebugger d;
26
27 char line[GDB_STUB_MAX_LINE];
28 char outgoing[GDB_STUB_MAX_LINE];
29 enum GDBStubAckState lineAck;
30
31 Socket socket;
32 Socket connection;
33};
34
35void GDBStubCreate(struct GDBStub*);
36int GDBStubListen(struct GDBStub*, int port, const struct Address* bindAddress);
37
38void GDBStubHangup(struct GDBStub*);
39void GDBStubShutdown(struct GDBStub*);
40
41void GDBStubUpdate(struct GDBStub*);
42
43#endif