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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
/***************************************************************************
rdbcontroller.h - description
-------------------
begin : Sun Aug 8 1999
copyright : (C) 1999 by John Birch
email : [email protected]
Adapted for ruby debugging
--------------------------
begin : Mon Nov 1 2004
copyright : (C) 2004 by Richard Dale
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef _RDBCONTROLLER_H_
#define _RDBCONTROLLER_H_
#include "dbgcontroller.h"
#include <qcstring.h>
#include <qdom.h>
#include <qobject.h>
#include <qptrlist.h>
#include <qstring.h>
#include <qsocketnotifier.h>
class KProcess;
namespace RDBDebugger
{
class Breakpoint;
class DbgCommand;
class FramestackWidget;
class VarItem;
class VariableTree;
class STTY;
/**
* A front end implementation to the ruby command line debugger
* @author jbb
*/
class RDBController : public DbgController
{
Q_OBJECT
public:
RDBController(VariableTree *varTree, FramestackWidget *frameStack, QDomDocument &projectDom);
~RDBController();
protected:
void queueCmd(DbgCommand *cmd, bool executeNext=false);
private:
void parseProgramLocation (char *buf);
void parseBacktraceList (char *buf);
void parseThreadList (char* buf);
void parseSwitchThread (char* buf);
void parseFrameMove (char *buf);
void parseBreakpointSet (char *buf);
void parseDisplay (char *buf, char * expr);
void parseUpdateDisplay (char *buf);
void parseGlobals (char *buf);
void parseLocals (char type, char *buf);
void parseRequestedData (char *buf);
void parseFrameSelected (char *buf);
void parse (char *buf);
void pauseApp();
void executeCmd ();
void destroyCmds();
void removeInfoRequests();
void actOnProgramPause(const QString &msg);
void programNoApp(const QString &msg, bool msgBox);
void setBreakpoint(const QCString &BPSetCmd, int key);
void clearBreakpoint(const QCString &BPClearCmd);
void modifyBreakpoint(const Breakpoint&);
void setStateOn(int stateOn) { state_ |= stateOn; }
void setStateOff(int stateOff) { state_ &= ~stateOff; }
bool stateIsOn(int state) { return state_ &state; }
public slots:
void configure();
void slotStart( const QString& shell, const QString& characterCoding,
const QString& run_directory, const QString& debuggee_path,
const QString &application, const QString& run_arguments,
bool show_constants, bool trace_into_ruby );
//void slotStart(const QString& shell, const QString &application);
void slotStopDebugger();
void slotRun();
void slotRunUntil(const QString &filename, int lineNum);
void slotStepInto();
void slotStepOver();
void slotStepOutOff();
void slotBreakInto();
void slotBPState( const Breakpoint& );
void slotClearAllBreakpoints();
void slotExpandItem(VarItem *parent, const QCString &userRequest);
void slotRubyInspect(const QString &inspectText);
void slotSelectFrame(int frameNo, int threadNo, const QString& frameName);
void slotFetchGlobals(bool fetch);
void slotAddWatchExpression(const QString& expr, bool execute);
void slotRemoveWatchExpression(int displayId);
void slotUserRDBCmd(const QString&);
protected slots:
void slotDbgStdout(KProcess *proc, char *buf, int buflen);
void slotDbgStderr(KProcess *proc, char *buf, int buflen);
void slotDbgWroteStdin(KProcess *proc);
void slotDbgProcessExited(KProcess *proc);
void slotAcceptConnection(int masterSocket);
void slotReadFromSocket(int socket);
signals:
void acceptPendingBPs ();
void unableToSetBPNow (int BPNo);
void addWatchExpression (const QString&);
private:
FramestackWidget* frameStack_;
VariableTree* varTree_;
int currentFrame_;
int viewedThread_;
int stdoutSizeofBuf_; // size of the buffer for holding stdout piped
// from the ruby program
int stdoutOutputLen_; // amount of data in the output buffer
char* stdoutOutput_; // buffer for the output from kprocess
QCString holdingZone_;
int rdbSizeofBuf_; // size of the output buffer from rdb
int rdbOutputLen_; // amount of data in the rdb buffer
char* rdbOutput_; // buffer for the output from rdb via the Unix socket
int masterSocket_; // The socket to accept connections
QSocketNotifier* acceptNotifier_;
static QCString unixSocketPath_; // The name of the Unix Domain socket
int socket_; // The socket to read and write to the debuggee
QSocketNotifier* socketNotifier_;
QPtrList<DbgCommand> cmdList_;
DbgCommand* currentCmd_;
QString currentPrompt_;
STTY* tty_;
// Details for starting the ruby debugger process
QString rubyInterpreter_;
QString characterCoding_;
QString runDirectory_;
QString debuggeePath_;
QString application_;
QString runArguments_;
bool showConstants_;
bool traceIntoRuby_;
// Some state variables
int state_;
bool programHasExited_;
// Configuration values
QDomDocument &dom;
bool config_forceBPSet_;
bool config_dbgTerminal_;
};
}
#endif
|