cdbdebugengine.h 4.29 KB
Newer Older
1
/**************************************************************************
2
3
4
**
** This file is part of Qt Creator
**
hjk's avatar
hjk committed
5
** Copyright (c) 2010 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 "debuggerengine.h"
hjk's avatar
hjk committed
34

35
36
#include <QtCore/QSharedPointer>

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

40
class DisassemblerViewAgent;
41
42
class CdbDebugEventCallback;
class CdbDebugOutput;
43
class CdbDebugEnginePrivate;
44
struct CdbOptions;
Banana Joe's avatar
Banana Joe committed
45

46
class CdbDebugEngine : public DebuggerEngine
Banana Joe's avatar
Banana Joe committed
47
{
Friedemann Kleint's avatar
Friedemann Kleint committed
48
    Q_DISABLE_COPY(CdbDebugEngine)
Banana Joe's avatar
Banana Joe committed
49
    Q_OBJECT
50
    explicit CdbDebugEngine(const DebuggerStartParameters &sp);
Friedemann Kleint's avatar
Friedemann Kleint committed
51

Banana Joe's avatar
Banana Joe committed
52
public:
hjk's avatar
hjk committed
53
    ~CdbDebugEngine();
Banana Joe's avatar
Banana Joe committed
54

Friedemann Kleint's avatar
Friedemann Kleint committed
55
    // Factory function that returns 0 if the debug engine library cannot be found.
56
    static DebuggerEngine *create(const DebuggerStartParameters &sp,
57
                                   QString *errorMessage);
Friedemann Kleint's avatar
Friedemann Kleint committed
58

Banana Joe's avatar
Banana Joe committed
59
    virtual void shutdown();
60
    virtual void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos);
61
    virtual void startEngine();
Banana Joe's avatar
Banana Joe committed
62
    virtual void exitDebugger();
Friedemann Kleint's avatar
Friedemann Kleint committed
63
    virtual void detachDebugger();
64
    virtual void updateWatchData(const WatchData &data);
65
    virtual unsigned debuggerCapabilities() const;
Banana Joe's avatar
Banana Joe committed
66

hjk's avatar
hjk committed
67
68
69
70
71
    virtual void executeStep();
    virtual void executeStepOut();
    virtual void executeNext();
    virtual void executeStepI();
    virtual void executeNextI();
72
73

    virtual void continueInferior();
Banana Joe's avatar
Banana Joe committed
74
75
    virtual void interruptInferior();

hjk's avatar
hjk committed
76
77
78
    virtual void executeRunToLine(const QString &fileName, int lineNumber);
    virtual void executeRunToFunction(const QString &functionName);
    virtual void executeJumpToLine(const QString &fileName, int lineNumber);
Banana Joe's avatar
Banana Joe committed
79
80
81
82
83
84
85
86
    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();

87
    virtual void fetchDisassembler(DisassemblerViewAgent *agent);
88
    virtual void fetchMemory(MemoryViewAgent *, QObject *, quint64 addr, quint64 length);
Banana Joe's avatar
Banana Joe committed
89
90
91
92

    virtual void reloadModules();
    virtual void loadSymbols(const QString &moduleName);
    virtual void loadAllSymbols();
hjk's avatar
hjk committed
93
    virtual void requestModuleSymbols(const QString &moduleName);
Banana Joe's avatar
Banana Joe committed
94
95

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

99
100
101
public slots:
    void syncDebuggerPaths();

102
103
private slots:
    void slotConsoleStubStarted();
104
    void slotConsoleStubMessage(const QString &msg, bool);
105
    void slotConsoleStubTerminated();
106
    void slotBreakAttachToCrashed();
107
    void warning(const QString &w);
108

Banana Joe's avatar
Banana Joe committed
109
private:
110
    void startupChecks();
111
    void setState(DebuggerState state, const char *func, int line);
112
    inline bool startAttachDebugger(qint64 pid, DebuggerStartMode sm, QString *errorMessage);
113
    void processTerminated(unsigned long exitCode);
114
    void evaluateWatcher(WatchData *wd);
115
    QString editorToolTip(const QString &exp, const QString &function);
116
    bool step(unsigned long executionStatus);
Banana Joe's avatar
Banana Joe committed
117

118
    CdbDebugEnginePrivate *m_d;
Banana Joe's avatar
Banana Joe committed
119

120
    friend class CdbDebugEnginePrivate;
hjk's avatar
hjk committed
121
122
    friend class CdbDebugEventCallback;
    friend class CdbDebugOutput;
Banana Joe's avatar
Banana Joe committed
123
124
125
126
127
};

} // namespace Internal
} // namespace Debugger

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