2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2008-12-02 15:08:31 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2010-04-26 18:54:08 +02:00
|
|
|
#include "watchdata.h"
|
2016-11-03 13:28:28 +01:00
|
|
|
#include "debuggerengine.h"
|
2010-04-26 18:54:08 +02:00
|
|
|
|
2014-04-15 18:13:03 +02:00
|
|
|
#include <QVector>
|
2009-08-12 11:21:44 +02:00
|
|
|
|
2014-04-15 18:13:03 +02:00
|
|
|
namespace Debugger {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2015-02-12 11:31:02 +01:00
|
|
|
class DebuggerCommand;
|
2015-03-19 12:42:53 +01:00
|
|
|
class DebuggerEngine;
|
2014-11-07 13:50:09 +01:00
|
|
|
class WatchModel;
|
2014-05-17 21:00:22 +02:00
|
|
|
|
2018-07-23 22:28:49 +02:00
|
|
|
using DisplayFormats = QVector<DisplayFormat>;
|
2015-03-20 16:03:59 +01:00
|
|
|
|
2016-06-24 09:36:42 +02:00
|
|
|
class WatchModelBase : public Utils::TreeModel<WatchItem, WatchItem>
|
2014-11-07 13:50:09 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2018-07-23 22:28:49 +02:00
|
|
|
WatchModelBase() = default;
|
2014-11-07 13:50:09 +01:00
|
|
|
|
2019-04-09 08:23:24 +02:00
|
|
|
enum { NameColumn, TimeColumn, ValueColumn, TypeColumn };
|
|
|
|
|
|
2014-11-07 13:50:09 +01:00
|
|
|
signals:
|
|
|
|
|
void currentIndexRequested(const QModelIndex &idx);
|
|
|
|
|
void itemIsExpanded(const QModelIndex &idx);
|
2016-06-07 17:04:53 +02:00
|
|
|
void inameIsExpanded(const QString &iname);
|
2015-03-17 13:26:20 +01:00
|
|
|
void updateStarted();
|
2015-03-06 09:14:40 +01:00
|
|
|
void updateFinished();
|
2014-11-07 13:50:09 +01:00
|
|
|
};
|
|
|
|
|
|
2022-07-04 13:11:23 +02:00
|
|
|
class WatchHandler
|
2009-06-17 16:00:03 +02:00
|
|
|
{
|
2022-07-04 13:11:23 +02:00
|
|
|
Q_DISABLE_COPY_MOVE(WatchHandler)
|
2009-06-17 16:00:03 +02:00
|
|
|
|
|
|
|
|
public:
|
2010-06-16 11:08:54 +02:00
|
|
|
explicit WatchHandler(DebuggerEngine *engine);
|
2022-07-04 13:11:23 +02:00
|
|
|
~WatchHandler();
|
2012-05-18 02:28:41 +02:00
|
|
|
|
2014-11-07 13:50:09 +01:00
|
|
|
WatchModelBase *model() const;
|
2009-06-17 16:00:03 +02:00
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
void cleanup();
|
2016-12-13 09:46:51 +01:00
|
|
|
void grabWidget(QWidget *viewParent);
|
|
|
|
|
void watchExpression(const QString &exp, const QString &name = QString(),
|
|
|
|
|
bool temporary = false);
|
2016-06-07 17:04:53 +02:00
|
|
|
void updateWatchExpression(WatchItem *item, const QString &newExp);
|
2012-10-29 12:59:53 +01:00
|
|
|
void watchVariable(const QString &exp);
|
2010-02-04 16:23:51 +01:00
|
|
|
|
2015-03-19 12:42:53 +01:00
|
|
|
const WatchItem *watchItem(const QModelIndex &) const;
|
2016-06-07 17:04:53 +02:00
|
|
|
void fetchMore(const QString &iname) const;
|
|
|
|
|
WatchItem *findItem(const QString &iname) const;
|
2015-03-19 12:42:53 +01:00
|
|
|
const WatchItem *findCppLocalVariable(const QString &name) const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
void loadSessionDataForEngine();
|
|
|
|
|
|
2016-06-07 17:04:53 +02:00
|
|
|
bool isExpandedIName(const QString &iname) const;
|
|
|
|
|
QSet<QString> expandedINames() const;
|
2012-05-18 02:28:41 +02:00
|
|
|
|
2010-11-04 18:11:09 +01:00
|
|
|
static QStringList watchedExpressions();
|
2016-11-29 15:27:38 +01:00
|
|
|
static QMap<QString, int> watcherNames();
|
2010-04-27 08:53:18 +02:00
|
|
|
|
2019-07-24 13:43:54 +02:00
|
|
|
void appendFormatRequests(DebuggerCommand *cmd) const;
|
|
|
|
|
void appendWatchersAndTooltipRequests(DebuggerCommand *cmd) const;
|
2015-09-14 12:53:35 +02:00
|
|
|
|
2016-06-07 17:04:53 +02:00
|
|
|
QString typeFormatRequests() const;
|
|
|
|
|
QString individualFormatRequests() const;
|
2008-12-02 12:01:29 +01:00
|
|
|
|
2016-06-07 17:04:53 +02:00
|
|
|
int format(const QString &iname) const;
|
2015-03-20 16:03:59 +01:00
|
|
|
static QString nameForFormat(int format);
|
2009-06-18 10:34:53 +02:00
|
|
|
|
2015-01-23 19:09:08 +01:00
|
|
|
void addDumpers(const GdbMi &dumpers);
|
2016-06-07 17:04:53 +02:00
|
|
|
void addTypeFormats(const QString &type, const DisplayFormats &formats);
|
2010-06-25 09:07:14 +02:00
|
|
|
|
2016-06-07 17:04:53 +02:00
|
|
|
QString watcherName(const QString &exp);
|
2010-06-25 14:08:53 +02:00
|
|
|
|
2012-01-17 18:44:02 +01:00
|
|
|
void scheduleResetLocation();
|
|
|
|
|
|
2016-06-07 17:04:53 +02:00
|
|
|
void setCurrentItem(const QString &iname);
|
2017-10-26 16:32:48 +02:00
|
|
|
void updateLocalsWindow();
|
2012-05-18 02:28:41 +02:00
|
|
|
|
2016-04-05 13:27:24 +02:00
|
|
|
bool insertItem(WatchItem *item); // Takes ownership, returns whether item was added, not overwritten.
|
|
|
|
|
void insertItems(const GdbMi &data);
|
|
|
|
|
|
2016-06-07 17:04:53 +02:00
|
|
|
void removeItemByIName(const QString &iname);
|
2012-10-09 16:13:29 +02:00
|
|
|
void removeAllData(bool includeInspectData = false);
|
2012-09-21 16:46:06 +02:00
|
|
|
void resetValueCache();
|
2015-03-18 13:28:45 +01:00
|
|
|
void resetWatchers();
|
2015-07-06 09:46:08 +02:00
|
|
|
|
2016-11-03 13:28:28 +01:00
|
|
|
void notifyUpdateStarted(const UpdateParameters &updateParameters = UpdateParameters());
|
2015-03-17 13:26:20 +01:00
|
|
|
void notifyUpdateFinished();
|
2012-04-18 14:20:54 +02:00
|
|
|
|
2015-07-08 10:44:10 +02:00
|
|
|
void reexpandItems();
|
2016-04-05 13:27:24 +02:00
|
|
|
void recordTypeInfo(const GdbMi &typeInfo);
|
2015-07-08 10:44:10 +02:00
|
|
|
|
2021-01-18 16:30:38 +01:00
|
|
|
void setLocation(const Location &loc);
|
|
|
|
|
|
2008-12-02 12:01:29 +01:00
|
|
|
private:
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
DebuggerEngine * const m_engine; // Not owned
|
2013-02-11 12:25:12 +01:00
|
|
|
WatchModel *m_model; // Owned.
|
2008-12-02 12:01:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Debugger
|
|
|
|
|
|
2015-07-24 15:41:00 +03:00
|
|
|
Q_DECLARE_METATYPE(Debugger::Internal::DisplayFormat)
|