summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/debugger
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2014-12-22 20:16:09 +0100
committer Olivier Galibert <galibert@pobox.com>2014-12-22 20:16:45 +0100
commit02027ddfcc80176e5e92fc285160ac90c31e3175 (patch)
tree8d4d57a6c3bde33fc09a2c3cad984860c1d7aa0d /src/osd/modules/debugger
parent03ee49381c9700ebd5f3136ce3c072ddefe55342 (diff)
debug/qt: Add a per-device window [O. Galibert]
There probably is interesting information to add, and it can look better. Anybody, feel free to enhance it :-)
Diffstat (limited to 'src/osd/modules/debugger')
-rw-r--r--src/osd/modules/debugger/debugqt.c18
-rw-r--r--src/osd/modules/debugger/qt/debugqtdeviceinformationwindow.c132
-rw-r--r--src/osd/modules/debugger/qt/debugqtdeviceinformationwindow.h53
-rw-r--r--src/osd/modules/debugger/qt/debugqtdeviceswindow.c22
-rw-r--r--src/osd/modules/debugger/qt/debugqtdeviceswindow.h5
5 files changed, 222 insertions, 8 deletions
diff --git a/src/osd/modules/debugger/debugqt.c b/src/osd/modules/debugger/debugqt.c
index 40942a63506..7ae32540b0a 100644
--- a/src/osd/modules/debugger/debugqt.c
+++ b/src/osd/modules/debugger/debugqt.c
@@ -26,6 +26,7 @@
#include "qt/debugqtmemorywindow.h"
#include "qt/debugqtbreakpointswindow.h"
#include "qt/debugqtdeviceswindow.h"
+#include "qt/debugqtdeviceinformationwindow.h"
#include "debugqt.h"
@@ -86,12 +87,13 @@ static void xml_configuration_load(running_machine &machine, int config_type, xm
WindowQtConfig::WindowType type = (WindowQtConfig::WindowType)xml_get_attribute_int(wnode, "type", WindowQtConfig::WIN_TYPE_UNKNOWN);
switch (type)
{
- case WindowQtConfig::WIN_TYPE_MAIN: xmlConfigurations.push_back(new MainWindowQtConfig()); break;
- case WindowQtConfig::WIN_TYPE_MEMORY: xmlConfigurations.push_back(new MemoryWindowQtConfig()); break;
- case WindowQtConfig::WIN_TYPE_DASM: xmlConfigurations.push_back(new DasmWindowQtConfig()); break;
- case WindowQtConfig::WIN_TYPE_LOG: xmlConfigurations.push_back(new LogWindowQtConfig()); break;
- case WindowQtConfig::WIN_TYPE_BREAK_POINTS: xmlConfigurations.push_back(new BreakpointsWindowQtConfig()); break;
- case WindowQtConfig::WIN_TYPE_DEVICES: xmlConfigurations.push_back(new DevicesWindowQtConfig()); break;
+ case WindowQtConfig::WIN_TYPE_MAIN: xmlConfigurations.push_back(new MainWindowQtConfig()); break;
+ case WindowQtConfig::WIN_TYPE_MEMORY: xmlConfigurations.push_back(new MemoryWindowQtConfig()); break;
+ case WindowQtConfig::WIN_TYPE_DASM: xmlConfigurations.push_back(new DasmWindowQtConfig()); break;
+ case WindowQtConfig::WIN_TYPE_LOG: xmlConfigurations.push_back(new LogWindowQtConfig()); break;
+ case WindowQtConfig::WIN_TYPE_BREAK_POINTS: xmlConfigurations.push_back(new BreakpointsWindowQtConfig()); break;
+ case WindowQtConfig::WIN_TYPE_DEVICES: xmlConfigurations.push_back(new DevicesWindowQtConfig()); break;
+ case WindowQtConfig::WIN_TYPE_DEVICE_INFORMATION: xmlConfigurations.push_back(new DeviceInformationWindowQtConfig()); break;
default: continue;
}
xmlConfigurations.back()->recoverFromXmlNode(wnode);
@@ -149,6 +151,8 @@ static void gather_save_configurations()
xmlConfigurations.push_back(new BreakpointsWindowQtConfig());
else if (dynamic_cast<DevicesWindow*>(widget))
xmlConfigurations.push_back(new DevicesWindowQtConfig());
+ else if (dynamic_cast<DeviceInformationWindow*>(widget))
+ xmlConfigurations.push_back(new DeviceInformationWindowQtConfig());
xmlConfigurations.back()->buildFromQWidget(widget);
}
@@ -193,6 +197,8 @@ static void setup_additional_startup_windows(running_machine& machine, std::vect
foo = new BreakpointsWindow(&machine); break;
case WindowQtConfig::WIN_TYPE_DEVICES:
foo = new DevicesWindow(&machine); break;
+ case WindowQtConfig::WIN_TYPE_DEVICE_INFORMATION:
+ foo = new DeviceInformationWindow(&machine); break;
default: break;
}
config->applyToQWidget(foo);
diff --git a/src/osd/modules/debugger/qt/debugqtdeviceinformationwindow.c b/src/osd/modules/debugger/qt/debugqtdeviceinformationwindow.c
new file mode 100644
index 00000000000..66baf08bdfa
--- /dev/null
+++ b/src/osd/modules/debugger/qt/debugqtdeviceinformationwindow.c
@@ -0,0 +1,132 @@
+#define NO_MEM_TRACKING
+
+#include "debugqtdeviceinformationwindow.h"
+
+
+DeviceInformationWindow::DeviceInformationWindow(running_machine* machine, device_t* device, QWidget* parent) :
+ WindowQt(machine, NULL)
+{
+ m_device = device;
+
+ if (parent != NULL)
+ {
+ QPoint parentPos = parent->pos();
+ setGeometry(parentPos.x()+100, parentPos.y()+100, 600, 400);
+ }
+
+ if(m_device)
+ fill_device_information();
+}
+
+
+DeviceInformationWindow::~DeviceInformationWindow()
+{
+}
+
+void DeviceInformationWindow::fill_device_information()
+{
+ char title[4069];
+ sprintf(title, "Debug: Device %s", m_device->tag());
+ setWindowTitle(title);
+
+
+ QFrame *mainWindowFrame = new QFrame(this);
+ QVBoxLayout *vLayout = new QVBoxLayout(mainWindowFrame);
+ vLayout->setObjectName("vlayout");
+ vLayout->setSpacing(3);
+ vLayout->setContentsMargins(2,2,2,2);
+
+ QFrame *primaryFrame = new QFrame(mainWindowFrame);
+ primaryFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
+ QGridLayout *gl1 = new QGridLayout(primaryFrame);
+ gl1->addWidget(new QLabel(QString("Tag"), primaryFrame), 0, 0);
+ gl1->addWidget(new QLabel(QString(m_device->tag()), primaryFrame), 0, 1);
+ gl1->addWidget(new QLabel(QString("Name"), primaryFrame), 1, 0);
+ gl1->addWidget(new QLabel(QString(m_device->name()), primaryFrame), 1, 1);
+ gl1->addWidget(new QLabel(QString("Shortname"), primaryFrame), 2, 0);
+ gl1->addWidget(new QLabel(QString(m_device->shortname()), primaryFrame), 2, 1);
+
+ int cpos = 3;
+ device_interface *intf = m_device->first_interface();
+ if(intf) {
+ gl1->addWidget(new QLabel(QString("Interfaces"), primaryFrame), cpos, 0);
+ while(intf) {
+ gl1->addWidget(new QLabel(QString(intf->interface_type()), primaryFrame), cpos, 1);
+ cpos++;
+ intf = intf->interface_next();
+ }
+ }
+
+ vLayout->addWidget(primaryFrame);
+
+ device_memory_interface *d_memory;
+ if(m_device->interface(d_memory)) {
+ QFrame *f = new QFrame(mainWindowFrame);
+ f->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
+ QVBoxLayout *vb = new QVBoxLayout(f);
+ bool first = true;
+ for(address_spacenum i=AS_0; i<ADDRESS_SPACES; i++)
+ if(d_memory->has_space(i)) {
+ QFrame *ff = new QFrame(f);
+ QHBoxLayout *hb = new QHBoxLayout(ff);
+ if(first) {
+ hb->addWidget(new QLabel("Memory maps"));
+ first = false;
+ }
+ hb->addStretch();
+ hb->addWidget(new QLabel(d_memory->space_config(i)->name()));
+ vb->addWidget(ff);
+ }
+ vLayout->addWidget(f);
+ }
+
+ vLayout->addStretch();
+
+ setCentralWidget(mainWindowFrame);
+}
+
+void DeviceInformationWindow::set_device(const char *tag)
+{
+ m_device = m_machine->device(tag);
+ if(!m_device)
+ m_device = &m_machine->root_device();
+ fill_device_information();
+}
+
+const char *DeviceInformationWindow::device_tag() const
+{
+ return m_device->tag();
+}
+
+
+//=========================================================================
+// DeviceInformationWindowQtConfig
+//=========================================================================
+void DeviceInformationWindowQtConfig::buildFromQWidget(QWidget* widget)
+{
+ WindowQtConfig::buildFromQWidget(widget);
+ DeviceInformationWindow* window = dynamic_cast<DeviceInformationWindow*>(widget);
+ m_device_tag = window->device_tag();
+}
+
+
+void DeviceInformationWindowQtConfig::applyToQWidget(QWidget* widget)
+{
+ WindowQtConfig::applyToQWidget(widget);
+ DeviceInformationWindow* window = dynamic_cast<DeviceInformationWindow*>(widget);
+ window->set_device(m_device_tag.cstr());
+}
+
+
+void DeviceInformationWindowQtConfig::addToXmlDataNode(xml_data_node* node) const
+{
+ WindowQtConfig::addToXmlDataNode(node);
+ xml_set_attribute(node, "device-tag", m_device_tag);
+}
+
+
+void DeviceInformationWindowQtConfig::recoverFromXmlNode(xml_data_node* node)
+{
+ WindowQtConfig::recoverFromXmlNode(node);
+ m_device_tag = xml_get_attribute_string(node, "device-tag", ":");
+}
diff --git a/src/osd/modules/debugger/qt/debugqtdeviceinformationwindow.h b/src/osd/modules/debugger/qt/debugqtdeviceinformationwindow.h
new file mode 100644
index 00000000000..cb7ade44c00
--- /dev/null
+++ b/src/osd/modules/debugger/qt/debugqtdeviceinformationwindow.h
@@ -0,0 +1,53 @@
+#ifndef __DEBUG_QT_DEVICE_INFORMATION_WINDOW_H__
+#define __DEBUG_QT_DEVICE_INFORMATION_WINDOW_H__
+
+#include <QtGui/QtGui>
+
+#include "debugqtwindow.h"
+
+//============================================================
+// The Device Information Window.
+//============================================================
+class DeviceInformationWindow : public WindowQt
+{
+ Q_OBJECT
+
+public:
+ DeviceInformationWindow(running_machine* machine, device_t* device = NULL, QWidget* parent=NULL);
+ virtual ~DeviceInformationWindow();
+
+ void set_device(const char *tag);
+ const char *device_tag() const;
+
+private:
+ device_t *m_device;
+
+ void fill_device_information();
+};
+
+
+
+
+//=========================================================================
+// A way to store the configuration of a window long enough to read/write.
+//=========================================================================
+class DeviceInformationWindowQtConfig : public WindowQtConfig
+{
+public:
+ astring m_device_tag;
+
+ DeviceInformationWindowQtConfig() :
+ WindowQtConfig(WIN_TYPE_DEVICE_INFORMATION)
+ {
+ }
+
+ ~DeviceInformationWindowQtConfig() {}
+
+ void buildFromQWidget(QWidget* widget);
+ void applyToQWidget(QWidget* widget);
+ void addToXmlDataNode(xml_data_node* node) const;
+ void recoverFromXmlNode(xml_data_node* node);
+};
+
+
+#endif
diff --git a/src/osd/modules/debugger/qt/debugqtdeviceswindow.c b/src/osd/modules/debugger/qt/debugqtdeviceswindow.c
index ee833941b2d..10596a1c9f1 100644
--- a/src/osd/modules/debugger/qt/debugqtdeviceswindow.c
+++ b/src/osd/modules/debugger/qt/debugqtdeviceswindow.c
@@ -1,6 +1,7 @@
#define NO_MEM_TRACKING
#include "debugqtdeviceswindow.h"
+#include "debugqtdeviceinformationwindow.h"
DevicesWindowModel::DevicesWindowModel(running_machine *machine, QObject *parent)
{
@@ -18,8 +19,8 @@ QVariant DevicesWindowModel::data(const QModelIndex &index, int role) const
device_t *dev = static_cast<device_t *>(index.internalPointer());
switch(index.column()) {
- case 0: return QString(dev->basetag()); break;
- case 1: return QString(dev->name()); break;
+ case 0: return dev == &m_machine->root_device() ? QString("<root>") : QString(dev->basetag());
+ case 1: return QString(dev->name());
}
return QVariant();
@@ -108,6 +109,8 @@ DevicesWindow::DevicesWindow(running_machine* machine, QWidget* parent) :
WindowQt(machine, NULL),
m_devices_model(machine)
{
+ m_selected_device = NULL;
+
setWindowTitle("Debug: All Devices");
if (parent != NULL)
@@ -123,6 +126,8 @@ DevicesWindow::DevicesWindow(running_machine* machine, QWidget* parent) :
m_devices_view->setModel(&m_devices_model);
m_devices_view->expandAll();
m_devices_view->resizeColumnToContents(0);
+ connect(m_devices_view->selectionModel(), SIGNAL(currentRowChanged(const QModelIndex &,const QModelIndex &)), this, SLOT(currentRowChanged(const QModelIndex &,const QModelIndex &)));
+ connect(m_devices_view, SIGNAL(activated(const QModelIndex &)), this, SLOT(activated(const QModelIndex &)));
setCentralWidget(m_devices_view);
}
@@ -132,6 +137,19 @@ DevicesWindow::~DevicesWindow()
}
+void DevicesWindow::currentRowChanged(const QModelIndex &current, const QModelIndex &previous)
+{
+ m_selected_device = static_cast<device_t *>(current.internalPointer());
+}
+
+
+void DevicesWindow::activated(const QModelIndex &index)
+{
+ device_t *dev = static_cast<device_t *>(index.internalPointer());
+ (new DeviceInformationWindow(m_machine, dev, this))->show();
+}
+
+
//=========================================================================
// DevicesWindowQtConfig
diff --git a/src/osd/modules/debugger/qt/debugqtdeviceswindow.h b/src/osd/modules/debugger/qt/debugqtdeviceswindow.h
index de3645d5517..833d8d80aca 100644
--- a/src/osd/modules/debugger/qt/debugqtdeviceswindow.h
+++ b/src/osd/modules/debugger/qt/debugqtdeviceswindow.h
@@ -43,9 +43,14 @@ public:
DevicesWindow(running_machine* machine, QWidget* parent=NULL);
virtual ~DevicesWindow();
+public slots:
+ void currentRowChanged(const QModelIndex &current, const QModelIndex &previous);
+ void activated(const QModelIndex &index);
+
private:
QTreeView *m_devices_view;
DevicesWindowModel m_devices_model;
+ device_t *m_selected_device;
};