- enhancement: Refine suggestion info when try debug and the compiler settings are not correct.

- enhancement: Open the options dialog/project options dialog when user want to correct compiler settings for debug.
This commit is contained in:
Roy Qu 2023-04-02 22:53:02 +08:00
parent 08124282da
commit 799ce52460
6 changed files with 507 additions and 463 deletions

View File

@ -5,6 +5,8 @@ Red Panda C++ Version 2.20
- fix: File/Project visit histories are not correctly saved when clearing.
- change: Default max function frame size is 2MB under windows / 8MB others.
- fix: Octal numeric escape sequences is not correctly syntax highlighted.
- enhancement: Refine suggestion info when try debug and the compiler settings are not correct.
- enhancement: Open the options dialog/project options dialog when user want to correct compiler settings for debug.
Red Panda C++ Version 2.19

View File

@ -1625,6 +1625,20 @@ void MainWindow::changeOptions(const QString &widgetName, const QString &groupNa
}
void MainWindow::changeProjectOptions(const QString &widgetName, const QString &groupName)
{
if (!mProject)
return;
// int oldCompilerSet = mProject->options().compilerSet;
QString oldName = mProject->name();
PSettingsDialog dialog = SettingsDialog::projectOptionDialog();
if (!groupName.isEmpty()) {
dialog->setCurrentWidget(widgetName, groupName);
}
dialog->exec();
updateCompilerSet();
}
void MainWindow::updateCompilerSet()
{
updateCompilerSet(mEditorList->getEditor());
@ -2169,31 +2183,27 @@ void MainWindow::debug()
// Check if we enabled proper options
debugEnabled = mProject->getCompileOption(CC_CMD_OPT_DEBUG_INFO) == COMPILER_OPTION_ON;
stripEnabled = mProject->getCompileOption(LINK_CMD_OPT_STRIP_EXE) == COMPILER_OPTION_ON;
if (stripEnabled) {
QMessageBox::critical(this,
tr("Can't Debug"),
tr("Your compiler set's \"Strip executable (-s)\" options is turnned on")
+"<BR /><BR />"
+tr("The generated executable doesn't have symbol table, and can't be debugged.")
+"<BR /><BR />"
+tr("Please correct it, recompile and retry debug.")
);
return;
}
// Ask the user if he wants to enable debugging...
if (compilerSet->name().endsWith("Debug") && !debugEnabled) {
if (stripEnabled && !debugEnabled) {
if (QMessageBox::question(this,
tr("Correct compiler setting"),
tr("You are using a Debug compiler set with wrong compile/link settings: ")
+"<BR /><BR />"
+tr(" - \"Generate debug info (-g3)\" should be turned on")
+"<BR /><BR />"
+tr("Do you want to correct it now?")
) == QMessageBox::Yes) {
changeOptions(
SettingsDialog::tr("Compiler Set"),
SettingsDialog::tr("Compiler")
);
tr("Correct compile settings for debug"),
tr("The generated executable won't have debug symbol infos, and can't be debugged.")
+"<BR /><BR />"
+tr("If you are using the Release compiler set, please use choose the Debug version from toolbar.")
+"<BR /><BR />"
+tr("Or you can manually change the following settings in the options dialog's compiler set page:")
+"<BR />"
+tr(" - Turned on the \"Generate debug info (-g3)\" option.")
+"<BR />"
+tr(" - Turned off the \"Strip executable (-s)\" option.")
+"<BR />"
+tr(" - Turned off the \"Optimization level (-O)\" option or set it to \"Debug (-Og)\".")
+"<BR /><BR />"
+tr("Do you want to mannually change the compiler set settings now?")
)== QMessageBox::Yes) {
changeProjectOptions(
SettingsDialog::tr("Compiler Set"),
SettingsDialog::tr("Project")
);
}
return;
}
@ -2286,33 +2296,27 @@ void MainWindow::debug()
// Check if we enabled proper options
debugEnabled = compilerSet->getCompileOptionValue(CC_CMD_OPT_DEBUG_INFO) == COMPILER_OPTION_ON;
stripEnabled = compilerSet->getCompileOptionValue(LINK_CMD_OPT_STRIP_EXE) == COMPILER_OPTION_ON;
if (stripEnabled) {
QMessageBox::critical(this,
tr("Can't Debug"),
tr("Your compiler set's \"Strip executable (-s)\" options is turnned on")
if (stripEnabled && !debugEnabled) {
if (QMessageBox::question(this,
tr("Correct compile settings for debug"),
tr("The generated executable won't have debug symbol infos, and can't be debugged.")
+"<BR /><BR />"
+tr("The generated executable doesn't have symbol table, and can't be debugged.")
+tr("If you are using the Release compiler set, please use choose the Debug version from toolbar.")
+"<BR /><BR />"
+tr("Please correct it, recompile and retry debug.")
);
return;
}
// Ask the user if he wants to enable debugging...
if (compilerSet->name().endsWith("Debug") && !debugEnabled) {
if (QMessageBox::question(this,
tr("Enable debugging"),
tr("You are using a Debug compiler set with wrong compile/link settings: ")
+"<BR /><BR />"
+tr(" - \"Generate debug info (-g3)\" should be turned on")
+"<BR /><BR />"
+tr(" - \"Strip executable (-s)\" should be turned off")
+"<BR /><BR />"
+tr("Do you want to correct it now?")
) == QMessageBox::Yes) {
changeOptions(
SettingsDialog::tr("Compiler Set"),
SettingsDialog::tr("Compiler")
);
+tr("Or you can manually change the following settings in the options dialog's compiler set page:")
+"<BR />"
+tr(" - Turned on the \"Generate debug info (-g3)\" option.")
+"<BR />"
+tr(" - Turned off the \"Strip executable (-s)\" option.")
+"<BR />"
+tr(" - Turned off the \"Optimization level (-O)\" option or set it to \"Debug (-Og)\".")
+"<BR /><BR />"
+tr("Do you want to mannually change the compiler set settings now?")
)== QMessageBox::Yes) {
changeOptions(
SettingsDialog::tr("Compiler Set"),
SettingsDialog::tr("Compiler")
);
}
return;
}
@ -5031,12 +5035,35 @@ void MainWindow::enableDebugActions()
void MainWindow::stopDebugForNoSymbolTable()
{
mDebugger->stop();
QMessageBox::critical(this,
tr("Debug Failed"),
if (QMessageBox::question(this,
tr("Correct compile settings for debug"),
tr("The executable doesn't have symbol table, and can't be debugged.")
+"<BR /><BR />"
+tr("Please turn off your compiler set's \"Strip executable (-s)\" option, recompile and retry debug.")
);
+tr("If you are using the Release compiler set, please use choose the Debug version from toolbar.")
+"<BR /><BR />"
+tr("Or you can manually change the following settings in the options dialog's compiler set page:")
+"<BR />"
+tr(" - Turned on the \"Generate debug info (-g3)\" option.")
+"<BR />"
+tr(" - Turned off the \"Strip executable (-s)\" option.")
+"<BR />"
+tr(" - Turned off the \"Optimization level (-O)\" option or set it to \"Debug (-Og)\".")
+"<BR /><BR />"
+tr("Do you want to mannually change the compiler set settings now?")
)== QMessageBox::Yes) {
Editor * editor = mEditorList->getEditor();
if (editor && editor->inProject()) {
changeProjectOptions(
SettingsDialog::tr("Compiler Set"),
SettingsDialog::tr("Project")
);
} else {
changeOptions(
SettingsDialog::tr("Compiler Set"),
SettingsDialog::tr("Compiler")
);
}
}
}
void MainWindow::onTodoParsingFile(const QString& filename)

View File

@ -224,6 +224,7 @@ public:
Editor* openFile(const QString& filename, bool activate=true, QTabWidget* page=nullptr);
void openProject(const QString& filename, bool openFiles = true);
void changeOptions(const QString& widgetName=QString(), const QString& groupName=QString());
void changeProjectOptions(const QString& widgetName=QString(), const QString& groupName=QString());
bool openningFiles() const;

View File

@ -4241,7 +4241,7 @@
</message>
<message>
<source>Enable debugging</source>
<translation>Habilitar depuração</translation>
<translation type="vanished">Habilitar depuração</translation>
</message>
<message>
<source>You have not enabled debugging info (-g3) and/or stripped it from the executable (-s) in Compiler Options.&lt;BR /&gt;&lt;BR /&gt;Do you want to correct this now?</source>
@ -5079,54 +5079,10 @@
<source>GNU Assembler Manual</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Correct compiler setting</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>You are using a Debug compiler set with wrong compile/link settings: </source>
<translation type="unfinished"></translation>
</message>
<message>
<source> - &quot;Generate debug info (-g3)&quot; should be turned on</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> - &quot;Strip executable (-s)&quot; should be turned off</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you want to correct it now?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Can&apos;t Debug</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Your compiler set&apos;s &quot;Strip executable (-s)&quot; options is turnned on</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please correct it, recompile and retry debug.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The generated executable doesn&apos;t have symbol table, and can&apos;t be debugged.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Debug Failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The executable doesn&apos;t have symbol table, and can&apos;t be debugged.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please turn off your compiler set&apos;s &quot;Strip executable (-s)&quot; option, recompile and retry debug.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>x86 Assembly Language Reference Manual</source>
<translation type="unfinished"></translation>
@ -5203,6 +5159,38 @@
<source>Ctrl+K, Ctrl+S</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Correct compile settings for debug</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The generated executable won&apos;t have debug symbol infos, and can&apos;t be debugged.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Or you can manually change the following settings in the options dialog&apos;s compiler set page:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> - Turned on the &quot;Generate debug info (-g3)&quot; option.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> - Turned off the &quot;Strip executable (-s)&quot; option.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> - Turned off the &quot;Optimization level (-O)&quot; option or set it to &quot;Debug (-Og)&quot;.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>If you are using the Release compiler set, please use choose the Debug version from toolbar.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you want to mannually change the compiler set settings now?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MemoryModel</name>

File diff suppressed because it is too large Load Diff

View File

@ -4004,10 +4004,6 @@
<source>Can&apos;t start debugging.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Enable debugging</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Host applcation missing</source>
<translation type="unfinished"></translation>
@ -4808,54 +4804,10 @@
<source>GNU Assembler Manual</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Correct compiler setting</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>You are using a Debug compiler set with wrong compile/link settings: </source>
<translation type="unfinished"></translation>
</message>
<message>
<source> - &quot;Generate debug info (-g3)&quot; should be turned on</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> - &quot;Strip executable (-s)&quot; should be turned off</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you want to correct it now?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Can&apos;t Debug</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Your compiler set&apos;s &quot;Strip executable (-s)&quot; options is turnned on</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please correct it, recompile and retry debug.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The generated executable doesn&apos;t have symbol table, and can&apos;t be debugged.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Debug Failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The executable doesn&apos;t have symbol table, and can&apos;t be debugged.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Please turn off your compiler set&apos;s &quot;Strip executable (-s)&quot; option, recompile and retry debug.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>x86 Assembly Language Reference Manual</source>
<translation type="unfinished"></translation>
@ -4936,6 +4888,38 @@
<source>Ctrl+K, Ctrl+S</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Correct compile settings for debug</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The generated executable won&apos;t have debug symbol infos, and can&apos;t be debugged.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Or you can manually change the following settings in the options dialog&apos;s compiler set page:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> - Turned on the &quot;Generate debug info (-g3)&quot; option.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> - Turned off the &quot;Strip executable (-s)&quot; option.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source> - Turned off the &quot;Optimization level (-O)&quot; option or set it to &quot;Debug (-Og)&quot;.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>If you are using the Release compiler set, please use choose the Debug version from toolbar.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you want to mannually change the compiler set settings now?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MemoryModel</name>