From b4b41e43a18fc9e3dfdf0b3fe0bc4f7b0e27f31b Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Fri, 17 Mar 2023 08:47:05 +0800 Subject: [PATCH] - enhancement: Add option in the debug settings, to limit the length of the ouput generated by gdb for arrays. --- NEWS.md | 7 +- RedPandaIDE/mainwindow.cpp | 2 +- RedPandaIDE/settings.cpp | 12 + RedPandaIDE/settings.h | 4 + .../settingsdialog/debuggeneralwidget.cpp | 3 + .../settingsdialog/debuggeneralwidget.ui | 364 +++++++++++------- 6 files changed, 240 insertions(+), 152 deletions(-) diff --git a/NEWS.md b/NEWS.md index afc51503..ff9e15f1 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,9 +8,9 @@ Red Panda C++ Version 2.18 - enhancement: Warn user and stop compile if project has missing files. - enhancement: Warn user when exit and save settings failed. - change: Remove compiler set options that's rarely used. - - enhancement: Options in compiler set settings, to generate syntax error for large stack objects. (Enable for Debug settings by default) - - enhancement: Options in compiler set settings, to generate protection code for stack smashing attack. (Enable for Debug settings by default) - - enhancement: Options in compiler set settings, to enable address sanitizer. Not available in windows.(Enable for Debug settings by default) + - enhancement: Add option in the compiler set settings, to generate syntax error for large stack objects. (Enable for Debug settings by default) + - enhancement: Add option in the compiler set settings, to generate protection code for stack smashing attack. (Enable for Debug settings by default) + - enhancement: Add option in the compiler set settings, to enable address sanitizer. Not available in windows.(Enable for Debug settings by default) - fix: The comboxbox to input search keyword in the search dialog is case insensitive. - fix: The comboxbox to input replace text in the search dialog is case insensitive. - fix: The comboxbox to input search keyword in the search in files dialog is case insensitive. @@ -20,6 +20,7 @@ Red Panda C++ Version 2.18 - fix: None initialized std::vector is not correctly displayed in the gdb of the gcc distributed with redpanda-c++ (Windows 64bit). - fix: Don't show completion info when input parameters for function definitions. - fix: Don't show function info tips when typing class variable definitions. + - enhancement: Add option in the debug settings, to limit the length of the ouput generated by gdb for arrays. Red Panda C++ Version 2.17 diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 1d2521db..24a7abcc 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -2395,7 +2395,7 @@ void MainWindow::debug() mDebugger->sendCommand("-gdb-set", "width 0"); // don't wrap output, very annoying mDebugger->sendCommand("-gdb-set", "confirm off"); mDebugger->sendCommand("-gdb-set", "print repeats 0"); // don't repeat elements - mDebugger->sendCommand("-gdb-set", "print elements 500"); // limit array elements to 500 + mDebugger->sendCommand("-gdb-set", QString("print elements %1").arg(pSettings->debugger().arrayElements())); // limit array elements to 500 mDebugger->sendCommand("-environment-cd", QString("\"%1\"").arg(extractFileDir(filePath))); // restore working directory if (pSettings->debugger().useGDBServer()) { mDebugger->sendCommand("-target-select",QString("remote localhost:%1").arg(pSettings->debugger().GDBServerPort())); diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index eeb8d966..1e40373c 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -4020,6 +4020,16 @@ void Settings::Debugger::setAutosave(bool newAutosave) mAutosave = newAutosave; } +int Settings::Debugger::arrayElements() const +{ + return mArrayElements; +} + +void Settings::Debugger::setArrayElements(int newArrayElements) +{ + mArrayElements = newArrayElements; +} + bool Settings::Debugger::useIntelStyle() const { return mUseIntelStyle; @@ -4068,6 +4078,7 @@ void Settings::Debugger::doSave() saveValue("gdb_server_port",mGDBServerPort); saveValue("memory_view_rows",mMemoryViewRows); saveValue("memory_view_columns",mMemoryViewColumns); + saveValue("array_elements",mArrayElements); } void Settings::Debugger::doLoad() @@ -4096,6 +4107,7 @@ void Settings::Debugger::doLoad() mGDBServerPort = intValue("gdb_server_port",41234); mMemoryViewRows = intValue("memory_view_rows",16); mMemoryViewColumns = intValue("memory_view_columns",16); + mArrayElements = intValue("array_elements",300); } Settings::CodeCompletion::CodeCompletion(Settings *settings):_Base(settings, SETTING_CODE_COMPLETION) diff --git a/RedPandaIDE/settings.h b/RedPandaIDE/settings.h index f4f4a41a..e98bf593 100644 --- a/RedPandaIDE/settings.h +++ b/RedPandaIDE/settings.h @@ -1281,6 +1281,9 @@ public: bool autosave() const; void setAutosave(bool newAutosave); + int arrayElements() const; + void setArrayElements(int newArrayElements); + private: bool mEnableDebugConsole; bool mShowDetailLog; @@ -1298,6 +1301,7 @@ public: int mGDBServerPort; int mMemoryViewRows; int mMemoryViewColumns; + int mArrayElements; // _Base interface protected: diff --git a/RedPandaIDE/settingsdialog/debuggeneralwidget.cpp b/RedPandaIDE/settingsdialog/debuggeneralwidget.cpp index 6f91da9f..c0847dfe 100644 --- a/RedPandaIDE/settingsdialog/debuggeneralwidget.cpp +++ b/RedPandaIDE/settingsdialog/debuggeneralwidget.cpp @@ -56,6 +56,7 @@ void DebugGeneralWidget::doLoad() ui->spinGDBServerPort->setValue(pSettings->debugger().GDBServerPort()); ui->spinMemoryViewRows->setValue(pSettings->debugger().memoryViewRows()); ui->spinMemoryViewColumns->setValue(pSettings->debugger().memoryViewColumns()); + ui->spinArrayElements->setValue(pSettings->debugger().arrayElements()); } void DebugGeneralWidget::doSave() @@ -78,6 +79,8 @@ void DebugGeneralWidget::doSave() pSettings->debugger().setGDBServerPort(ui->spinGDBServerPort->value()); pSettings->debugger().setMemoryViewRows(ui->spinMemoryViewRows->value()); pSettings->debugger().setMemoryViewColumns(ui->spinMemoryViewColumns->value()); + pSettings->debugger().setArrayElements(ui->spinArrayElements->value()); + pSettings->debugger().save(); pMainWindow->updateDebuggerSettings(); } diff --git a/RedPandaIDE/settingsdialog/debuggeneralwidget.ui b/RedPandaIDE/settingsdialog/debuggeneralwidget.ui index f298c2f9..fa54aaec 100644 --- a/RedPandaIDE/settingsdialog/debuggeneralwidget.ui +++ b/RedPandaIDE/settingsdialog/debuggeneralwidget.ui @@ -14,6 +14,58 @@ Form + + + + Autosave watches + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Max number of array elements displayed + + + + + + + 99999999 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + @@ -23,6 +75,18 @@ true + + 7 + + + 7 + + + 7 + + + 7 + @@ -57,24 +121,58 @@ - - - Skip system header and library files when step into - - - - - - - Skip project header and library files when step into - - - - - - - Skip custom header and library files when step into + + + Skip header files when step into + + + 7 + + + 7 + + + 7 + + + 7 + + + + + System library + + + + + + + Project library + + + + + + + Custom library + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + @@ -87,16 +185,16 @@ - 11 + 7 - 11 + 7 - 11 + 7 - 11 + 7 @@ -169,7 +267,11 @@ - + + + 999 + + @@ -202,128 +304,69 @@ Memory View - + 7 7 + + 7 + + + 7 + - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Memory View Rows - - - - - - - 1 - - - 999 - - - 8 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Memory View Columns - - - - - - - 1 - - - 8 - - - - - - - Qt::Horizontal - - - - 437 - 20 - - - - - - - - - - - - - - Autosave - - - - + - Autosave breakpoints and watches + Rows + + + + 1 + + + 999 + + + 8 + + + + + + + Columns + + + + + + + 1 + + + 8 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -333,6 +376,18 @@ CPU Window + + 7 + + + 7 + + + 7 + + + 7 + @@ -340,6 +395,13 @@ + + + + Show disassembly code in blend mode + + + @@ -373,7 +435,7 @@ 0 - + 0 @@ -386,6 +448,16 @@ 0 + + + + AT&&T + + + grpCPUDisassembly + + + @@ -397,14 +469,17 @@ - - - AT&&T + + + Qt::Horizontal - - grpCPUDisassembly - - + + + 40 + 20 + + + @@ -412,13 +487,6 @@ - - - - Show disassembly code in blend mode - - -