From b83c45782b8bbfac5fa0c865ba2c32f10a8de0f6 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sun, 10 Mar 2024 12:57:50 +0800 Subject: [PATCH] work save --- RedPandaIDE/debugger/debugger.cpp | 12 ++++++++++++ RedPandaIDE/debugger/debugger.h | 6 ++++-- RedPandaIDE/debugger/gdbmidebugger.cpp | 6 ++++++ RedPandaIDE/mainwindow.cpp | 4 ++-- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/RedPandaIDE/debugger/debugger.cpp b/RedPandaIDE/debugger/debugger.cpp index 2b69a54c..a8fe4e2a 100644 --- a/RedPandaIDE/debugger/debugger.cpp +++ b/RedPandaIDE/debugger/debugger.cpp @@ -692,6 +692,12 @@ void Debugger::evalExpression(const QString &expression) mClient->evalExpression(expression); } +void Debugger::selectFrame(PTrace trace) +{ + if (mClient) + mClient->selectFrame(trace); +} + void Debugger::refreshFrame() { if (mClient) { @@ -699,6 +705,12 @@ void Debugger::refreshFrame() } } +void Debugger::refreshStackVariables() +{ + if (mClient) + mClient->refreshStackVariables(); +} + void Debugger::refreshRegisters() { if (mClient) diff --git a/RedPandaIDE/debugger/debugger.h b/RedPandaIDE/debugger/debugger.h index 1a9a9995..863d5de8 100644 --- a/RedPandaIDE/debugger/debugger.h +++ b/RedPandaIDE/debugger/debugger.h @@ -349,11 +349,13 @@ public: void sendAllWatchVarsToDebugger(); PWatchVar findWatchVar(const QString& expression); PWatchVar watchVarAt(const QModelIndex& index); - void refreshVars(); + void refreshWatchVars(); void readMemory(const QString& startAddress, int rows, int cols); void evalExpression(const QString& expression); + void selectFrame(PTrace trace); void refreshFrame(); + void refreshStackVariables(); void refreshRegisters(); void disassembleCurrentFrame(bool blendMode); void setDisassemblyLanguage(bool isIntel); @@ -412,7 +414,6 @@ private slots: void cleanUpReader(); void updateRegisterNames(const QStringList& registerNames); void updateRegisterValues(const QHash& values); - void refreshWatchVars(); void fetchVarChildren(const QString& varName); private: bool mExecuting; @@ -535,6 +536,7 @@ public: virtual void evalExpression(const QString& expression) = 0; + virtual void selectFrame(PTrace trace) = 0; virtual void refreshFrame() = 0; virtual void refreshRegisters() = 0; virtual void disassembleCurrentFrame(bool blendMode) = 0; diff --git a/RedPandaIDE/debugger/gdbmidebugger.cpp b/RedPandaIDE/debugger/gdbmidebugger.cpp index 7de60a97..13cff836 100644 --- a/RedPandaIDE/debugger/gdbmidebugger.cpp +++ b/RedPandaIDE/debugger/gdbmidebugger.cpp @@ -1025,6 +1025,12 @@ void GDBMIDebuggerClient::evalExpression(const QString &expression) postCommand("-data-evaluate-expression", expression); } +void GDBMIDebuggerClient::selectFrame(PTrace trace) +{ + if (trace) + postCommand("-stack-select-frame", QString("%1").arg(trace->level)); +} + void GDBMIDebuggerClient::refreshFrame() { postCommand("-stack-info-frame", ""); diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index ffd43363..8e10719a 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -8771,8 +8771,8 @@ void MainWindow::switchCurrentStackTrace(int idx) e->setCaretPositionAndActivate(trace->line,1); } mDebugger->sendCommand("-stack-select-frame", QString("%1").arg(trace->level)); - mDebugger->sendCommand("-stack-list-variables", "--all-values"); - mDebugger->sendCommand("-var-update", "--all-values *"); + mDebugger->refreshStackVariables(); + mDebugger->refreshWatchVars(); if (this->mCPUDialog) { this->mCPUDialog->updateInfo(); }