- enhancement: view memory when debugging
This commit is contained in:
parent
fbdba624be
commit
9b87d93b72
2
NEWS.md
2
NEWS.md
|
@ -10,9 +10,11 @@ Version 0.2.2
|
|||
- enhancement: redesign charset selection in the project options dialog's file widget
|
||||
- fix: can't correctly load last open files / project with non-asii characters in path
|
||||
- fix: can't coorectly load last open project
|
||||
- fix: can't coorectly show code completion for array elements
|
||||
- enhancement: show caret when show code/header completions
|
||||
- fix: correctly display pointer info in watch console
|
||||
- enhancement: search in project
|
||||
- enhancement: view memory when debugging
|
||||
|
||||
Version 0.2.1
|
||||
- fix: crash when load last opens
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -48,8 +48,7 @@ bool Debugger::start()
|
|||
connect(mReader, &QThread::finished,this,&Debugger::clearUpReader);
|
||||
connect(mReader, &DebugReader::parseFinished,this,&Debugger::syncFinishedParsing,Qt::BlockingQueuedConnection);
|
||||
connect(mReader, &DebugReader::changeDebugConsoleLastLine,this,&Debugger::onChangeDebugConsoleLastline);
|
||||
connect(mReader, &DebugReader::addLocalLine,this,&Debugger::onAddLocalLine);
|
||||
connect(mReader, &DebugReader::clearLocals,this,&Debugger::onClearLocals);
|
||||
connect(this, &Debugger::localsReady,pMainWindow,&MainWindow::onLocalsReady);
|
||||
connect(mReader, &DebugReader::cmdStarted,pMainWindow, &MainWindow::disableDebugActions);
|
||||
connect(mReader, &DebugReader::cmdFinished,pMainWindow, &MainWindow::enableDebugActions);
|
||||
|
||||
|
@ -102,16 +101,6 @@ void Debugger::clearUpReader()
|
|||
}
|
||||
}
|
||||
|
||||
void Debugger::onAddLocalLine(const QString &text)
|
||||
{
|
||||
pMainWindow->txtLocals()->appendPlainText(text);
|
||||
}
|
||||
|
||||
void Debugger::onClearLocals()
|
||||
{
|
||||
pMainWindow->txtLocals()->clear();
|
||||
}
|
||||
|
||||
RegisterModel *Debugger::registerModel() const
|
||||
{
|
||||
return mRegisterModel;
|
||||
|
@ -458,6 +447,18 @@ void Debugger::syncFinishedParsing()
|
|||
mReader->doevalready = false;
|
||||
}
|
||||
|
||||
if (mReader->doupdatememoryview) {
|
||||
emit memoryExamineReady(mReader->mMemoryValue);
|
||||
mReader->mMemoryValue.clear();
|
||||
mReader->doupdatememoryview=false;
|
||||
}
|
||||
|
||||
if (mReader->doupdatelocal) {
|
||||
emit localsReady(mReader->mLocalsValue);
|
||||
mReader->mLocalsValue.clear();
|
||||
mReader->doupdatelocal=false;
|
||||
}
|
||||
|
||||
// show command output
|
||||
if (pSettings->debugger().showCommandLog() ||
|
||||
(mReader->mCurrentCmd && mReader->mCurrentCmd->showInConsole)) {
|
||||
|
@ -648,6 +649,8 @@ AnnotationType DebugReader::getAnnotation(const QString &s)
|
|||
} else if ((mCurrentCmd) && (mCurrentCmd->command == "disas")) {
|
||||
// Another hack to catch assembler
|
||||
result = AnnotationType::TInfoAsm;
|
||||
} else if ((mCurrentCmd) && (mCurrentCmd->command.startsWith("x/"))) {
|
||||
result = AnnotationType::TMemory;
|
||||
}
|
||||
return result;
|
||||
} else if (s == "error-begin") {
|
||||
|
@ -980,7 +983,7 @@ void DebugReader::handleLocalOutput()
|
|||
line += s;
|
||||
// emit addLocalWithoutLinebreak(s);
|
||||
} else {
|
||||
emit addLocalLine(line);
|
||||
mLocalsValue.append(line);
|
||||
line = s;
|
||||
}
|
||||
nobreakLine=false;
|
||||
|
@ -992,18 +995,42 @@ void DebugReader::handleLocalOutput()
|
|||
break;
|
||||
}
|
||||
if (!line.isEmpty()) {
|
||||
emit addLocalLine(line);
|
||||
mLocalsValue.append(line);
|
||||
}
|
||||
}
|
||||
|
||||
void DebugReader::handleLocals()
|
||||
{
|
||||
emit clearLocals();
|
||||
mLocalsValue.clear();
|
||||
handleLocalOutput();
|
||||
}
|
||||
|
||||
void DebugReader::handleMemory()
|
||||
{
|
||||
doupdatememoryview = true;
|
||||
// name(spaces)hexvalue(tab)decimalvalue
|
||||
mMemoryValue.clear();
|
||||
QString s = getNextFilledLine();
|
||||
bool isAnnotation = false;
|
||||
while (true) {
|
||||
if (!s.startsWith("\032\032")) {
|
||||
s = s.trimmed();
|
||||
if (!s.isEmpty()) {
|
||||
mMemoryValue.append(s);
|
||||
}
|
||||
isAnnotation = false;
|
||||
} else {
|
||||
isAnnotation = true;
|
||||
}
|
||||
s = getNextLine();
|
||||
if (!isAnnotation && s.isEmpty())
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DebugReader::handleParams(){
|
||||
handleLocalOutput();
|
||||
doupdatelocal = true;
|
||||
}
|
||||
|
||||
void DebugReader::handleRegisters()
|
||||
|
@ -1129,6 +1156,8 @@ void DebugReader::processDebugOutput()
|
|||
dodisassemblerready = false;
|
||||
doregistersready = false;
|
||||
doevalready = false;
|
||||
doupdatememoryview = false;
|
||||
doupdatelocal = false;
|
||||
doprocessexited = false;
|
||||
doupdateexecution = false;
|
||||
doreceivedsignal = false;
|
||||
|
@ -1168,6 +1197,9 @@ void DebugReader::processDebugOutput()
|
|||
case AnnotationType::TParam:
|
||||
handleParams();
|
||||
break;
|
||||
case AnnotationType::TMemory:
|
||||
handleMemory();
|
||||
break;
|
||||
case AnnotationType::TErrorBegin:
|
||||
handleError();
|
||||
break;
|
||||
|
|
|
@ -36,7 +36,7 @@ enum class AnnotationType {
|
|||
TFieldBegin, TFieldEnd, TFieldValue, TFieldNameEnd,
|
||||
TInfoReg, TInfoAsm,
|
||||
TUnknown, TEOF,
|
||||
TLocal, TParam
|
||||
TLocal, TParam, TMemory
|
||||
};
|
||||
|
||||
struct DebugCommand{
|
||||
|
@ -238,6 +238,8 @@ public:
|
|||
|
||||
signals:
|
||||
void evalValueReady(const QString& s);
|
||||
void memoryExamineReady(const QStringList& s);
|
||||
void localsReady(const QStringList& s);
|
||||
public slots:
|
||||
void stop();
|
||||
|
||||
|
@ -252,8 +254,7 @@ private slots:
|
|||
void syncFinishedParsing();
|
||||
void onChangeDebugConsoleLastline(const QString& text);
|
||||
void clearUpReader();
|
||||
void onAddLocalLine(const QString& text);
|
||||
void onClearLocals();
|
||||
|
||||
private:
|
||||
bool mExecuting;
|
||||
bool mCommandChanged;
|
||||
|
@ -291,8 +292,6 @@ signals:
|
|||
void updateWatch();
|
||||
void processError(QProcess::ProcessError error);
|
||||
void changeDebugConsoleLastLine(const QString& text);
|
||||
void addLocalLine(const QString& text);
|
||||
void clearLocals();
|
||||
void cmdStarted();
|
||||
void cmdFinished();
|
||||
private:
|
||||
|
@ -312,6 +311,7 @@ private:
|
|||
void handleFrames();
|
||||
void handleLocalOutput();
|
||||
void handleLocals();
|
||||
void handleMemory();
|
||||
void handleParams();
|
||||
void handleRegisters();
|
||||
void handleSignal();
|
||||
|
@ -348,6 +348,8 @@ private:
|
|||
QString mBreakPointFile;
|
||||
QString mOutput;
|
||||
QString mEvalValue;
|
||||
QStringList mMemoryValue;
|
||||
QStringList mLocalsValue;
|
||||
QString mSignal;
|
||||
bool mUseUTF8;
|
||||
|
||||
|
@ -361,6 +363,8 @@ private:
|
|||
bool doupdateexecution;
|
||||
bool doreceivedsignal;
|
||||
bool doreceivedsfwarning;
|
||||
bool doupdatememoryview;
|
||||
bool doupdatelocal;
|
||||
|
||||
bool mStop;
|
||||
friend class Debugger;
|
||||
|
|
|
@ -120,6 +120,8 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
connect(ui->debugConsole,&QConsole::commandInput,this,&MainWindow::onDebugCommandInput);
|
||||
connect(ui->cbEvaluate->lineEdit(), &QLineEdit::returnPressed,
|
||||
this, &MainWindow::onDebugEvaluateInput);
|
||||
connect(ui->cbMemoryAddress->lineEdit(), &QLineEdit::returnPressed,
|
||||
this, &MainWindow::onDebugMemoryAddressInput);
|
||||
|
||||
mSearchResultTreeModel = std::make_shared<SearchResultTreeModel>(&mSearchResultModel);
|
||||
mSearchResultListModel = std::make_shared<SearchResultListModel>(&mSearchResultModel);
|
||||
|
@ -556,6 +558,7 @@ void MainWindow::updateDebugEval(const QString &value)
|
|||
{
|
||||
ui->txtEvalOutput->clear();
|
||||
ui->txtEvalOutput->appendPlainText(value);
|
||||
ui->txtEvalOutput->moveCursor(QTextCursor::Start);
|
||||
}
|
||||
|
||||
void MainWindow::rebuildOpenedFileHisotryMenu()
|
||||
|
@ -2124,6 +2127,7 @@ void MainWindow::disableDebugActions()
|
|||
ui->actionRun_To_Cursor->setEnabled(false);
|
||||
ui->actionContinue->setEnabled(false);
|
||||
ui->cbEvaluate->setEnabled(false);
|
||||
ui->cbMemoryAddress->setEnabled(false);
|
||||
}
|
||||
|
||||
void MainWindow::enableDebugActions()
|
||||
|
@ -2134,6 +2138,7 @@ void MainWindow::enableDebugActions()
|
|||
ui->actionRun_To_Cursor->setEnabled(true);
|
||||
ui->actionContinue->setEnabled(true);
|
||||
ui->cbEvaluate->setEnabled(true);
|
||||
ui->cbMemoryAddress->setEnabled(true);
|
||||
}
|
||||
|
||||
void MainWindow::prepareProjectForCompile()
|
||||
|
@ -3017,6 +3022,16 @@ void MainWindow::onDebugEvaluateInput()
|
|||
}
|
||||
}
|
||||
|
||||
void MainWindow::onDebugMemoryAddressInput()
|
||||
{
|
||||
QString s=ui->cbMemoryAddress->currentText().trimmed();
|
||||
if (!s.isEmpty()) {
|
||||
connect(mDebugger, &Debugger::memoryExamineReady,
|
||||
this, &MainWindow::onMemoryExamineReady);
|
||||
mDebugger->sendCommand("x/64bx",s,false);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::onParserProgress(const QString &fileName, int total, int current)
|
||||
{
|
||||
// Mention every 5% progress
|
||||
|
@ -3068,6 +3083,27 @@ void MainWindow::onEvalValueReady(const QString &value)
|
|||
this, &MainWindow::onEvalValueReady);
|
||||
}
|
||||
|
||||
void MainWindow::onMemoryExamineReady(const QStringList &value)
|
||||
{
|
||||
ui->txtMemoryView->clear();
|
||||
foreach (QString s, value) {
|
||||
s.replace("\t"," ");
|
||||
ui->txtMemoryView->appendPlainText(s);
|
||||
}
|
||||
ui->txtMemoryView->moveCursor(QTextCursor::Start);
|
||||
disconnect(mDebugger, &Debugger::memoryExamineReady,
|
||||
this, &MainWindow::onMemoryExamineReady);
|
||||
}
|
||||
|
||||
void MainWindow::onLocalsReady(const QStringList &value)
|
||||
{
|
||||
ui->txtLocals->clear();
|
||||
foreach (QString s, value) {
|
||||
ui->txtLocals->appendPlainText(s);
|
||||
}
|
||||
ui->txtLocals->moveCursor(QTextCursor::Start);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionFind_triggered()
|
||||
{
|
||||
Editor *e = mEditorList->getEditor();
|
||||
|
|
|
@ -88,7 +88,6 @@ public:
|
|||
void saveLastOpens();
|
||||
void loadLastOpens();
|
||||
|
||||
|
||||
QPlainTextEdit* txtLocals();
|
||||
|
||||
CPUDialog *cpuDialog() const;
|
||||
|
@ -125,10 +124,13 @@ public slots:
|
|||
void cleanUpCPUDialog();
|
||||
void onDebugCommandInput(const QString& command);
|
||||
void onDebugEvaluateInput();
|
||||
void onDebugMemoryAddressInput();
|
||||
void onParserProgress(const QString& fileName, int total, int current);
|
||||
void onStartParsing();
|
||||
void onEndParsing(int total, int updateView);
|
||||
void onEvalValueReady(const QString& value);
|
||||
void onMemoryExamineReady(const QStringList& value);
|
||||
void onLocalsReady(const QStringList& value);
|
||||
void onEditorContextMenu(const QPoint& pos);
|
||||
void onEditorTabContextMenu(const QPoint& pos);
|
||||
void disableDebugActions();
|
||||
|
|
|
@ -288,7 +288,7 @@
|
|||
<enum>QTabWidget::South</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabIssues">
|
||||
<attribute name="icon">
|
||||
|
@ -416,48 +416,27 @@
|
|||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
<number>11</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblEvaluate">
|
||||
<property name="text">
|
||||
<string>Evaluate:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cbEvaluate">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
|
@ -473,10 +452,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QPlainTextEdit" name="txtEvalOutput">
|
||||
<property name="undoRedoEnabled">
|
||||
<bool>false</bool>
|
||||
|
@ -493,7 +469,7 @@
|
|||
<enum>QTabWidget::North</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabDebugConsole">
|
||||
<attribute name="title">
|
||||
|
@ -623,6 +599,46 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabMemory">
|
||||
<attribute name="title">
|
||||
<string>Memory</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Address Expression:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cbMemoryAddress">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="insertPolicy">
|
||||
<enum>QComboBox::InsertAtTop</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QPlainTextEdit" name="txtMemoryView">
|
||||
<property name="lineWrapMode">
|
||||
<enum>QPlainTextEdit::NoWrap</enum>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -801,7 +817,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>946</width>
|
||||
<height>25</height>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include <QStringList>
|
||||
|
||||
#define DEVCPP_VERSION "0.2.2"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#define APP_SETTSINGS_FILENAME "redpandacpp.ini"
|
||||
#define GCC_PROGRAM "gcc.exe"
|
||||
|
@ -51,8 +53,6 @@
|
|||
#error "Only support windows and linux now!"
|
||||
#endif
|
||||
|
||||
#define DEVCPP_VERSION "0.2.0"
|
||||
|
||||
class SystemConsts
|
||||
{
|
||||
public:
|
||||
|
|
Loading…
Reference in New Issue