cdbdebugengine.h 4.68 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
hjk's avatar
hjk committed
26
** contact the sales department at http://qt.nokia.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
class DisassemblerViewAgent;
43
44
45
class CdbDebugEventCallback;
class CdbDebugOutput;
struct CdbDebugEnginePrivate;
46
struct CdbOptions;
Banana Joe's avatar
Banana Joe committed
47

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

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

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

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

    virtual void stepExec();
    virtual void stepOutExec();
    virtual void nextExec();
    virtual void stepIExec();
    virtual void nextIExec();
75
76
    
    virtual void continueInferior();    
Banana Joe's avatar
Banana Joe committed
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();

90
91
    virtual void fetchDisassembler(DisassemblerViewAgent *agent,
        const StackFrame &frame);
92
    virtual void fetchMemory(MemoryViewAgent *, quint64 addr, quint64 length);
Banana Joe's avatar
Banana Joe committed
93
94
95
96

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

    virtual void reloadRegisters();
100
    virtual void reloadSourceFiles();
101
    virtual void reloadFullStack() {}
102

103
104
105
public slots:
    void syncDebuggerPaths();

Banana Joe's avatar
Banana Joe committed
106
107
108
protected:
    void timerEvent(QTimerEvent*);

109
110
111
private slots:
    void slotConsoleStubStarted();
    void slotConsoleStubError(const QString &msg);
112
    void slotConsoleStubTerminated();    
113
    void warning(const QString &w);
114

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

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

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

} // namespace Internal
} // namespace Debugger

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