From 6ea8d635659b19d448cd33c8ac825c3fc7fe00cb Mon Sep 17 00:00:00 2001 From: Ernie Pasveer Date: Sun, 18 Sep 2022 20:46:48 -0500 Subject: [PATCH] First attempt. --- src/CMakeLists.txt | 2 + src/QHContainerWidget.cpp | 24 +++++++++ src/QHContainerWidget.h | 19 +++++++ src/QHContainerWidget.ui | 24 +++++++++ src/SeerThreadManagerWidget.cpp | 34 ++++++++++++- src/SeerThreadManagerWidget.h | 1 + src/resource.qrc | 2 + src/resources/RelaxLightIcons/help-about.svg | 12 +++++ .../help/ThreadProcessInfoBrowser.md | 49 +++++++++---------- 9 files changed, 140 insertions(+), 27 deletions(-) create mode 100644 src/QHContainerWidget.cpp create mode 100644 src/QHContainerWidget.h create mode 100644 src/QHContainerWidget.ui create mode 100644 src/resources/RelaxLightIcons/help-about.svg diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 241d077..8b84107 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -100,6 +100,7 @@ set(HEADER_FILES QStringPair.h QHistoryLineEdit.h QEditDelegate.h + QHContainerWidget.h ) set(SOURCE_FILES @@ -182,6 +183,7 @@ set(SOURCE_FILES QIndexTreeWidget.cpp QHistoryLineEdit.cpp QEditDelegate.cpp + QHContainerWidget.cpp ) qt5_add_resources(SOURCE_FILES resource.qrc) diff --git a/src/QHContainerWidget.cpp b/src/QHContainerWidget.cpp new file mode 100644 index 0000000..0148a6c --- /dev/null +++ b/src/QHContainerWidget.cpp @@ -0,0 +1,24 @@ +#include "QHContainerWidget.h" + +QHContainerWidget::QHContainerWidget (QWidget* parent) : QWidget(parent) { + + // Construct the UI. + setupUi(this); + + // Setup the widgets + // Connect things. +} + +QHContainerWidget::~QHContainerWidget () { +} + +void QHContainerWidget::addWidget (QWidget* widget) { + + horizontalLayout->addWidget(widget); +} + +void QHContainerWidget::removeWidget (QWidget* widget) { + + horizontalLayout->removeWidget(widget); +} + diff --git a/src/QHContainerWidget.h b/src/QHContainerWidget.h new file mode 100644 index 0000000..dcbd99a --- /dev/null +++ b/src/QHContainerWidget.h @@ -0,0 +1,19 @@ +#pragma once + +#include +#include "ui_QHContainerWidget.h" + +class QHContainerWidget : public QWidget, protected Ui::QHContainerWidgetForm { + + Q_OBJECT + + public: + explicit QHContainerWidget (QWidget* parent = 0); + ~QHContainerWidget (); + + void addWidget (QWidget* widget); + void removeWidget (QWidget* widget); + + private: +}; + diff --git a/src/QHContainerWidget.ui b/src/QHContainerWidget.ui new file mode 100644 index 0000000..e6791f1 --- /dev/null +++ b/src/QHContainerWidget.ui @@ -0,0 +1,24 @@ + + + QHContainerWidgetForm + + + + 0 + 0 + 0 + 0 + + + + QHContainerWidgetForm + + + + + + + + + + diff --git a/src/SeerThreadManagerWidget.cpp b/src/SeerThreadManagerWidget.cpp index 7eed4bf..ebec045 100644 --- a/src/SeerThreadManagerWidget.cpp +++ b/src/SeerThreadManagerWidget.cpp @@ -1,6 +1,10 @@ #include "SeerThreadManagerWidget.h" +#include "QHContainerWidget.h" #include +#include #include +#include +#include #include SeerThreadManagerWidget::SeerThreadManagerWidget (QWidget* parent) : QWidget(parent) { @@ -25,10 +29,20 @@ SeerThreadManagerWidget::SeerThreadManagerWidget (QWidget* parent) : QWidget(par QToolButton* refreshToolButton = new QToolButton(tabWidget); refreshToolButton->setIcon(QIcon(":/seer/resources/RelaxLightIcons/view-refresh.svg")); refreshToolButton->setToolTip("Refresh the thread information."); - tabWidget->setCornerWidget(refreshToolButton, Qt::TopRightCorner); + + QToolButton* helpToolButton = new QToolButton(tabWidget); + helpToolButton->setIcon(QIcon(":/seer/resources/RelaxLightIcons/help-about.svg")); + helpToolButton->setToolTip("Help on thread information."); + + QHContainerWidget* hcontainer = new QHContainerWidget(this); + hcontainer->addWidget(refreshToolButton); + hcontainer->addWidget(helpToolButton); + + tabWidget->setCornerWidget(hcontainer, Qt::TopRightCorner); // Connect things. QObject::connect(refreshToolButton, &QToolButton::clicked, this, &SeerThreadManagerWidget::handleRefreshToolButtonClicked); + QObject::connect(helpToolButton, &QToolButton::clicked, this, &SeerThreadManagerWidget::handleHelpToolButtonClicked); QObject::connect(schedulerLockingComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &SeerThreadManagerWidget::handleSchedulerLockingComboBox); QObject::connect(scheduleMultipleComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &SeerThreadManagerWidget::handleScheduleMultipleComboBox); QObject::connect(forkFollowsComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &SeerThreadManagerWidget::handleForkFollowComboBox); @@ -86,6 +100,24 @@ void SeerThreadManagerWidget::handleRefreshToolButtonClicked () { threadGroupsBrowserWidget()->refresh(); } +void SeerThreadManagerWidget::handleHelpToolButtonClicked () { + + // Get the Help text from the resource. + QFile file(":/seer/resources/help/ThreadProcessInfoBrowser.md"); + file.open(QFile::ReadOnly | QFile::Text); + + QTextStream stream(&file); + + QString text = stream.readAll(); + + // Put the Help text in as markdown. Move back to the begining. + QTextBrowser* browser = new QTextBrowser(0); + browser->setOpenExternalLinks(true); + browser->setMarkdown(text); + browser->moveCursor(QTextCursor::Start); + browser->show(); +} + void SeerThreadManagerWidget::handleSchedulerLockingComboBox (int index) { Q_UNUSED(index); diff --git a/src/SeerThreadManagerWidget.h b/src/SeerThreadManagerWidget.h index 7c9cb8d..ae3c417 100644 --- a/src/SeerThreadManagerWidget.h +++ b/src/SeerThreadManagerWidget.h @@ -37,6 +37,7 @@ class SeerThreadManagerWidget : public QWidget, protected Ui::SeerThreadManagerW private slots: void handleRefreshToolButtonClicked (); + void handleHelpToolButtonClicked (); void handleSchedulerLockingComboBox (int index); void handleScheduleMultipleComboBox (int index); void handleForkFollowComboBox (int index); diff --git a/src/resource.qrc b/src/resource.qrc index 8309513..74e0b0b 100644 --- a/src/resource.qrc +++ b/src/resource.qrc @@ -48,6 +48,8 @@ resources/RelaxLightIcons/debug-step-into.svg resources/RelaxLightIcons/debug-step-out.svg resources/RelaxLightIcons/debug-step-over.svg + resources/RelaxLightIcons/help-about.svg + resources/RelaxLightIcons/help-whatsthis.svg resources/help/ThreadProcessInfoBrowser.md diff --git a/src/resources/RelaxLightIcons/help-about.svg b/src/resources/RelaxLightIcons/help-about.svg new file mode 100644 index 0000000..bac7a1e --- /dev/null +++ b/src/resources/RelaxLightIcons/help-about.svg @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/src/resources/help/ThreadProcessInfoBrowser.md b/src/resources/help/ThreadProcessInfoBrowser.md index 4efeb81..a72ee15 100644 --- a/src/resources/help/ThreadProcessInfoBrowser.md +++ b/src/resources/help/ThreadProcessInfoBrowser.md @@ -18,19 +18,18 @@ Frames is the most useful. It presents a list of Thread Ids the program is curre This information is shown for each Thread Id: -
- -|Column |Description | -|---------|---------------------------------------------------| -|Thread Id|An id given to the thread/process by gdb | -|State |The running state of the id. 'running' or 'stopped'| -|Target Id|Details of the id. Thread or process info | -|Function |The function name the thread id is in | -|File |The filename the thread id is in | -|Line |The line number in the filename | -|Arguments|The arguments passed to the function | -|Core |Which cpu core the thread id is running on | - +``` + | Column | Description | + | ---------- | --------------------------------------------------- | + | Thread Id | An id given to the thread/process by gdb | + | State | The running state of the id. 'running' or 'stopped' | + | Target Id | Details of the id. Thread or process info | + | Function | The function name the thread id is in | + | File | The filename the thread id is in | + | Line | The line number in the filename | + | Arguments | The arguments passed to the function | + | Core | Which cpu core the thread id is running on | +``` Clicking on a Thread Id will cause Seer to make that Thread Id the active thread. This will in turn cause the Stack Info Browser to refer to that Thread Id. ### Ids @@ -39,23 +38,21 @@ Ids is a simplified list ofThread Ids, with no other information. Clicking on a ### Groups Groups is a list of Thread Groups. Basically, inferior processes. Most programs are just one inferior, even if they use threads. Program's that use fork and exec will have multiple inferiors. This information is shown for each Thread Id: -
- -|Column |Description | -|---------------|----------------------------------------------| -|Thread Group Id|An id given to the thread/process group by gdb| -|Type |The Thread Group type. Usually 'process' type | -|Pid |The process id | -|Executable |The name and path of the process executable | -|Cores |List of cpu cores used by the process | - +``` + | Column | Description | + | --------------- | ---------------------------------------------- | + | Thread Group Id | An id given to the thread/process group by gdb | + | Type | The Thread Group type. Usually 'process' type | + | Pid | The process id | + | Executable | The name and path of the process executable | + | Cores | List of cpu cores used by the process | +``` ### References Consult these gdb references 1. [Link](https://sourceware.org/gdb/onlinedocs/gdb/Threads.html#thread-ID-lists) Listing thread information. -1. [Link](https://sourceware.org/gdb/onlinedocs/gdb/All_002dStop-Mode.html#All_002dStop-Mode) GDB all-stop mode. -1. [Link](https://sourceware.org/gdb/onlinedocs/gdb/Forks.html) GDB follow-fork mode. +2. [Link](https://sourceware.org/gdb/onlinedocs/gdb/All_002dStop-Mode.html#All_002dStop-Mode) GDB all-stop mode. +3. [Link](https://sourceware.org/gdb/onlinedocs/gdb/Forks.html) GDB follow-fork mode. -