aiie/nix/debugger.h

49 lines
855 B
C
Raw Normal View History

#ifndef __DEBUGGER_H
#define __DEBUGGER_H
#include <pthread.h>
#include <inttypes.h>
2021-01-13 23:10:47 +00:00
#define MAX_BREAKPOINTS 32
#define MAX_HISTORY 10000
struct _history {
char *msg;
struct _history *next;
};
class Debugger {
public:
Debugger();
~Debugger();
void setSocket(int cliSock);
void step();
bool active();
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();
// 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;
};
#endif