cdbdebugengine.h 4.74 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
namespace Debugger {
39
40
class DebuggerManager;

Banana Joe's avatar
Banana Joe committed
41
42
namespace Internal {

43
class DisassemblerViewAgent;
44
45
46
class CdbDebugEventCallback;
class CdbDebugOutput;
struct CdbDebugEnginePrivate;
47
struct CdbOptions;
Banana Joe's avatar
Banana Joe committed
48

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

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

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

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

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

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

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

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

104
105
106
public slots:
    void syncDebuggerPaths();

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

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

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

128
    CdbDebugEnginePrivate *m_d;
Banana Joe's avatar
Banana Joe committed
129

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

} // namespace Internal
} // namespace Debugger

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