diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8b84107..801bf2b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -88,6 +88,7 @@ set(HEADER_FILES SeerHighlighterSettings.h SeerKeySettings.h SeerPlainTextEdit.h + SeerHelpPageWidget.h QProcessInfo.h QProcessInfoWidget.h QProgressIndicator.h @@ -172,6 +173,7 @@ set(SOURCE_FILES SeerHighlighterSettings.cpp SeerKeySettings.cpp SeerPlainTextEdit.cpp + SeerHelpPageWidget.cpp QProcessInfo.cpp QProcessInfoWidget.cpp QProgressIndicator.cpp diff --git a/src/SeerHelpPageWidget.cpp b/src/SeerHelpPageWidget.cpp new file mode 100644 index 0000000..a194672 --- /dev/null +++ b/src/SeerHelpPageWidget.cpp @@ -0,0 +1,97 @@ +#include "SeerHelpPageWidget.h" +#include +#include +#include +#include +#include + +SeerHelpPageWidget::SeerHelpPageWidget(QWidget* parent) : QWidget(parent) { + + // Construct the UI. + setupUi(this); + + // Setup the widgets + setWindowIcon(QIcon(":/seer/resources/seergdb_64x64.png")); + setWindowTitle("Seer Help"); + setAttribute(Qt::WA_DeleteOnClose); + + textBrowser->setOpenExternalLinks(true); + + // Connect things. + QObject::connect(printToolButton, &QToolButton::clicked, this, &SeerHelpPageWidget::handlePrintToolButton); + QObject::connect(okPushButton, &QPushButton::clicked, this, &SeerHelpPageWidget::handleOkPushButton); + + // Restore window settings. + readSettings(); +} + +SeerHelpPageWidget::~SeerHelpPageWidget() { +} + +void SeerHelpPageWidget::loadFile (const QString& filename) { + + // Get the Help text from the file. + QFile file(filename); + file.open(QFile::ReadOnly|QFile::Text); + + QTextStream stream(&file); + + QString text = stream.readAll(); + + // Load it into the browser. + loadText(text); +} + +void SeerHelpPageWidget::loadText (const QString& text) { + + // Put the Help text in as markdown. Move back to the begining. + textBrowser->setMarkdown(text); + textBrowser->moveCursor(QTextCursor::Start); +} + +void SeerHelpPageWidget::handlePrintToolButton () { + + QPrinter printer; + + QPrintDialog* dlg = new QPrintDialog(&printer, this); + + if (dlg->exec() != QDialog::Accepted) { + return; + } + + QTextDocument* document = textBrowser->document(); + + document->print(&printer); +} + +void SeerHelpPageWidget::handleOkPushButton () { + + close(); +} + +void SeerHelpPageWidget::writeSettings() { + + QSettings settings; + + settings.beginGroup("helpwindow"); { + settings.setValue("size", size()); + }settings.endGroup(); +} + +void SeerHelpPageWidget::readSettings() { + + QSettings settings; + + settings.beginGroup("helpwindow"); { + resize(settings.value("size", QSize(600, 600)).toSize()); + }settings.endGroup(); +} + +void SeerHelpPageWidget::resizeEvent (QResizeEvent* event) { + + // Write window settings. + writeSettings(); + + QWidget::resizeEvent(event); +} + diff --git a/src/SeerHelpPageWidget.h b/src/SeerHelpPageWidget.h new file mode 100644 index 0000000..f1b7c73 --- /dev/null +++ b/src/SeerHelpPageWidget.h @@ -0,0 +1,30 @@ +#pragma once + +#include "ui_SeerHelpPageWidget.h" + +class SeerHelpPageWidget: public QWidget, protected Ui::SeerHelpPageWidgetForm { + + Q_OBJECT + + public: + + SeerHelpPageWidget(QWidget* parent = 0); + ~SeerHelpPageWidget(); + + void loadFile (const QString& filename); + void loadText (const QString& text); + + signals: + public slots: + protected: + void writeSettings (); + void readSettings (); + void resizeEvent (QResizeEvent* event); + + protected slots: + void handlePrintToolButton (); + void handleOkPushButton (); + + private: +}; + diff --git a/src/SeerHelpPageWidget.ui b/src/SeerHelpPageWidget.ui new file mode 100644 index 0000000..2988ca0 --- /dev/null +++ b/src/SeerHelpPageWidget.ui @@ -0,0 +1,74 @@ + + + SeerHelpPageWidgetForm + + + + 0 + 0 + 600 + 600 + + + + Form + + + + + + + 0 + 100 + + + + + + + + + + Print Help page. + + + + + + + :/seer/resources/RelaxLightIcons/document-print.svg:/seer/resources/RelaxLightIcons/document-print.svg + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Dismiss Help page. + + + OK + + + + + + + + + + + + diff --git a/src/SeerThreadManagerWidget.cpp b/src/SeerThreadManagerWidget.cpp index 202668f..71fe41b 100644 --- a/src/SeerThreadManagerWidget.cpp +++ b/src/SeerThreadManagerWidget.cpp @@ -1,10 +1,10 @@ #include "SeerThreadManagerWidget.h" +#include "SeerHelpPageWidget.h" #include "QHContainerWidget.h" #include #include #include -#include -#include +#include #include SeerThreadManagerWidget::SeerThreadManagerWidget (QWidget* parent) : QWidget(parent) { @@ -103,20 +103,9 @@ void SeerThreadManagerWidget::handleRefreshToolButtonClicked () { 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(); + SeerHelpPageWidget* help = new SeerHelpPageWidget; + help->loadFile(":/seer/resources/help/ThreadProcessInfoBrowser.md"); + help->show(); } void SeerThreadManagerWidget::handleSchedulerLockingComboBox (int index) { diff --git a/src/resources/help/ThreadProcessInfoBrowser.md b/src/resources/help/ThreadProcessInfoBrowser.md index a72ee15..5fbfe65 100644 --- a/src/resources/help/ThreadProcessInfoBrowser.md +++ b/src/resources/help/ThreadProcessInfoBrowser.md @@ -19,16 +19,16 @@ 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. @@ -40,14 +40,35 @@ Groups is a list of Thread Groups. Basically, inferior processes. Most programs 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 ``` +### Scheduler Locking mode + +* Record. Behaves like 'off' in 'record' mode and like 'on' in 'replay' mode. This is the default. +* Off. There is no locking and any thread may run at any time. +* On. Only the current thread may run when the inferior is resumed. +* Step. Optimizes for single-stepping; it prevents other threads from preempting the current thread while you are stepping, so that the focus of debugging does not change unexpectedly. + +### Schedule Multiple mode +This affects how gdb handles multiple inferiors when a 'continue' is executed. Choices are: + +* On. All threads of all processes are allowed to run. +* Off. Only the threads of the current process are resumed. The default is off. + +### Fork Follows mode +This affects how gdb handles the program when a fork/vfork is encountered. Possible choices are: + +* Follow the parent process (the default). The child executes unabated. +* Follow the child process. The parent executes unabated. +* Follow both processes. A new process (an inferior) appears and either process can be selected. + + ### References Consult these gdb references @@ -55,4 +76,5 @@ Consult these gdb references 1. [Link](https://sourceware.org/gdb/onlinedocs/gdb/Threads.html#thread-ID-lists) Listing thread information. 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. +3. [Link](https://sourceware.org/gdb/onlinedocs/gdb/Process-Record-and-Replay.html) GDB Record or Replay mode.