cdbdebugengine.h 4.59 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

36
37
#include <QtCore/QSharedPointer>

Banana Joe's avatar
Banana Joe committed
38
39
40
41
namespace Debugger {
namespace Internal {

class DebuggerManager;
42
43
44
class CdbDebugEventCallback;
class CdbDebugOutput;
struct CdbDebugEnginePrivate;
45
struct CdbOptions;
Banana Joe's avatar
Banana Joe committed
46

hjk's avatar
hjk committed
47
class CdbDebugEngine : public IDebuggerEngine
Banana Joe's avatar
Banana Joe committed
48
{
Friedemann Kleint's avatar
Friedemann Kleint committed
49
    Q_DISABLE_COPY(CdbDebugEngine)
Banana Joe's avatar
Banana Joe committed
50
    Q_OBJECT
51
52
    explicit CdbDebugEngine(DebuggerManager *parent,
                            const QSharedPointer<CdbOptions> &options);
Friedemann Kleint's avatar
Friedemann Kleint committed
53

Banana Joe's avatar
Banana Joe committed
54
public:
hjk's avatar
hjk committed
55
    ~CdbDebugEngine();
Banana Joe's avatar
Banana Joe committed
56

Friedemann Kleint's avatar
Friedemann Kleint committed
57
    // Factory function that returns 0 if the debug engine library cannot be found.
58
59
60
    static IDebuggerEngine *create(DebuggerManager *parent,
                                   const QSharedPointer<CdbOptions> &options,
                                   QString *errorMessage);
Friedemann Kleint's avatar
Friedemann Kleint committed
61

Banana Joe's avatar
Banana Joe committed
62
    virtual void shutdown();
63
    virtual void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos);
64
    virtual bool startDebugger(const QSharedPointer<DebuggerStartParameters> &startParameters);
Banana Joe's avatar
Banana Joe committed
65
    virtual void exitDebugger();
Friedemann Kleint's avatar
Friedemann Kleint committed
66
    virtual void detachDebugger();
Banana Joe's avatar
Banana Joe committed
67
68
69
70
71
72
73
74
    virtual void updateWatchModel();

    virtual void stepExec();
    virtual void stepOutExec();
    virtual void nextExec();
    virtual void stepIExec();
    virtual void nextIExec();
    
75
    virtual void continueInferior();    
Banana Joe's avatar
Banana Joe committed
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
    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 reloadDisassembler();

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

    virtual void reloadRegisters();
97
    virtual void reloadSourceFiles();
98
    virtual void reloadFullStack() {}
99

100
101
102
public slots:
    void syncDebuggerPaths();

Banana Joe's avatar
Banana Joe committed
103
104
105
protected:
    void timerEvent(QTimerEvent*);

106
107
108
private slots:
    void slotConsoleStubStarted();
    void slotConsoleStubError(const QString &msg);
109
    void slotConsoleStubTerminated();    
110
    void slotAttachedCrashed();
111
    void warning(const QString &w);
112

Banana Joe's avatar
Banana Joe committed
113
private:
114
    bool startAttachDebugger(qint64 pid, DebuggerStartMode sm, QString *errorMessage);
115
    bool startDebuggerWithExecutable(DebuggerStartMode sm, QString *errorMessage);
Banana Joe's avatar
Banana Joe committed
116
117
    void startWatchTimer();
    void killWatchTimer();
118
    void processTerminated(unsigned long exitCode);
Friedemann Kleint's avatar
Friedemann Kleint committed
119
120
121
122
    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);
123
    QString editorToolTip(const QString &exp, const QString &function);
Banana Joe's avatar
Banana Joe committed
124

125
    CdbDebugEnginePrivate *m_d;
Banana Joe's avatar
Banana Joe committed
126

127
    friend struct CdbDebugEnginePrivate;
hjk's avatar
hjk committed
128
129
    friend class CdbDebugEventCallback;
    friend class CdbDebugOutput;
Banana Joe's avatar
Banana Joe committed
130
131
132
133
134
};

} // namespace Internal
} // namespace Debugger

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