From 63f3afb226fae2efadf152c6fb32a8d06dbc416a Mon Sep 17 00:00:00 2001 From: Ernie Pasveer Date: Tue, 13 Sep 2022 07:46:31 -0500 Subject: [PATCH] Tweaks to selecting thread id from thread frames view. --- src/SeerGdbWidget.cpp | 1 + src/SeerThreadFramesBrowserWidget.cpp | 3 +++ src/SeerThreadFramesBrowserWidget.h | 1 + tests/helloinferior/.gitignore | 1 + tests/helloinferior/Makefile | 12 ++++++++++++ tests/helloinferior/helloinferior.c | 7 +++++++ 6 files changed, 25 insertions(+) create mode 100644 tests/helloinferior/.gitignore create mode 100644 tests/helloinferior/Makefile create mode 100644 tests/helloinferior/helloinferior.c diff --git a/src/SeerGdbWidget.cpp b/src/SeerGdbWidget.cpp index 2e9d135..a085a4d 100644 --- a/src/SeerGdbWidget.cpp +++ b/src/SeerGdbWidget.cpp @@ -200,6 +200,7 @@ SeerGdbWidget::SeerGdbWidget (QWidget* parent) : QWidget(parent) { QObject::connect(threadManagerWidget->threadIdsBrowserWidget(), &SeerThreadIdsBrowserWidget::selectedThread, this, &SeerGdbWidget::handleGdbThreadSelectId); QObject::connect(threadManagerWidget->threadFramesBrowserWidget(), &SeerThreadFramesBrowserWidget::refreshThreadFrames, this, &SeerGdbWidget::handleGdbThreadListFrames); QObject::connect(threadManagerWidget->threadFramesBrowserWidget(), &SeerThreadFramesBrowserWidget::selectedFile, editorManagerWidget, &SeerEditorManagerWidget::handleOpenFile); + QObject::connect(threadManagerWidget->threadFramesBrowserWidget(), &SeerThreadFramesBrowserWidget::selectedThread, this, &SeerGdbWidget::handleGdbThreadSelectId); QObject::connect(_breakpointsBrowserWidget, &SeerBreakpointsBrowserWidget::refreshBreakpointsList, this, &SeerGdbWidget::handleGdbGenericpointList); QObject::connect(_breakpointsBrowserWidget, &SeerBreakpointsBrowserWidget::deleteBreakpoints, this, &SeerGdbWidget::handleGdbBreakpointDelete); diff --git a/src/SeerThreadFramesBrowserWidget.cpp b/src/SeerThreadFramesBrowserWidget.cpp index 802f885..21e6275 100644 --- a/src/SeerThreadFramesBrowserWidget.cpp +++ b/src/SeerThreadFramesBrowserWidget.cpp @@ -140,11 +140,13 @@ void SeerThreadFramesBrowserWidget::handleText (const QString& text) { item->setText(12, core_text); // Enable/disable interaction with this row depending if there is a valid file and line number. + /* XXX if (file_text != "" && fullname_text != "" && line_text != "") { item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled); }else{ item->setFlags(Qt::NoItemFlags); } + */ // Add the frame to the tree. threadTreeWidget->addTopLevelItem(item); @@ -206,6 +208,7 @@ void SeerThreadFramesBrowserWidget::handleItemDoubleClicked (QTreeWidgetItem* it //qDebug() << "Emit selectedFile and selectedFrame"; emit selectedFile(item->text(4), item->text(6), lineno); + emit selectedThread(item->text(0).toInt()); // Comment out this signal. The frame number is always 0 from gdb. Why? //emit selectedFrame(item->text(3).toInt()); diff --git a/src/SeerThreadFramesBrowserWidget.h b/src/SeerThreadFramesBrowserWidget.h index a6d14ca..e379b69 100644 --- a/src/SeerThreadFramesBrowserWidget.h +++ b/src/SeerThreadFramesBrowserWidget.h @@ -25,6 +25,7 @@ class SeerThreadFramesBrowserWidget : public QWidget, protected Ui::SeerThreadFr void refreshThreadFrames (); void selectedFile (QString file, QString fullname, int lineno); void selectedFrame (int frameno); + void selectedThread (int threadid); protected: void showEvent (QShowEvent* event); diff --git a/tests/helloinferior/.gitignore b/tests/helloinferior/.gitignore new file mode 100644 index 0000000..625aadd --- /dev/null +++ b/tests/helloinferior/.gitignore @@ -0,0 +1 @@ +helloinferior diff --git a/tests/helloinferior/Makefile b/tests/helloinferior/Makefile new file mode 100644 index 0000000..46764b5 --- /dev/null +++ b/tests/helloinferior/Makefile @@ -0,0 +1,12 @@ +# This is the default target, which will be built when +# you invoke make +.PHONY: all +all: helloinferior + +helloinferior: helloinferior.c + g++ -g -o helloinferior helloinferior.c + +.PHONY: clean +clean: + rm -f helloinferior helloinferior.o + diff --git a/tests/helloinferior/helloinferior.c b/tests/helloinferior/helloinferior.c new file mode 100644 index 0000000..7245409 --- /dev/null +++ b/tests/helloinferior/helloinferior.c @@ -0,0 +1,7 @@ +#include +#include + +int main () { + pid_t pid = fork(); + printf("Hello!\n"); +}