-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDebugThread.h
More file actions
62 lines (45 loc) · 1.28 KB
/
DebugThread.h
File metadata and controls
62 lines (45 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* The MIT License - see LICENSE file for details
*/
#ifndef _DEBUG_CONSOLE_THREAD_H_
#define _DEBUG_CONSOLE_THREAD_H_
#include <map>
#include <vector>
#include <string>
#include <iostream>
#include <queue>
#include <Poco/Thread.h>
#include <Poco/Runnable.h>
#include <Poco/Mutex.h>
#include "DebugPanel.h"
#include <Poco/Net/SocketAddress.h>
#include <Poco/Net/StreamSocket.h>
#include <Poco/Net/SocketStream.h>
#include <Poco/StreamCopier.h>
class DebugThread: public Poco::Runnable
{
public:
DebugThread(Poco::Net::StreamSocket client);
void stop();
void print(const std::string &output);
void postline(const std::string &line);
bool hasBreakpointAt(const std::string &file, unsigned int line);
std::vector<unsigned int> listBreakpointOfFile(const std::string &file);
void assignDebugPanel(DebugPanel *panel);
void notifyFileAndLine(const std::string &file, unsigned int line);
protected:
virtual void run();
private:
std::string readline();
void send(const std::string &s);
std::string receive();
std::string receive(unsigned int len);
std::map<std::string, std::map<std::string, bool> > breakpoints;
std::map<std::string, std::string> watches;
DebugPanel *panel;
Poco::Net::SocketStream client;
bool running;
std::queue<std::string> lines;
Poco::Mutex mutex;
};
#endif