summaryrefslogtreecommitdiff
path: root/src/plugins/debugger/cdb/cdbparsehelpers.h
blob: 74ffdd4881509d49d7b3f4afac3210aa08946a26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include <debugger/breakhandler.h>

#include <QPair>

QT_BEGIN_NAMESPACE
class QVariant;
class QDebug;
QT_END_NAMESPACE

namespace Debugger {
namespace Internal {
class BreakpointParameters;
struct ThreadData;
class Register;
class GdbMi;
class DisassemblerLines;

// Perform mapping on parts of the source tree as reported by/passed to debugger
// in case the user has specified such mappings in the global settings.
enum SourcePathMode { DebuggerToSource, SourceToDebugger };
QString cdbSourcePathMapping(QString fileName,
                             const QList<QPair<QString, QString> > &sourcePathMapping,
                             SourcePathMode mode);

// Ensure unique 'namespace' for breakpoints of the breakhandler.
enum { cdbBreakPointStartId = 100000,
       cdbBreakPointIdMinorPart = 100};

QString breakPointCdbId(const Breakpoint &bp);

// Convert breakpoint in CDB syntax (applying source path mappings using native paths).
QString cdbAddBreakpointCommand(const BreakpointParameters &d,
                                const QList<QPair<QString, QString> > &sourcePathMapping,
                                const QString &responseId = QString());
QString cdbClearBreakpointCommand(const Breakpoint &bp);

// Write memory (f ...).
QString cdbWriteMemoryCommand(quint64 addr, const QByteArray &data);

QString debugByteArray(const QByteArray &a);

DisassemblerLines parseCdbDisassembler(const QString &a);

// Model EXCEPTION_RECORD + firstchance
struct WinException
{
    WinException();
    void fromGdbMI(const GdbMi &);
    QString toString(bool includeLocation = false) const;

    friend  QDebug operator<<(QDebug s, const WinException &e);

    unsigned exceptionCode = 0;
    unsigned exceptionFlags = 0;
    quint64 exceptionAddress = 0;
    quint64 info1 = 0;
    quint64 info2 = 0;
    bool firstChance = false;
    QString file;
    int lineNumber = 0;
    QString function;
};

} // namespace Internal
} // namespace Debugger