cdbdebugengine.h 4.04 KB
Newer Older
1
/**************************************************************************
2
3
4
**
** This file is part of Qt Creator
**
5
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
6
7
8
**
** Contact:  Qt Software Information (qt-info@nokia.com)
**
9
** Commercial Usage
10
**
11
12
13
14
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
15
**
16
** GNU Lesser General Public License Usage
17
**
18
19
20
21
22
23
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24
**
25
26
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
27
**
28
**************************************************************************/
29

hjk's avatar
hjk committed
30
31
#ifndef DEBUGGER_CDBENGINE_H
#define DEBUGGER_CDBENGINE_H
Banana Joe's avatar
Banana Joe committed
32
33

#include "idebuggerengine.h"
34
#include "debuggermanager.h"
hjk's avatar
hjk committed
35

Banana Joe's avatar
Banana Joe committed
36
37
38
39
namespace Debugger {
namespace Internal {

class DebuggerManager;
40
41
42
class CdbDebugEventCallback;
class CdbDebugOutput;
struct CdbDebugEnginePrivate;
Banana Joe's avatar
Banana Joe committed
43

hjk's avatar
hjk committed
44
class CdbDebugEngine : public IDebuggerEngine
Banana Joe's avatar
Banana Joe committed
45
{
Friedemann Kleint's avatar
Friedemann Kleint committed
46
    Q_DISABLE_COPY(CdbDebugEngine)
Banana Joe's avatar
Banana Joe committed
47
    Q_OBJECT
48
    explicit CdbDebugEngine(DebuggerManager *parent);
Friedemann Kleint's avatar
Friedemann Kleint committed
49

Banana Joe's avatar
Banana Joe committed
50
public:
hjk's avatar
hjk committed
51
    ~CdbDebugEngine();
Banana Joe's avatar
Banana Joe committed
52

Friedemann Kleint's avatar
Friedemann Kleint committed
53
54
55
    // Factory function that returns 0 if the debug engine library cannot be found.
    static IDebuggerEngine *create(DebuggerManager *parent);

Banana Joe's avatar
Banana Joe committed
56
57
58
59
60
61
62
63
64
65
66
67
    virtual void shutdown();
    virtual void setToolTipExpression(const QPoint &pos, const QString &exp);
    virtual bool startDebugger();
    virtual void exitDebugger();
    virtual void updateWatchModel();

    virtual void stepExec();
    virtual void stepOutExec();
    virtual void nextExec();
    virtual void stepIExec();
    virtual void nextIExec();
    
68
    virtual void continueInferior();    
Banana Joe's avatar
Banana Joe committed
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
    virtual void interruptInferior();

    virtual void runToLineExec(const QString &fileName, int lineNumber);
    virtual void runToFunctionExec(const QString &functionName);
    virtual void jumpToLineExec(const QString &fileName, int lineNumber);
    virtual void assignValueInDebugger(const QString &expr, const QString &value);
    virtual void executeDebuggerCommand(const QString &command);

    virtual void activateFrame(int index);
    virtual void selectThread(int index);

    virtual void attemptBreakpointSynchronization();

    virtual void loadSessionData();
    virtual void saveSessionData();

    virtual void reloadDisassembler();

    virtual void reloadModules();
    virtual void loadSymbols(const QString &moduleName);
    virtual void loadAllSymbols();
Friedemann Kleint's avatar
Friedemann Kleint committed
90
    virtual QList<Symbol> moduleSymbols(const QString &moduleName);
Banana Joe's avatar
Banana Joe committed
91
92

    virtual void reloadRegisters();
93
94
    virtual void reloadSourceFiles();

Banana Joe's avatar
Banana Joe committed
95
96
97
protected:
    void timerEvent(QTimerEvent*);

98
99
100
101
102
private slots:
    void slotConsoleStubStarted();
    void slotConsoleStubError(const QString &msg);
    void slotConsoleStubTerminated();

Banana Joe's avatar
Banana Joe committed
103
private:
104
105
    bool startAttachDebugger(qint64 pid, QString *errorMessage);
    bool startDebuggerWithExecutable(DebuggerStartMode sm, QString *errorMessage);
Banana Joe's avatar
Banana Joe committed
106
107
    void startWatchTimer();
    void killWatchTimer();
108
    void processTerminated(unsigned long exitCode);
Friedemann Kleint's avatar
Friedemann Kleint committed
109
110
111
112
    bool executeDebuggerCommand(const QString &command, QString *errorMessage);
    bool evaluateExpression(const QString &expression, QString *value, QString *type, QString *errorMessage);
    void evaluateWatcher(WatchData *wd);
    void filterEvaluateWatchers(QList<WatchData> *wd, WatchHandler *wh);
Banana Joe's avatar
Banana Joe committed
113

114
    CdbDebugEnginePrivate *m_d;
Banana Joe's avatar
Banana Joe committed
115

116
    friend struct CdbDebugEnginePrivate;
hjk's avatar
hjk committed
117
118
    friend class CdbDebugEventCallback;
    friend class CdbDebugOutput;
Banana Joe's avatar
Banana Joe committed
119
120
121
122
123
};

} // namespace Internal
} // namespace Debugger

hjk's avatar
hjk committed
124
#endif // DEBUGGER_CDBENGINE_H