summaryrefslogtreecommitdiffstats
path: root/languages/ruby/debugger/dbgcontroller.h
blob: e5a3f99afaa9b8ff3448efb9ca20e34c18142730 (plain)
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
/***************************************************************************
    begin                : Sun Aug 8 1999
    copyright            : (C) 1999 by John Birch
    email                : jbb@kdevelop.org
	
                          Adapted for ruby debugging
                          --------------------------
    begin                : Mon Nov 1 2004
    copyright            : (C) 2004 by Richard Dale
    email                : Richard_Dale@tipitina.demon.co.uk
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 _DBGCONTROLLER_H_
#define _DBGCONTROLLER_H_

#include <tqobject.h>
#include <domutil.h>

class TDEProcess;
class TQString;
class TQStrList;

namespace RDBDebugger
{

class Breakpoint;
class DbgCommand;
class LazyFetchItem;
class VarItem;

/***************************************************************************/
/**
 * @author jbb
 */
/***************************************************************************/
// sigh - namespace's don't work on some of the older compilers
enum DBGStateFlags
{
  s_dbgNotStarted     = 1 << 0,
  s_appNotStarted     = 1 << 1,
  s_appBusy           = 1 << 2,
  s_waitForWrite      = 1 << 3,
  s_programExited     = 1 << 4,
  s_silent            = 1 << 5,
  s_fetchLocals       = 1 << 6,
  s_viewBT            = 1 << 7,
  s_viewBP            = 1 << 8,
  s_attached          = 1 << 9,
  s_fetchGlobals      = 1 << 10,
  s_waitTimer         = 1 << 11,
  s_shuttingDown      = 1 << 12,
  s_viewThreads       = 1 << 13
};

				
enum RttiValues { 
	RTTI_WATCH_ROOT			= 1001, 
	RTTI_GLOBAL_ROOT		= 1002, 
	RTTI_VAR_FRAME_ROOT		= 1003, 
	RTTI_LAZY_FETCH_ITEM 	= 1004,
	RTTI_VAR_ITEM			= 1005,
	RTTI_WATCH_VAR_ITEM		= 1006,
	RTTI_THREAD_STACK_ITEM	= 1007,
	RTTI_FRAME_STACK_ITEM	= 1008
}; 


/***************************************************************************/
/***************************************************************************/
/***************************************************************************/
class DbgController : public TQObject
{
    TQ_OBJECT
  

public:

    DbgController();
    virtual ~DbgController();

    virtual bool stateIsOn( int state )                                     = 0;

protected:
    virtual void queueCmd(DbgCommand *cmd, bool executeNext)                = 0;
    virtual void parse(char *str)                                           = 0;

public slots:
    virtual void configure()                                                = 0;

    /**
     * Start the debugger
     * \param ruby_interpreter shell
	 * \param character_coding -K option
     * \param run_directory Directory from where the program should be run
     * \param debuggee_path Absolute path to debuggee.rb debugger script
     * \param application Absolute path to application
     * \param run_arguments Command line arguments to be passed to the application
     * \param show_constants Show ruby constants in the variables view
     */
    virtual void slotStart(const TQString& ruby_interpreter,
	                       const TQString& character_coding,
                           const TQString& run_directory,
						   const TQString& debuggee_path,
                           const TQString& application,
                           const TQString& run_arguments,
                           bool show_constants,
                           bool trace_into_ruby)                            = 0;

    virtual void slotStopDebugger()                                         = 0;

    virtual void slotRun()                                                  = 0;
    virtual void slotRunUntil(const TQString &fileName, int lineNum)         = 0;
    virtual void slotStepInto()                                             = 0;
    virtual void slotStepOver()                                             = 0;
    virtual void slotStepOutOff()                                           = 0;

    virtual void slotBreakInto()                                            = 0;
    virtual void slotBPState(const Breakpoint&)                             = 0;


    virtual void slotExpandItem(VarItem *parent,
                                    const TQCString &userRequest)            = 0;
    virtual void slotSelectFrame(int frame, int thread, 
	                                const TQString& frameName)               = 0;
    virtual void slotFetchGlobals(bool fetch)                               = 0;

protected slots:
    virtual void slotDbgStdout(TDEProcess *proc, char *buf, int buflen)       = 0;
    virtual void slotDbgStderr(TDEProcess*, char*, int) {} ;
    virtual void slotDbgWroteStdin(TDEProcess *proc)                          = 0;
    virtual void slotDbgProcessExited(TDEProcess *proc)                       = 0;
	
    virtual void slotAcceptConnection(int passive_socket)                   = 0;
    virtual void slotReadFromSocket(int socket)                             = 0;

signals:
    void gotoSourcePosition   (const TQString &fileName, int lineNum);
    void rawRDBBreakpointList (char *buf);
    void rawRDBBreakpointSet  (char *buf, int key);
    void ttyStdout            (const char *output);
    void ttyStderr            (const char *output);
    void rdbStdout            (const char *output);
    void rdbStderr            (const char *output);
    void showStepInSource     (const TQString &fileName, int lineNum, const TQString &address);
    void dbgStatus            (const TQString &status, int statusFlag);

protected:
    TDEProcess *dbgProcess_;
};

}

#endif