cdbengine.h 4.3 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 CdbEnginePrivate;
44
struct CdbOptions;
Banana Joe's avatar
Banana Joe committed
45

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

Banana Joe's avatar
Banana Joe committed
51
public:
52
    ~CdbEngine();
Banana Joe's avatar
Banana Joe committed
53

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

58
    virtual void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos);
hjk's avatar
hjk committed
59 60 61
    virtual void setupEngine();
    virtual void setupInferior();
    virtual void runEngine();
hjk's avatar
hjk committed
62 63
    virtual void shutdownInferior();
    virtual void shutdownEngine();
Friedemann Kleint's avatar
Friedemann Kleint committed
64
    virtual void detachDebugger();
65
    virtual void updateWatchData(const WatchData &data);
66
    virtual unsigned debuggerCapabilities() const;
Banana Joe's avatar
Banana Joe committed
67

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

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

hjk's avatar
hjk committed
77 78 79
    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
80 81 82 83 84 85 86 87
    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();

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

    virtual void reloadModules();
    virtual void loadSymbols(const QString &moduleName);
    virtual void loadAllSymbols();
hjk's avatar
hjk committed
94
    virtual void requestModuleSymbols(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();

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

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

119
    CdbEnginePrivate *m_d;
Banana Joe's avatar
Banana Joe committed
120

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

} // namespace Internal
} // namespace Debugger

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