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
11CXX_GUARD_START
12
13#include "debugger/debugger.h"
14
15#include "util/socket.h"
16
17#define GDB_STUB_MAX_LINE 1200
18#define GDB_STUB_INTERVAL 32
19
20enum GDBStubAckState {
21 GDB_ACK_PENDING = 0,
22 GDB_ACK_RECEIVED,
23 GDB_NAK_RECEIVED,
24 GDB_ACK_OFF
25};
26
27struct GDBStub {
28 struct mDebugger d;
29
30 char line[GDB_STUB_MAX_LINE];
31 char outgoing[GDB_STUB_MAX_LINE];
32 enum GDBStubAckState lineAck;
33
34 Socket socket;
35 Socket connection;
36
37 bool shouldBlock;
38 int untilPoll;
39
40 bool supportsSwbreak;
41 bool supportsHwbreak;
42};
43
44void GDBStubCreate(struct GDBStub*);
45bool GDBStubListen(struct GDBStub*, int port, const struct Address* bindAddress);
46
47void GDBStubHangup(struct GDBStub*);
48void GDBStubShutdown(struct GDBStub*);
49
50void GDBStubUpdate(struct GDBStub*);
51
52CXX_GUARD_END
53
54#endif