mirror of
https://github.com/epasveer/seer.git
synced 2026-08-29 08:34:42 +08:00
Merge pull request #395 from epasveer/393-add-external-define-to-set-default-gdb-to-use
393 add external define to set default gdb to use
This commit is contained in:
+19
-4
@@ -295,8 +295,23 @@ elseif(${QTVERSION} STREQUAL "QT5")
|
||||
target_link_libraries(${PROJECT_NAME} Qt5::Widgets Qt5::Gui Qt5::Core Qt5::PrintSupport Qt5::Charts)
|
||||
endif()
|
||||
|
||||
# Global macro, turn ENABLE_GDB_LOGOUT=1 to enable gdb logout
|
||||
target_compile_definitions(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
ENABLE_GDB_LOGOUT=1
|
||||
# Handle gdb logout debugging. Turn CONFIG_SEER_GDB_LOGOUT=1 to enable gdb logout
|
||||
# -DCONFIG_SEER_GDB_LOGOUT=1
|
||||
if(NOT DEFINED CONFIG_SEER_GDB_LOGOUT)
|
||||
set(CONFIG_SEER_GDB_LOGOUT 0)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||
SEER_GDB_LOGOUT=${CONFIG_SEER_GDB_LOGOUT}
|
||||
)
|
||||
|
||||
# Handle default gdb binary name and location.
|
||||
# -DCONFIG_SEER_GDB_NAME=/app/bin/gdb
|
||||
if(NOT DEFINED CONFIG_SEER_GDB_NAME)
|
||||
set(CONFIG_SEER_GDB_NAME"/usr/bin/gdb")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME} PRIVATE
|
||||
SEER_GDB_NAME=${CONFIG_SEER_GDB_NAME}
|
||||
)
|
||||
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ void GdbMonitor::handleReadyReadStandardOutput () {
|
||||
//qDebug() << "Read buffer" << buf.size() << (int)buf[buf.size()-1] << text;
|
||||
qCDebug(LC) << text;
|
||||
|
||||
#if ENABLE_GDB_LOGOUT == 1
|
||||
#if SEER_GDB_LOGOUT == 1
|
||||
// Start broadcasting it around. For debugging
|
||||
emit allTextOutput("From GdbMonitor: " + text + "\n");
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
#include "SeerGdbConfigPage.h"
|
||||
#include "SeerUtl.h"
|
||||
#include <QtWidgets/QWidget>
|
||||
#include <QtWidgets/QFileDialog>
|
||||
#include <QtGlobal>
|
||||
@@ -118,7 +119,11 @@ void SeerGdbConfigPage::setGdbArchitectureType (const QString& type) {
|
||||
|
||||
void SeerGdbConfigPage::reset () {
|
||||
|
||||
setGdbProgram("/usr/bin/gdb");
|
||||
#ifdef SEER_GDB_NAME
|
||||
setGdbProgram(STRINGIFY(SEER_GDB_NAME));
|
||||
#else
|
||||
setGdbProgram("/usr/bin/gdb";
|
||||
#endif
|
||||
setGdbArguments("--interpreter=mi");
|
||||
setGdbAsyncMode(true);
|
||||
setGdbNonStopMode(false);
|
||||
|
||||
@@ -61,7 +61,11 @@ SeerGdbWidget::SeerGdbWidget (QWidget* parent) : QWidget(parent) {
|
||||
_catchpointsBrowserWidget = 0;
|
||||
_gdbOutputLog = 0;
|
||||
_seerOutputLog = 0;
|
||||
#ifdef SEER_GDB_NAME
|
||||
_gdbProgram = STRINGIFY(SEER_GDB_NAME);
|
||||
#else
|
||||
_gdbProgram = "/usr/bin/gdb";
|
||||
#endif
|
||||
_gdbArguments = "--interpreter=mi";
|
||||
_gdbASyncMode = true;
|
||||
_gdbNonStopMode = false;
|
||||
@@ -423,7 +427,7 @@ SeerGdbWidget::SeerGdbWidget (QWidget* parent) : QWidget(parent) {
|
||||
QObject::connect(breakpointsSaveToolButton, &QToolButton::clicked, this, &SeerGdbWidget::handleGdbSaveBreakpoints);
|
||||
QObject::connect(helpToolButton, &QToolButton::clicked, this, &SeerGdbWidget::handleHelpToolButtonClicked);
|
||||
|
||||
#if ENABLE_GDB_LOGOUT == 1
|
||||
#if SEER_GDB_LOGOUT == 1
|
||||
// Direct all GdbWidget and GdbMonitor log to GDB Log, for debugging
|
||||
QObject::connect(this, &SeerGdbWidget::gdbCommandLogout, _gdbOutputLog, &SeerGdbLogWidget::handleText);
|
||||
QObject::connect(_gdbMonitor, &GdbMonitor::allTextOutput, _gdbOutputLog, &SeerGdbLogWidget::handleText);
|
||||
@@ -1046,7 +1050,7 @@ void SeerGdbWidget::handleGdbCommand (const QString& command) {
|
||||
|
||||
QByteArray bytes = str.toUtf8(); // 8-bit Unicode Transformation Format
|
||||
|
||||
#if ENABLE_GDB_LOGOUT == 1
|
||||
#if SEER_GDB_LOGOUT == 1
|
||||
// Broadcast this log. For debugging
|
||||
emit gdbCommandLogout("From Widget:" + str);
|
||||
#endif
|
||||
|
||||
@@ -1628,7 +1628,11 @@ void SeerMainWindow::readConfigSettings () {
|
||||
} settings.endGroup();
|
||||
|
||||
settings.beginGroup("gdb"); {
|
||||
#ifdef SEER_GDB_NAME
|
||||
gdbWidget->setGdbProgram(settings.value("program", STRINGIFY(SEER_GDB_NAME)).toString());
|
||||
#else
|
||||
gdbWidget->setGdbProgram(settings.value("program", "/usr/bin/gdb").toString());
|
||||
#endif
|
||||
gdbWidget->setGdbArguments(settings.value("arguments", "--interpreter=mi").toString());
|
||||
gdbWidget->setGdbAsyncMode(settings.value("asyncmode", true).toBool());
|
||||
gdbWidget->setGdbNonStopMode(settings.value("nonstopmode", false).toBool());
|
||||
|
||||
@@ -9,6 +9,12 @@
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/Qt>
|
||||
|
||||
// 1. A helper macro that accepts an argument and stringifies it.
|
||||
#define STRINGIFY_HELPER(x) #x
|
||||
|
||||
// 2. The main macro that forces expansion of 'x' before passing it to the helper.
|
||||
#define STRINGIFY(x) STRINGIFY_HELPER(x)
|
||||
|
||||
namespace Seer {
|
||||
|
||||
QString version ();
|
||||
|
||||
Reference in New Issue
Block a user