Skip to content

Commit

Permalink
Revert "feat: [debugger] add remote debugger"
Browse files Browse the repository at this point in the history
This reverts commit 46f37a1.
  • Loading branch information
deepin-mozart committed Apr 2, 2024
1 parent 6361a67 commit f258e8f
Show file tree
Hide file tree
Showing 17 changed files with 57 additions and 140 deletions.
10 changes: 0 additions & 10 deletions src/framework/event/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,6 @@ Event &Event::operator =(const Event &event)
return *this;
}

bool Event::operator==(const EventInterface &eventInterface) const
{
return topic() == eventInterface.topic && data() == eventInterface.name;
}

bool Event::operator==(const QString &interfaceName) const
{
return data() == interfaceName;
}

/**
* @brief Event::setTopic
* 设置事件的主题
Expand Down
25 changes: 4 additions & 21 deletions src/framework/event/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
DPF_BEGIN_NAMESPACE

class EventPrivate;
struct EventInterface;

/**
* @brief The Event class
Expand All @@ -32,6 +31,7 @@ class Event final
explicit Event(const QString &topic);
explicit Event(const Event& event);
~Event();
Event &operator =(const Event &);

void setTopic(const QString &topic);
QString topic() const;
Expand All @@ -41,10 +41,6 @@ class Event final

void setProperty(const QString& key, const QVariant value);
QVariant property(const QString &key) const;

Event &operator =(const Event &);
bool operator==(const EventInterface &eventInterface) const;
bool operator==(const QString &interfaceName) const;
};

QT_BEGIN_NAMESPACE
Expand All @@ -56,28 +52,15 @@ QT_END_NAMESPACE
struct EventInterface : std::function<void(const QVector<QVariant> &)>
{
QString name;
QString topic;
QVector<QString> pKeys;
typedef QVariant Arg;
typedef const QVariant cArg;
typedef QVector<QVariant> Args;
EventInterface() = delete;

EventInterface(const QString &name, const QString &topic, const QVector<QString> &keys,
EventInterface(const QString &name, const QVector<QString> &keys,
const std::function<void(const QVector<QVariant>&)> &func)
: std::function<void (const QVector<QVariant> &)> (func), name(name), topic(topic), pKeys(keys) {}

bool operator==(const EventInterface &eventInterface) const {
return topic == eventInterface.topic && name == eventInterface.name;
}

bool operator==(const QVariant &interfaceName) const {
return name == interfaceName;
}

bool operator==(const QString &interfaceName) const {
return name == interfaceName;
}
: std::function<void (const QVector<QVariant> &)> (func), name(name), pKeys(keys) {}

void operator()(const Args &as) const {
return std::function<void(const QVector<QVariant> &)>::operator()(as);
Expand Down Expand Up @@ -213,7 +196,7 @@ struct EventInterface : std::function<void(const QVector<QVariant> &)>
*/
#define OPI_ASKEEP(pKeys, pVals) if (pKeys.size() != pVals.size()) { qCritical() << "Key value pair length mismatch"; abort(); }
#define OPI_OBJECT(t, logics) inline const struct { const char* topic{#t} ; logics }t;
#define OPI_INTERFACE(d, ...) const dpf::EventInterface d { #d, topic, {__VA_ARGS__} , [=](const QVector<QVariant> &args) -> void {\
#define OPI_INTERFACE(d, ...) const dpf::EventInterface d { #d, {__VA_ARGS__} , [=](const QVector<QVariant> &args) -> void {\
OPI_ASKEEP(d.pKeys, args);\
dpf::Event event(topic); event.setData(#d);\
for ( int idx = 0; idx < d.pKeys.size(); idx ++) { event.setProperty(d.pKeys[idx], args[idx]); }\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ QStringList ActionAnalyseReceiver::topics()
void ActionAnalyseReceiver::eventProcess(const dpf::Event &event)
{
if (Configure::enabled()) {
if (event == actionanalyse.analyse) { // "workspace", "language", "storage"
if (event.data() == actionanalyse.analyse.name) { // "workspace", "language", "storage"
QString workspaceKey = actionanalyse.analyseDone.pKeys[0]; // workspace
QString languageKey = actionanalyse.analyseDone.pKeys[1]; // language
QString storageKey = actionanalyse.analyseDone.pKeys[2]; // storage
Expand All @@ -39,7 +39,7 @@ void ActionAnalyseReceiver::eventProcess(const dpf::Event &event)
QVariant var = event.property(dataKey);
AnalysedData analyData = var.value<AnalysedData>();
AnalyseKeeper::instance()->doAnalyse({workspace, language, storage});
} else if (event == symbol.parseDone) {
} else if (event.data() == symbol.parseDone.name) {
bool bSuccess = event.property("success").toBool();
if(bSuccess) {
QString workspace = event.property("workspace").toString();
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/builder/transceiver/builderreceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ QStringList BuilderReceiver::topics()

void BuilderReceiver::eventProcess(const dpf::Event &event)
{
if (event == project.activedProject) {
if (event.data() == project.activedProject.name) {
QVariant proInfoVar = event.property(project.activedProject.pKeys[0]);
dpfservice::ProjectInfo projectInfo = qvariant_cast<dpfservice::ProjectInfo>(proInfoVar);
BuildManager::instance()->setActivedProjectInfo(projectInfo.kitName(), projectInfo.workspaceFolder());
} else if (event == project.createdProject) {
} else if (event.data() == project.createdProject.name) {
QVariant proInfoVar = event.property(project.createdProject.pKeys[0]);
dpfservice::ProjectInfo projectInfo = qvariant_cast<dpfservice::ProjectInfo>(proInfoVar);
BuildManager::instance()->setActivedProjectInfo(projectInfo.kitName(), projectInfo.workspaceFolder());
} else if (event == project.deletedProject) {
} else if (event.data() == project.deletedProject.name) {
QVariant proInfoVar = event.property(project.deletedProject.pKeys[0]);
dpfservice::ProjectInfo projectInfo = qvariant_cast<dpfservice::ProjectInfo>(proInfoVar);
BuildManager::instance()->clearActivedProjectInfo();
} else if (event == symbol.parseDone) {
} else if (event.data() == symbol.parseDone.name) {
bool bSuccess = event.property("success").toBool();
if(!bSuccess) {
QString workspace = event.property("workspace").toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ QStringList CommandLineReceiver::topics()

void CommandLineReceiver::eventProcess(const dpf::Event &event)
{
if (event == commandLine.build) {
if (event.data() == commandLine.build.name) {
CommandExecuter::instance().buildProject();
}
}
6 changes: 3 additions & 3 deletions src/plugins/core/transceiver/corereceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ QStringList CoreReceiver::topics()

void CoreReceiver::eventProcess(const dpf::Event &event)
{
if(event == uiController.doSwitch) {
if(event.data() == uiController.doSwitch.name) {
QString actionTextKey = uiController.doSwitch.pKeys[0];
QString actionText = event.property(actionTextKey).toString();
QMetaObject::invokeMethod(this, [=](){
Controller::instance()->switchWidgetNavigation(actionText);
} , Qt::QueuedConnection);
} else if(event == uiController.switchContext) {
} else if(event.data() == uiController.switchContext.name) {
QString titleName = event.property(uiController.switchContext.pKeys[0]).toString();
QMetaObject::invokeMethod(this, [=](){
Controller::instance()->switchContextWidget(titleName);
} , Qt::QueuedConnection);
} else if(event == uiController.switchWorkspace) {
} else if(event.data() == uiController.switchWorkspace.name) {
QString titleName = event.property(uiController.switchWorkspace.pKeys[0]).toString();
Controller::instance()->switchWorkspace(titleName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ void ProjectCmakeReceiver::eventProcess(const dpf::Event &event)
builderEvent(event);
}

if (event == project.activedProject) {
if (event.data() == project.activedProject.name) {
QVariant proInfoVar = event.property(project.activedProject.pKeys[0]);
dpfservice::ProjectInfo projectInfo = qvariant_cast<dpfservice::ProjectInfo>(proInfoVar);
TargetsManager::instance()->readTargets(projectInfo.buildFolder(), projectInfo.workspaceFolder());
}

if (event == project.fileDeleted) {
if (event.data() == project.fileDeleted.name) {
QVariant varKit = event.property("kit");
QString kit = varKit.toString();

Expand Down
21 changes: 11 additions & 10 deletions src/plugins/debugger/dap/dapdebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,9 @@ void DAPDebugger::registerDapHandlers()
void DAPDebugger::handleEvents(const dpf::Event &event)
{
QString topic = event.topic();
QString data = event.data().toString();
if (topic == T_BUILDER) {
if (event == D_BUILD_STATE) {
if (data == D_BUILD_STATE) {
int state = event.property(P_STATE).toInt();
BuildCommandInfo commandInfo = qvariant_cast<BuildCommandInfo>(event.property(P_ORIGINCMD));
if (commandInfo.uuid == d->currentBuildUuid) {
Expand All @@ -557,7 +558,7 @@ void DAPDebugger::handleEvents(const dpf::Event &event)
}
}

if (event == debugger.prepareDebugDone) {
if (event.data() == debugger.prepareDebugDone.name) {
bool succeed = event.property(debugger.prepareDebugDone.pKeys[0]).toBool();
QString errorMsg = event.property(debugger.prepareDebugDone.pKeys[1]).toString();
if (!succeed) {
Expand All @@ -574,25 +575,25 @@ void DAPDebugger::handleEvents(const dpf::Event &event)
}
}
}
} else if (event == debugger.prepareDebugProgress) {
} else if (event.data() == debugger.prepareDebugProgress.name) {
printOutput(event.property(debugger.prepareDebugProgress.pKeys[0]).toString());
} else if (event == project.activedProject) {
} else if (event.data() == project.activedProject.name) {
getActiveProjectInfo() = qvariant_cast<ProjectInfo>(event.property(project.activedProject.pKeys[0]));
d->activeProjectKitName = getActiveProjectInfo().kitName();
updateRunState(kNoRun);
} else if (event == project.createdProject) {
} else if (event.data() == project.createdProject.name) {
getActiveProjectInfo() = qvariant_cast<ProjectInfo>(event.property(project.createdProject.pKeys[0]));
d->activeProjectKitName = getActiveProjectInfo().kitName();
updateRunState(kNoRun);
} else if (event.data() == project.deletedProject.name) {
d->activeProjectKitName.clear();
updateRunState(kNoRun);
} else if (event == editor.switchedFile) {
} else if (event.data() == editor.switchedFile.name) {
QString filePath = event.property(editor.switchedFile.pKeys[0]).toString();
if (d->currentOpenedFileName != filePath) {
d->currentOpenedFileName = filePath;
}
} else if (event == editor.fileOpened) {
} else if (event.data() == editor.fileOpened.name) {
QString filePath = event.property(editor.switchedFile.pKeys[0]).toString();
d->currentOpenedFileName = filePath;
if (d->bps.count(filePath)) {
Expand All @@ -601,17 +602,17 @@ void DAPDebugger::handleEvents(const dpf::Event &event)
editor.addBreakpoint(filePath, line);
}
}
} else if (event == editor.fileClosed) {
} else if (event.data() == editor.fileClosed.name) {
QString filePath = event.property(editor.switchedFile.pKeys[0]).toString();
if (d->currentOpenedFileName == filePath) {
d->currentOpenedFileName.clear();
}
} else if (event == editor.breakpointAdded) {
} else if (event.data() == editor.breakpointAdded.name) {
QString filePath = event.property(editor.breakpointAdded.pKeys[0]).toString();
int line = event.property(editor.breakpointAdded.pKeys[1]).toInt();
d->bps.insert(filePath, line);
addBreakpoint(filePath, line);
} else if (event == editor.breakpointRemoved) {
} else if (event.data() == editor.breakpointRemoved.name) {
QString filePath = event.property(editor.breakpointRemoved.pKeys[0]).toString();
int line = event.property(editor.breakpointRemoved.pKeys[1]).toInt();
d->bps.remove(filePath, line);
Expand Down
27 changes: 10 additions & 17 deletions src/plugins/debugger/debugmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
#include "debuggersignals.h"
#include "debuggerglobals.h"
#include "interface/menumanager.h"

#include "services/debugger/debuggerservice.h"
#include "services/language/languageservice.h"
#include "common/util/custompaths.h"
#include "common/project/projectinfo.h"
#include "remotedebug/remotedebugdlg.h"

using namespace DEBUG_NAMESPACE;
using namespace dpfservice;
Expand Down Expand Up @@ -152,15 +152,6 @@ void DebugManager::stepOut()
AsynInvoke(currentDebugger->stepOut());
}

void DebugManager::remoteDebug()
{
RemoteDebugDlg dlg;
if (dlg.exec() == DDialog::Accepted) {
auto paramters = dlg.getRemoteParameters();
// invoke debug interface.
}
}

void DebugManager::handleRunStateChanged(AbstractDebugger::RunState state)
{
menuManager->handleRunStateChanged(state);
Expand All @@ -174,21 +165,23 @@ void DebugManager::handleRunStateChanged(AbstractDebugger::RunState state)

void DebugManager::handleEvents(const dpf::Event &event)
{
if (event == debugger.prepareDebugProgress) {
QString topic = event.topic();
QString data = event.data().toString();
if (event.data() == debugger.prepareDebugProgress.name) {
// TODO(logan)
} else if (event == project.activedProject) {
} else if (event.data() == project.activedProject.name) {
auto projectInfo = qvariant_cast<ProjectInfo>(event.property(project.activedProject.pKeys[0]));
activeProjectKitName = projectInfo.kitName();
} else if (event == project.createdProject) {
} else if (event.data() == project.createdProject.name) {
auto projectInfo = qvariant_cast<ProjectInfo>(event.property(project.createdProject.pKeys[0]));
activeProjectKitName = projectInfo.kitName();
} else if (event == project.deletedProject) {
} else if (event.data() == project.deletedProject.name) {
activeProjectKitName.clear();
} else if (event == editor.switchedFile) {
} else if (event.data() == editor.switchedFile.name) {
// TODO(logan)
} else if (event == editor.fileOpened) {
} else if (event.data() == editor.fileOpened.name) {
// TODO(logan)
} else if (event == editor.fileClosed) {
} else if (event.data() == editor.fileClosed.name) {
// TODO(logan)
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/debugger/debugmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ public slots:
void stepIn();
void stepOut();

void remoteDebug();

void handleRunStateChanged(AbstractDebugger::RunState state);
void handleEvents(const dpf::Event &event);

Expand Down
1 change: 1 addition & 0 deletions src/plugins/debugger/interface/appoutputpane.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <QPlainTextEdit>

class OutputWindowPrivate;
class AppOutputPane : public OutputPane
{
Q_OBJECT
Expand Down
7 changes: 0 additions & 7 deletions src/plugins/debugger/interface/menumanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,6 @@ void MenuManager::initialize(WindowService *windowService)
"debugger_stepout");
windowService->addAction(MWM_DEBUG, actionImpl);
windowService->addTopToolItem(actionImpl, MWTG_DEBUG, false);

remoteDebug.reset(new QAction(MWMDA_REMOTE_DEBUG));
connect(remoteDebug.get(), &QAction::triggered, debugManager, &DebugManager::remoteDebug);
actionImpl = initAction(remoteDebug.get(), "Debug.RemoteDebug",
tr("Remote Debug"), {},
"");
windowService->addAction(MWM_DEBUG, actionImpl);
}

void MenuManager::handleRunStateChanged(AbstractDebugger::RunState state)
Expand Down
1 change: 0 additions & 1 deletion src/plugins/debugger/interface/menumanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public slots:
QSharedPointer<QAction> stepOver;
QSharedPointer<QAction> stepIn;
QSharedPointer<QAction> stepOut;
QSharedPointer<QAction> remoteDebug;
};

#endif // MENUMANAGER_H
Loading

0 comments on commit f258e8f

Please sign in to comment.