Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

271 document adding a prettyprinter for qstring #272

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
* Fixed regression when setting/saving the editor font setting.
* Fixed bug when the Basic Struct visualizer display simple variable
types (non-structs).
* Source all files in ~/.config/seergdb/scripts/ on startup.

## [2.4] - 2024-03-18
* Changed main icon to a more license friendly one.
Expand Down
51 changes: 50 additions & 1 deletion src/SeerGdbWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
#include <QtCore/QSettings>
#include <QtCore/QProcess>
#include <QtCore/QRegularExpression>
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtCore/QFileInfoList>
#include <QtCore/QDebug>
#include <QtGlobal>
#include <unistd.h>
Expand Down Expand Up @@ -968,6 +971,8 @@ void SeerGdbWidget::handleGdbRunExecutable (const QString& breakMode) {
}else{
handleGdbCommand("-gdb-set non-stop off");
}

handleGdbSourceScripts();
}

// Set dprint parameters.
Expand Down Expand Up @@ -1103,6 +1108,8 @@ void SeerGdbWidget::handleGdbAttachExecutable () {
if (gdbAsyncMode()) {
handleGdbCommand("-gdb-set mi-async on"); // Turn on async mode so the 'interrupt' can happen.
}

handleGdbSourceScripts();
}

// Set dprint parameters.
Expand Down Expand Up @@ -1177,6 +1184,8 @@ void SeerGdbWidget::handleGdbConnectExecutable () {
QMessageBox::critical(this, tr("Error"), tr("Can't start gdb."));
break;
}

handleGdbSourceScripts();
}

// Set dprint parameters.
Expand Down Expand Up @@ -1389,6 +1398,8 @@ void SeerGdbWidget::handleGdbCoreFileExecutable () {
if (gdbAsyncMode()) {
handleGdbCommand("-gdb-set mi-async on"); // Turn on async mode so the 'interrupt' can happen.
}

handleGdbSourceScripts();
}

// Set dprint parameters.
Expand Down Expand Up @@ -3224,7 +3235,7 @@ bool SeerGdbWidget::startGdbRR () {

void SeerGdbWidget::killGdb () {

// Don't do anything, if already running.
// Don't do anything, if isn't running.
if (isGdbRuning() == false) {
return;
}
Expand Down Expand Up @@ -3531,6 +3542,44 @@ void SeerGdbWidget::handleGdbForkFollowMode (QString mode) {
}
}

void SeerGdbWidget::handleGdbSourceScripts () {

// Don't do anything, if isn't running.
if (isGdbRuning() == false) {
return;
}

// Get setting's config path.
QSettings settings;

QString configFile = settings.fileName();

if (configFile == "") {
return;
}

QFileInfo configFileInfo(configFile);

QString configDirectory = configFileInfo.absolutePath();

// Get a list of files in the "scripts" folder.
QString scriptsDirectory = configDirectory + "/scripts";

QDir dir(scriptsDirectory);
QStringList scripts = dir.entryList(QDir::Files, QDir::Name);

// Source each one.
qDebug() << "Sourcing scripts from:" << scriptsDirectory;
for (const QString& script : scripts) {
QString command = "source " + scriptsDirectory + "/" + script;

qDebug() << command;

handleGdbCommand(command);
}
qDebug() << "Done.";
}

QString SeerGdbWidget::assemblySymbolDemagling () const {

return _assemblySymbolDemangling;
Expand Down
1 change: 1 addition & 0 deletions src/SeerGdbWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ class SeerGdbWidget : public QWidget, protected Ui::SeerGdbWidgetForm {
void handleGdbSchedulerLockingMode (QString mode);
void handleGdbScheduleMultipleMode (QString mode);
void handleGdbForkFollowMode (QString mode);
void handleGdbSourceScripts ();

void handleGdbProcessFinished (int exitCode, QProcess::ExitStatus exitStatus);
void handleGdbProcessErrored (QProcess::ProcessError errorStatus);
Expand Down
9 changes: 6 additions & 3 deletions src/seergdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ int main (int argc, char* argv[]) {
QCommandLineOption gdbArgumentsOption(QStringList() << "gdb-arguments", "", "gdbarguments");
parser.addOption(gdbArgumentsOption);

QCommandLineOption xxdebugOption(QStringList() << "xxx");
parser.addOption(xxdebugOption);
QCommandLineOption xxxdebugOption(QStringList() << "xxx");
parser.addOption(xxxdebugOption);

QCommandLineOption helpOption(QStringList() << "h" << "help");
parser.addOption(helpOption);
Expand All @@ -134,12 +134,15 @@ int main (int argc, char* argv[]) {
seerhelp();
}

if (parser.isSet(xxdebugOption)) {
if (parser.isSet(xxxdebugOption)) {
QLoggingCategory::setFilterRules("*.debug=false\n"
"*.info=false\n"
"*.warning=false\n"
"*.critical=true\n"
"default.debug=true");

QSettings settings;
qDebug() << "SETTINGS" << settings.fileName();
}

// Get the positional arguments. (The ones at the end of the line - executable name and its arguments.
Expand Down
Loading