2018-02-18 01:44:04 +00:00
|
|
|
#ifndef __DEBUGGER_H
|
|
|
|
#define __DEBUGGER_H
|
|
|
|
|
|
|
|
#include <pthread.h>
|
2018-06-16 15:41:18 +00:00
|
|
|
#include <inttypes.h>
|
2018-02-18 01:44:04 +00:00
|
|
|
|
2021-01-13 23:10:47 +00:00
|
|
|
#define MAX_BREAKPOINTS 32
|
|
|
|
#define MAX_HISTORY 10000
|
|
|
|
|
|
|
|
struct _history {
|
|
|
|
char *msg;
|
|
|
|
struct _history *next;
|
|
|
|
};
|
|
|
|
|
2018-02-18 01:44:04 +00:00
|
|
|
class Debugger {
|
|
|
|
public:
|
|
|
|
Debugger();
|
|
|
|
~Debugger();
|
|
|
|
|
|
|
|
void setSocket(int cliSock);
|
|
|
|
void step();
|
2018-06-16 15:41:18 +00:00
|
|
|
bool active();
|
2018-02-18 01:44:04 +00:00
|
|
|
|
2021-01-13 23:10:47 +00:00
|
|
|
bool addBreakpoint(uint16_t addr);
|
|
|
|
bool isAnyBreakpointSet();
|
|
|
|
bool isBreakpointAt(uint16_t addr);
|
|
|
|
bool removeBreakpoint(uint16_t addr);
|
|
|
|
void removeAllBreakpoints();
|
|
|
|
|
|
|
|
void addStringToHistory(const char *s);
|
|
|
|
void addCurrentPCToHistory();
|
|
|
|
|
2018-02-18 01:44:04 +00:00
|
|
|
// private:
|
|
|
|
int sd; // server (listener)
|
|
|
|
int cd; // client (connected to us)
|
|
|
|
pthread_t listenThreadID;
|
|
|
|
|
2021-01-13 23:10:47 +00:00
|
|
|
uint32_t breakpoints[MAX_BREAKPOINTS];
|
2021-01-11 04:52:58 +00:00
|
|
|
bool steppingOut;
|
|
|
|
bool singleStep;
|
2021-01-13 23:10:47 +00:00
|
|
|
|
|
|
|
struct _history *history;
|
|
|
|
struct _history *endh;
|
|
|
|
uint32_t historyCount;
|
2018-02-18 01:44:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|