cdbdebugengine.h 4.52 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
** Contact: Nokia Corporation (qt-info@nokia.com)
8
**
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
** If you are unsure which license is appropriate for your use, please
26
** contact the sales department at http://www.qtsoftware.com/contact.
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();
67
    virtual void updateWatchData(const WatchData &data);
Banana Joe's avatar
Banana Joe committed
68
69
70
71
72
73

    virtual void stepExec();
    virtual void stepOutExec();
    virtual void nextExec();
    virtual void stepIExec();
    virtual void nextIExec();
74
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 warning(const QString &w);
111

Banana Joe's avatar
Banana Joe committed
112
private:
113
    bool startAttachDebugger(qint64 pid, DebuggerStartMode sm, QString *errorMessage);
114
    bool startDebuggerWithExecutable(DebuggerStartMode sm, QString *errorMessage);
Banana Joe's avatar
Banana Joe committed
115
116
    void startWatchTimer();
    void killWatchTimer();
117
    void processTerminated(unsigned long exitCode);
Friedemann Kleint's avatar
Friedemann Kleint committed
118
    bool executeDebuggerCommand(const QString &command, QString *errorMessage);
119
120
    bool evaluateExpression(const QString &expression, QString *value, QString *type, QString *errorMessage);
    void evaluateWatcher(WatchData *wd);
121
    QString editorToolTip(const QString &exp, const QString &function);
Banana Joe's avatar
Banana Joe committed
122

123
    CdbDebugEnginePrivate *m_d;
Banana Joe's avatar
Banana Joe committed
124

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

} // namespace Internal
} // namespace Debugger

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