trunk/src/osd/sdl/debugqtbreakpointswindow.c
| r0 | r23501 | |
| 1 | #define NO_MEM_TRACKING |
| 2 | |
| 3 | #include "debugqtbreakpointswindow.h" |
| 4 | |
| 5 | #include "debug/debugcon.h" |
| 6 | #include "debug/debugcpu.h" |
| 7 | #include "debug/dvdisasm.h" |
| 8 | |
| 9 | |
| 10 | BreakpointsWindow::BreakpointsWindow(running_machine* machine, QWidget* parent) : |
| 11 | WindowQt(machine, NULL) |
| 12 | { |
| 13 | setWindowTitle("Debug: Machine Breakpoints"); |
| 14 | |
| 15 | if (parent != NULL) |
| 16 | { |
| 17 | QPoint parentPos = parent->pos(); |
| 18 | setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400); |
| 19 | } |
| 20 | |
| 21 | // |
| 22 | // The main frame and its input and breakpoints widgets |
| 23 | // |
| 24 | QFrame* mainWindowFrame = new QFrame(this); |
| 25 | |
| 26 | // The main breakpoints view |
| 27 | m_breakpointsView = new DebuggerView(DVT_BREAK_POINTS, m_machine, this); |
| 28 | |
| 29 | // Layout |
| 30 | QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame); |
| 31 | vLayout->setSpacing(3); |
| 32 | vLayout->setContentsMargins(2,2,2,2); |
| 33 | vLayout->addWidget(m_breakpointsView); |
| 34 | |
| 35 | setCentralWidget(mainWindowFrame); |
| 36 | } |
| 37 | |
| 38 | |
| 39 | BreakpointsWindow::~BreakpointsWindow() |
| 40 | { |
| 41 | } |
| 42 | |
| 43 | |
| 44 | //========================================================================= |
| 45 | // BreakpointsWindowQtConfig |
| 46 | //========================================================================= |
| 47 | void BreakpointsWindowQtConfig::buildFromQWidget(QWidget* widget) |
| 48 | { |
| 49 | WindowQtConfig::buildFromQWidget(widget); |
| 50 | } |
| 51 | |
| 52 | |
| 53 | void BreakpointsWindowQtConfig::applyToQWidget(QWidget* widget) |
| 54 | { |
| 55 | WindowQtConfig::applyToQWidget(widget); |
| 56 | } |
| 57 | |
| 58 | |
| 59 | void BreakpointsWindowQtConfig::addToXmlDataNode(xml_data_node* node) const |
| 60 | { |
| 61 | WindowQtConfig::addToXmlDataNode(node); |
| 62 | } |
| 63 | |
| 64 | |
| 65 | void BreakpointsWindowQtConfig::recoverFromXmlNode(xml_data_node* node) |
| 66 | { |
| 67 | WindowQtConfig::recoverFromXmlNode(node); |
| 68 | } |
trunk/src/osd/sdl/debugqt.c
| r23500 | r23501 | |
| 33 | 33 | #include "debugqtmainwindow.h" |
| 34 | 34 | #include "debugqtdasmwindow.h" |
| 35 | 35 | #include "debugqtmemorywindow.h" |
| 36 | #include "debugqtbreakpointswindow.h" |
| 36 | 37 | |
| 37 | 38 | |
| 38 | 39 | //============================================================ |
| r23500 | r23501 | |
| 75 | 76 | WindowQtConfig::WindowType type = (WindowQtConfig::WindowType)xml_get_attribute_int(wnode, "type", WindowQtConfig::WIN_TYPE_UNKNOWN); |
| 76 | 77 | switch (type) |
| 77 | 78 | { |
| 78 | | case WindowQtConfig::WIN_TYPE_MAIN: xmlConfigurations.push_back(new MainWindowQtConfig()); break; |
| 79 | | case WindowQtConfig::WIN_TYPE_MEMORY: xmlConfigurations.push_back(new MemoryWindowQtConfig()); break; |
| 80 | | case WindowQtConfig::WIN_TYPE_DASM: xmlConfigurations.push_back(new DasmWindowQtConfig()); break; |
| 81 | | case WindowQtConfig::WIN_TYPE_LOG: xmlConfigurations.push_back(new LogWindowQtConfig()); break; |
| 79 | case WindowQtConfig::WIN_TYPE_MAIN: xmlConfigurations.push_back(new MainWindowQtConfig()); break; |
| 80 | case WindowQtConfig::WIN_TYPE_MEMORY: xmlConfigurations.push_back(new MemoryWindowQtConfig()); break; |
| 81 | case WindowQtConfig::WIN_TYPE_DASM: xmlConfigurations.push_back(new DasmWindowQtConfig()); break; |
| 82 | case WindowQtConfig::WIN_TYPE_LOG: xmlConfigurations.push_back(new LogWindowQtConfig()); break; |
| 83 | case WindowQtConfig::WIN_TYPE_BREAK_POINTS: xmlConfigurations.push_back(new BreakpointsWindowQtConfig()); break; |
| 82 | 84 | default: continue; |
| 83 | 85 | } |
| 84 | 86 | xmlConfigurations.back()->recoverFromXmlNode(wnode); |
| r23500 | r23501 | |
| 132 | 134 | xmlConfigurations.push_back(new DasmWindowQtConfig()); |
| 133 | 135 | else if (dynamic_cast<LogWindow*>(widget)) |
| 134 | 136 | xmlConfigurations.push_back(new LogWindowQtConfig()); |
| 137 | else if (dynamic_cast<BreakpointsWindow*>(widget)) |
| 138 | xmlConfigurations.push_back(new BreakpointsWindowQtConfig()); |
| 135 | 139 | |
| 136 | 140 | xmlConfigurations.back()->buildFromQWidget(widget); |
| 137 | 141 | } |
| r23500 | r23501 | |
| 172 | 176 | foo = new DasmWindow(&machine); break; |
| 173 | 177 | case WindowQtConfig::WIN_TYPE_LOG: |
| 174 | 178 | foo = new LogWindow(&machine); break; |
| 179 | case WindowQtConfig::WIN_TYPE_BREAK_POINTS: |
| 180 | foo = new BreakpointsWindow(&machine); break; |
| 175 | 181 | default: break; |
| 176 | 182 | } |
| 177 | 183 | config->applyToQWidget(foo); |
trunk/src/osd/sdl/debugqtwindow.c
| r23500 | r23501 | |
| 4 | 4 | #include "debugqtlogwindow.h" |
| 5 | 5 | #include "debugqtdasmwindow.h" |
| 6 | 6 | #include "debugqtmemorywindow.h" |
| 7 | #include "debugqtbreakpointswindow.h" |
| 7 | 8 | |
| 8 | 9 | bool WindowQt::s_refreshAll = false; |
| 9 | 10 | bool WindowQt::s_hideAll = false; |
| r23500 | r23501 | |
| 33 | 34 | debugActOpenLog->setShortcut(QKeySequence("Ctrl+L")); |
| 34 | 35 | connect(debugActOpenLog, SIGNAL(triggered()), this, SLOT(debugActOpenLog())); |
| 35 | 36 | |
| 37 | QAction* debugActOpenPoints = new QAction("New &Breakpoints Window", this); |
| 38 | debugActOpenPoints->setShortcut(QKeySequence("Ctrl+B")); |
| 39 | connect(debugActOpenPoints, SIGNAL(triggered()), this, SLOT(debugActOpenPoints())); |
| 40 | |
| 36 | 41 | QAction* dbgActRun = new QAction("Run", this); |
| 37 | 42 | dbgActRun->setShortcut(Qt::Key_F5); |
| 38 | 43 | connect(dbgActRun, SIGNAL(triggered()), this, SLOT(debugActRun())); |
| r23500 | r23501 | |
| 86 | 91 | debugMenu->addAction(debugActOpenMemory); |
| 87 | 92 | debugMenu->addAction(debugActOpenDasm); |
| 88 | 93 | debugMenu->addAction(debugActOpenLog); |
| 94 | debugMenu->addAction(debugActOpenPoints); |
| 89 | 95 | debugMenu->addSeparator(); |
| 90 | 96 | debugMenu->addAction(dbgActRun); |
| 91 | 97 | debugMenu->addAction(dbgActRunAndHide); |
| r23500 | r23501 | |
| 139 | 145 | } |
| 140 | 146 | |
| 141 | 147 | |
| 148 | void WindowQt::debugActOpenPoints() |
| 149 | { |
| 150 | BreakpointsWindow* foo = new BreakpointsWindow(m_machine, this); |
| 151 | // A valiant effort, but it just doesn't wanna' hide behind the main window & not make a new toolbar icon |
| 152 | // foo->setWindowFlags(Qt::Dialog); |
| 153 | // foo->setWindowFlags(foo->windowFlags() & ~Qt::WindowStaysOnTopHint); |
| 154 | foo->show(); |
| 155 | } |
| 156 | |
| 157 | |
| 142 | 158 | void WindowQt::debugActRun() |
| 143 | 159 | { |
| 144 | 160 | debug_cpu_get_visible_cpu(*m_machine)->debug()->go(); |
trunk/src/emu/debug/dvbpoints.c
| r0 | r23501 | |
| 1 | /********************************************************************* |
| 2 | |
| 3 | dvpoints.c |
| 4 | |
| 5 | Breakpoint debugger view. |
| 6 | |
| 7 | **************************************************************************** |
| 8 | |
| 9 | Copyright Aaron Giles |
| 10 | All rights reserved. |
| 11 | |
| 12 | Redistribution and use in source and binary forms, with or without |
| 13 | modification, are permitted provided that the following conditions are |
| 14 | met: |
| 15 | |
| 16 | * Redistributions of source code must retain the above copyright |
| 17 | notice, this list of conditions and the following disclaimer. |
| 18 | * Redistributions in binary form must reproduce the above copyright |
| 19 | notice, this list of conditions and the following disclaimer in |
| 20 | the documentation and/or other materials provided with the |
| 21 | distribution. |
| 22 | * Neither the name 'MAME' nor the names of its contributors may be |
| 23 | used to endorse or promote products derived from this software |
| 24 | without specific prior written permission. |
| 25 | |
| 26 | THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR |
| 27 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 29 | DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT, |
| 30 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 32 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 33 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 34 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 35 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 36 | POSSIBILITY OF SUCH DAMAGE. |
| 37 | |
| 38 | ***************************************************************************/ |
| 39 | |
| 40 | #include "emu.h" |
| 41 | #include "debugvw.h" |
| 42 | #include "dvbpoints.h" |
| 43 | #include "debugcpu.h" |
| 44 | |
| 45 | |
| 46 | |
| 47 | //************************************************************************** |
| 48 | // DEBUG VIEW BREAK POINTS |
| 49 | //************************************************************************** |
| 50 | |
| 51 | //------------------------------------------------- |
| 52 | // debug_view_breakpoints - constructor |
| 53 | //------------------------------------------------- |
| 54 | |
| 55 | debug_view_breakpoints::debug_view_breakpoints(running_machine &machine, debug_view_osd_update_func osdupdate, void *osdprivate) |
| 56 | : debug_view(machine, DVT_BREAK_POINTS, osdupdate, osdprivate) |
| 57 | { |
| 58 | // fail if no available sources |
| 59 | enumerate_sources(); |
| 60 | if (m_source_list.count() == 0) |
| 61 | throw std::bad_alloc(); |
| 62 | |
| 63 | // configure the view |
| 64 | m_total.y = 50; // TODO |
| 65 | m_supports_cursor = true; |
| 66 | } |
| 67 | |
| 68 | |
| 69 | //------------------------------------------------- |
| 70 | // ~debug_view_breakpoints - destructor |
| 71 | //------------------------------------------------- |
| 72 | |
| 73 | debug_view_breakpoints::~debug_view_breakpoints() |
| 74 | { |
| 75 | } |
| 76 | |
| 77 | |
| 78 | //------------------------------------------------- |
| 79 | // enumerate_sources - enumerate all possible |
| 80 | // sources for a disassembly view |
| 81 | //------------------------------------------------- |
| 82 | |
| 83 | void debug_view_breakpoints::enumerate_sources() |
| 84 | { |
| 85 | // start with an empty list |
| 86 | m_source_list.reset(); |
| 87 | |
| 88 | // iterate over devices with disassembly interfaces |
| 89 | disasm_interface_iterator iter(machine().root_device()); |
| 90 | for (device_disasm_interface *dasm = iter.first(); dasm != NULL; dasm = iter.next()) |
| 91 | { |
| 92 | astring name; |
| 93 | name.printf("%s '%s'", dasm->device().name(), dasm->device().tag()); |
| 94 | m_source_list.append(*auto_alloc(machine(), debug_view_source(name.cstr(), &dasm->device()))); |
| 95 | } |
| 96 | |
| 97 | // reset the source to a known good entry |
| 98 | set_source(*m_source_list.head()); |
| 99 | } |
| 100 | |
| 101 | |
| 102 | //------------------------------------------------- |
| 103 | // view_notify - handle notification of updates |
| 104 | // to cursor changes |
| 105 | //------------------------------------------------- |
| 106 | |
| 107 | void debug_view_breakpoints::view_notify(debug_view_notification type) |
| 108 | { |
| 109 | } |
| 110 | |
| 111 | |
| 112 | //------------------------------------------------- |
| 113 | // view_char - handle a character typed within |
| 114 | // the current view |
| 115 | //------------------------------------------------- |
| 116 | |
| 117 | void debug_view_breakpoints::view_char(int chval) |
| 118 | { |
| 119 | } |
| 120 | |
| 121 | |
| 122 | //------------------------------------------------- |
| 123 | // view_click - handle a mouse click within the |
| 124 | // current view |
| 125 | //------------------------------------------------- |
| 126 | |
| 127 | void debug_view_breakpoints::view_click(const int button, const debug_view_xy& pos) |
| 128 | { |
| 129 | } |
| 130 | |
| 131 | |
| 132 | void debug_view_breakpoints::pad_astring_to_length(astring& str, int len) |
| 133 | { |
| 134 | int diff = len - str.len(); |
| 135 | if (diff > 0) |
| 136 | { |
| 137 | astring buffer; |
| 138 | buffer.expand(diff); |
| 139 | for (int i = 0; i < diff; i++) |
| 140 | buffer.catprintf(" "); |
| 141 | str.catprintf("%s", buffer.cstr()); |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | //------------------------------------------------- |
| 146 | // view_update - update the contents of the |
| 147 | // disassembly view |
| 148 | //------------------------------------------------- |
| 149 | |
| 150 | void debug_view_breakpoints::view_update() |
| 151 | { |
| 152 | const debug_view_source& source = *m_source; |
| 153 | const device_debug& debugInterface = *source.device()->debug(); |
| 154 | debug_view_char *dest = m_viewdata; |
| 155 | |
| 156 | // Gather a list of all the breakpoints in reverse order |
| 157 | int numBPs = 0; |
| 158 | device_debug::breakpoint** bpList = NULL; |
| 159 | if (debugInterface.breakpoint_first() != NULL) |
| 160 | { |
| 161 | // Alloc |
| 162 | for (device_debug::breakpoint *bp = debugInterface.breakpoint_first(); bp != NULL; bp = bp->next()) |
| 163 | numBPs++; |
| 164 | bpList = new device_debug::breakpoint*[numBPs]; |
| 165 | |
| 166 | // Collect |
| 167 | int i = 1; |
| 168 | for (device_debug::breakpoint *bp = debugInterface.breakpoint_first(); bp != NULL; bp = bp->next()) |
| 169 | { |
| 170 | bpList[numBPs-i] = bp; |
| 171 | i++; |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | // Draw |
| 176 | for (int row = 0; row < m_visible.y; row++) |
| 177 | { |
| 178 | UINT32 effrow = m_topleft.y + row; |
| 179 | |
| 180 | // Header |
| 181 | if (effrow == 0) |
| 182 | { |
| 183 | astring header = "ID En Address Condition Action"; |
| 184 | for (int i = 0; i < m_visible.x; i++) |
| 185 | { |
| 186 | dest->byte = (i < header.len()) ? header[i] : ' '; |
| 187 | dest->attrib = DCA_ANCILLARY; |
| 188 | dest++; |
| 189 | } |
| 190 | continue; |
| 191 | } |
| 192 | |
| 193 | // Breakpoints |
| 194 | int bpi = effrow-1; |
| 195 | if (bpi < numBPs && bpi >= 0) |
| 196 | { |
| 197 | device_debug::breakpoint* bp = bpList[bpi]; |
| 198 | |
| 199 | astring buffer; |
| 200 | buffer.printf("%x", bp->index()); |
| 201 | pad_astring_to_length(buffer, 5); |
| 202 | buffer.catprintf("%c", bp->enabled() ? 'X' : 'O'); |
| 203 | pad_astring_to_length(buffer, 9); |
| 204 | buffer.catprintf("%s", core_i64_hex_format(bp->address(), debugInterface.logaddrchars())); |
| 205 | pad_astring_to_length(buffer, 26); |
| 206 | if (astring(bp->condition()) != astring("1")) |
| 207 | { |
| 208 | buffer.catprintf("%s", bp->condition()); |
| 209 | pad_astring_to_length(buffer, 44); |
| 210 | } |
| 211 | if (astring(bp->action()) != astring("")) |
| 212 | { |
| 213 | buffer.catprintf("%s", bp->action()); |
| 214 | pad_astring_to_length(buffer, 60); |
| 215 | } |
| 216 | |
| 217 | for (int i = 0; i < m_visible.x; i++) |
| 218 | { |
| 219 | dest->byte = (i < buffer.len()) ? buffer[i] : ' '; |
| 220 | dest->attrib = DCA_NORMAL; |
| 221 | dest++; |
| 222 | } |
| 223 | continue; |
| 224 | } |
| 225 | |
| 226 | // Fill the remaining vertical space |
| 227 | for (int i = 0; i < m_visible.x; i++) |
| 228 | { |
| 229 | dest->byte = ' '; |
| 230 | dest->attrib = DCA_NORMAL; |
| 231 | dest++; |
| 232 | } |
| 233 | } |
| 234 | |
| 235 | delete bpList; |
| 236 | } |
trunk/src/emu/debug/dvbpoints.h
| r0 | r23501 | |
| 1 | /********************************************************************* |
| 2 | |
| 3 | dvpoints.h |
| 4 | |
| 5 | Breakpoint debugger view. |
| 6 | |
| 7 | **************************************************************************** |
| 8 | |
| 9 | Copyright Aaron Giles |
| 10 | All rights reserved. |
| 11 | |
| 12 | Redistribution and use in source and binary forms, with or without |
| 13 | modification, are permitted provided that the following conditions are |
| 14 | met: |
| 15 | |
| 16 | * Redistributions of source code must retain the above copyright |
| 17 | notice, this list of conditions and the following disclaimer. |
| 18 | * Redistributions in binary form must reproduce the above copyright |
| 19 | notice, this list of conditions and the following disclaimer in |
| 20 | the documentation and/or other materials provided with the |
| 21 | distribution. |
| 22 | * Neither the name 'MAME' nor the names of its contributors may be |
| 23 | used to endorse or promote products derived from this software |
| 24 | without specific prior written permission. |
| 25 | |
| 26 | THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR |
| 27 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 28 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 29 | DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT, |
| 30 | INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 31 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 32 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 33 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 34 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
| 35 | IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 36 | POSSIBILITY OF SUCH DAMAGE. |
| 37 | |
| 38 | ***************************************************************************/ |
| 39 | |
| 40 | #ifndef __DVBPOINTS_H__ |
| 41 | #define __DVBPOINTS_H__ |
| 42 | |
| 43 | #include "debugvw.h" |
| 44 | |
| 45 | |
| 46 | //************************************************************************** |
| 47 | // CONSTANTS |
| 48 | //************************************************************************** |
| 49 | |
| 50 | |
| 51 | //************************************************************************** |
| 52 | // TYPE DEFINITIONS |
| 53 | //************************************************************************** |
| 54 | |
| 55 | // debug view for breakpoints |
| 56 | class debug_view_breakpoints : public debug_view |
| 57 | { |
| 58 | friend resource_pool_object<debug_view_breakpoints>::~resource_pool_object(); |
| 59 | friend class debug_view_manager; |
| 60 | |
| 61 | // construction/destruction |
| 62 | debug_view_breakpoints(running_machine &machine, debug_view_osd_update_func osdupdate, void *osdprivate); |
| 63 | virtual ~debug_view_breakpoints(); |
| 64 | |
| 65 | public: |
| 66 | // getters |
| 67 | // setters |
| 68 | |
| 69 | protected: |
| 70 | // view overrides |
| 71 | virtual void view_update(); |
| 72 | virtual void view_notify(debug_view_notification type); |
| 73 | virtual void view_char(int chval); |
| 74 | virtual void view_click(const int button, const debug_view_xy& pos); |
| 75 | |
| 76 | private: |
| 77 | // internal helpers |
| 78 | void enumerate_sources(); |
| 79 | bool recompute(offs_t pc, int startline, int lines); |
| 80 | void pad_astring_to_length(astring& str, int len); |
| 81 | |
| 82 | // internal state |
| 83 | }; |
| 84 | |
| 85 | |
| 86 | #endif |