Line 8... |
Line 8... |
#include "CpuWidgets/StackTraceWidget.h"
|
#include "CpuWidgets/StackTraceWidget.h"
|
#include "ControlWidget/ConsoleWidget.h"
|
#include "ControlWidget/ConsoleWidget.h"
|
#include "PeriphWidgets/UartWidget.h"
|
#include "PeriphWidgets/UartWidget.h"
|
#include "PeriphWidgets/GpioWidget.h"
|
#include "PeriphWidgets/GpioWidget.h"
|
#include "GnssWidgets/MapWidget.h"
|
#include "GnssWidgets/MapWidget.h"
|
|
#include "GnssWidgets/PlotWidget.h"
|
#include <QtWidgets/QtWidgets>
|
#include <QtWidgets/QtWidgets>
|
|
|
|
#ifdef WIN32
|
|
//#define GITHUB_SCREENSHOT_SIZE
|
|
#endif
|
|
|
namespace debugger {
|
namespace debugger {
|
|
|
DbgMainWindow::DbgMainWindow(IGui *igui) : QMainWindow() {
|
DbgMainWindow::DbgMainWindow(IGui *igui) : QMainWindow() {
|
igui_ = igui;
|
igui_ = igui;
|
//initDone_ = init_done;
|
|
statusRequested_ = false;
|
statusRequested_ = false;
|
ebreak_ = 0;
|
ebreak_ = 0;
|
|
|
setWindowTitle(tr("RISC-V platform debugger"));
|
setWindowTitle(tr("RISC-V platform debugger"));
|
|
#ifdef GITHUB_SCREENSHOT_SIZE
|
|
resize(QSize(872, 600));
|
|
#else
|
resize(QDesktopWidget().availableGeometry(this).size() * 0.7);
|
resize(QDesktopWidget().availableGeometry(this).size() * 0.7);
|
|
#endif
|
|
|
listConsoleListeners_.make_list(0);
|
listConsoleListeners_.make_list(0);
|
/** Console commands used by main window: */
|
/** Console commands used by main window: */
|
cmdStatus_.make_string("status");
|
cmdStatus_.make_string("status");
|
cmdRun_.make_string("c");
|
cmdRun_.make_string("c");
|
Line 63... |
Line 71... |
qRegisterMetaType<uint32_t>("uint32_t");
|
qRegisterMetaType<uint32_t>("uint32_t");
|
|
|
tmrGlobal_ = new QTimer(this);
|
tmrGlobal_ = new QTimer(this);
|
connect(tmrGlobal_, SIGNAL(timeout()), this, SLOT(slotUpdateByTimer()));
|
connect(tmrGlobal_, SIGNAL(timeout()), this, SLOT(slotUpdateByTimer()));
|
tmrGlobal_->setSingleShot(false);
|
tmrGlobal_->setSingleShot(false);
|
tmrGlobal_->setInterval(250);
|
const AttributeType &cfg = *igui->getpConfig();
|
|
int t1 = cfg["PollingMs"].to_int();
|
|
if (t1 < 10) {
|
|
t1 = 10;
|
|
}
|
|
tmrGlobal_->setInterval(t1);
|
tmrGlobal_->start();
|
tmrGlobal_->start();
|
}
|
}
|
|
|
DbgMainWindow::~DbgMainWindow() {
|
DbgMainWindow::~DbgMainWindow() {
|
if (ebreak_) {
|
if (ebreak_) {
|
Line 95... |
Line 108... |
if (req->is_equal(cmdStatus_.to_string())) {
|
if (req->is_equal(cmdStatus_.to_string())) {
|
statusRequested_ = false;
|
statusRequested_ = false;
|
if (resp->is_nil()) {
|
if (resp->is_nil()) {
|
return;
|
return;
|
}
|
}
|
DsuMapType::udbg_type::debug_region_type::control_reg ctrl;
|
GenericCpuControlType ctrl;
|
ctrl.val = resp->to_uint64();
|
ctrl.val = resp->to_uint64();
|
if ((actionRun_->isChecked() && ctrl.bits.halt)
|
if ((actionRun_->isChecked() && ctrl.bits.halt)
|
|| (!actionRun_->isChecked() && !ctrl.bits.halt)) {
|
|| (!actionRun_->isChecked() && !ctrl.bits.halt)) {
|
emit signalTargetStateChanged(ctrl.bits.halt == 0);
|
emit signalTargetStateChanged(ctrl.bits.halt == 0);
|
}
|
}
|
if (ctrl.bits.breakpoint && ebreak_) {
|
if ((ctrl.bits.sw_breakpoint || ctrl.bits.hw_breakpoint) && ebreak_) {
|
ebreak_->skip();
|
ebreak_->skip();
|
}
|
}
|
#if 0
|
#if 0
|
static const char *xSTATES[] = {"Idle", "WaitGrant", "WaitResp", "WaitAccept"};
|
static const char *xSTATES[] = {"Idle", "WaitGrant", "WaitResp", "WaitAccept"};
|
static const char *CSTATES[] = {"Idle", "IMem", "DMem"};
|
static const char *CSTATES[] = {"Idle", "IMem", "DMem"};
|
Line 191... |
Line 204... |
actionGnssMap_->setCheckable(true);
|
actionGnssMap_->setCheckable(true);
|
actionGnssMap_->setChecked(false);
|
actionGnssMap_->setChecked(false);
|
connect(actionGnssMap_, SIGNAL(triggered(bool)),
|
connect(actionGnssMap_, SIGNAL(triggered(bool)),
|
this, SLOT(slotActionTriggerGnssMap(bool)));
|
this, SLOT(slotActionTriggerGnssMap(bool)));
|
|
|
|
actionGnssPlot_ = new QAction(QIcon(tr(":/images/plot_96x96.png")),
|
|
tr("HW Statistic"), this);
|
|
actionGnssPlot_->setToolTip(tr("Open HW statistic"));
|
|
actionGnssPlot_->setCheckable(true);
|
|
actionGnssPlot_->setChecked(false);
|
|
connect(actionGnssPlot_, SIGNAL(triggered(bool)),
|
|
this, SLOT(slotActionTriggerGnssPlot(bool)));
|
|
|
actionRun_ = new QAction(QIcon(tr(":/images/start_96x96.png")),
|
actionRun_ = new QAction(QIcon(tr(":/images/start_96x96.png")),
|
tr("&Run"), this);
|
tr("&Run"), this);
|
actionRun_->setToolTip(tr("Start Execution (F5)"));
|
actionRun_->setToolTip(tr("Start Execution (F5)"));
|
actionRun_->setShortcut(QKeySequence(tr("F5")));
|
actionRun_->setShortcut(QKeySequence(tr("F5")));
|
actionRun_->setCheckable(true);
|
actionRun_->setCheckable(true);
|
Line 252... |
Line 273... |
menu->addAction(actionGpio_);
|
menu->addAction(actionGpio_);
|
menu->addAction(actionPnp_);
|
menu->addAction(actionPnp_);
|
menu->addSeparator();
|
menu->addSeparator();
|
menu->addAction(actionRegs_);
|
menu->addAction(actionRegs_);
|
menu->addAction(actionSymbolBrowser_);
|
menu->addAction(actionSymbolBrowser_);
|
|
menu->addAction(actionGnssPlot_);
|
|
|
menu = menuBar()->addMenu(tr("&GNSS"));
|
menu = menuBar()->addMenu(tr("&GNSS"));
|
menu->addAction(actionGnssMap_);
|
menu->addAction(actionGnssMap_);
|
|
|
menu = menuBar()->addMenu(tr("&Help"));
|
menu = menuBar()->addMenu(tr("&Help"));
|
Line 278... |
Line 300... |
dock->setAllowedAreas(Qt::BottomDockWidgetArea);
|
dock->setAllowedAreas(Qt::BottomDockWidgetArea);
|
addDockWidget(Qt::BottomDockWidgetArea, dock);
|
addDockWidget(Qt::BottomDockWidgetArea, dock);
|
|
|
ConsoleWidget *consoleWidget = new ConsoleWidget(igui_, this);
|
ConsoleWidget *consoleWidget = new ConsoleWidget(igui_, this);
|
dock->setWidget(consoleWidget);
|
dock->setWidget(consoleWidget);
|
|
|
|
#ifdef GITHUB_SCREENSHOT_SIZE
|
|
double desired_h =
|
|
QDesktopWidget().availableGeometry(this).size().height() * 0.07;
|
|
consoleWidget->setFixedHeight(desired_h);
|
|
#endif
|
}
|
}
|
|
|
void DbgMainWindow::addWidgets() {
|
void DbgMainWindow::addWidgets() {
|
slotActionTriggerUart0(true);
|
slotActionTriggerUart0(true);
|
slotActionTriggerCpuAsmView(true);
|
slotActionTriggerCpuAsmView(true);
|
Line 359... |
Line 387... |
} else {
|
} else {
|
viewGnssMap_->close();
|
viewGnssMap_->close();
|
}
|
}
|
}
|
}
|
|
|
|
void DbgMainWindow::slotActionTriggerGnssPlot(bool val) {
|
|
if (val) {
|
|
viewGnssPlot_ =
|
|
new PlotQMdiSubWindow(igui_, mdiArea_, this, actionGnssPlot_);
|
|
} else {
|
|
viewGnssPlot_->close();
|
|
}
|
|
}
|
|
|
void DbgMainWindow::slotActionTriggerSymbolBrowser() {
|
void DbgMainWindow::slotActionTriggerSymbolBrowser() {
|
new SymbolBrowserQMdiSubWindow(igui_, mdiArea_, this);
|
new SymbolBrowserQMdiSubWindow(igui_, mdiArea_, this);
|
}
|
}
|
|
|
Line 372... |
Line 408... |
|
|
void DbgMainWindow::slotOpenMemory(uint64_t addr, uint64_t sz) {
|
void DbgMainWindow::slotOpenMemory(uint64_t addr, uint64_t sz) {
|
new MemQMdiSubWindow(igui_, mdiArea_, this, addr, sz);
|
new MemQMdiSubWindow(igui_, mdiArea_, this, addr, sz);
|
}
|
}
|
|
|
//void DbgMainWindow::slotPostInit(AttributeType *cfg) {
|
|
// config_ = *cfg;
|
|
// Enable polling timer:
|
|
//connect(tmrGlobal_, SIGNAL(timeout()), this, SLOT(slotUpdateByTimer()));
|
|
//int ms = static_cast<int>(config_["PollingMs"].to_uint64());
|
|
//tmrGlobal_->setInterval(ms);
|
|
//tmrGlobal_->setSingleShot(false);
|
|
//tmrGlobal_->start(ms);
|
|
|
|
|
|
// Debug:
|
|
//slotActionTriggerGnssMap(true);
|
|
//}
|
|
|
|
void DbgMainWindow::slotUpdateByTimer() {
|
void DbgMainWindow::slotUpdateByTimer() {
|
if (!statusRequested_) {
|
if (!statusRequested_) {
|
statusRequested_ = true;
|
statusRequested_ = true;
|
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this),
|
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this),
|
&cmdStatus_, true);
|
&cmdStatus_, true);
|