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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
/* This file is part of the KDE project
Copyright (C) 2002 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
Copyright (C) 2002 John Firebaugh <jfirebaugh@kde.org>
Copyright (C) 2007 Hamish Rodda <rodda@kde.org>
Copyright (C) 2009 Niko Sams <niko.sams@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef MIBREAKPOINTCONTROLLER_H
#define MIBREAKPOINTCONTROLLER_H
#include "dbgglobal.h"
#include <debugger/interfaces/ibreakpointcontroller.h>
#include <debugger/interfaces/idebugsession.h>
namespace KDevMI {
namespace MI {
struct AsyncRecord;
struct ResultRecord;
struct Value;
}
struct BreakpointData {
int debuggerId = -1;
KDevelop::BreakpointModel::ColumnFlags dirty;
KDevelop::BreakpointModel::ColumnFlags sent;
KDevelop::BreakpointModel::ColumnFlags errors;
bool pending = false;
BreakpointData()
{}
};
using BreakpointDataPtr = QSharedPointer<BreakpointData>;
class MIDebugSession;
/**
* Handles signals from the editor that relate to breakpoints and the execution
* point of the debugger.
* We may change, add or remove breakpoints in this class.
*/
class MIBreakpointController : public KDevelop::IBreakpointController
{
Q_OBJECT
public:
explicit MIBreakpointController(MIDebugSession* parent);
using IBreakpointController::breakpointModel;
/**
* Controls whether when duplicate breakpoints are received via async notification from GDB,
* one of the duplicates will be deleted.
*/
void setDeleteDuplicateBreakpoints(bool enable);
void breakpointAdded(int row) override;
void breakpointModelChanged(int row, KDevelop::BreakpointModel::ColumnFlags columns) override;
void breakpointAboutToBeDeleted(int row) override;
void debuggerStateChanged(KDevelop::IDebugSession::DebuggerState) override;
void notifyBreakpointCreated(const MI::AsyncRecord& r);
void notifyBreakpointModified(const MI::AsyncRecord& r);
void notifyBreakpointDeleted(const MI::AsyncRecord& r);
public Q_SLOTS:
void initSendBreakpoints();
private Q_SLOTS:
void programStopped(const MI::AsyncRecord &r);
private:
MIDebugSession* debugSession() const;
int breakpointRow(const BreakpointDataPtr& breakpoint);
void createBreakpoint(int row);
void sendUpdates(int row);
void recalculateState(int row);
void sendMaybe(KDevelop::Breakpoint *breakpoint) override;
void createFromDebugger(const MI::Value& miBkpt);
void updateFromDebugger(int row, const MI::Value& miBkpt,
KDevelop::BreakpointModel::ColumnFlags lockedColumns = {});
int rowFromDebuggerId(int gdbId) const;
struct Handler;
struct InsertedHandler;
struct UpdateHandler;
struct DeleteHandler;
struct IgnoreChanges;
QList<BreakpointDataPtr> m_breakpoints;
QList<BreakpointDataPtr> m_pendingDeleted;
int m_ignoreChanges = 0;
bool m_deleteDuplicateBreakpoints = false;
};
} // end of namespace KDevMI
#endif // MIBREAKPOINTCONTROLLER_H
|