void debug_view_breakpoints::view_update() { const debug_view_source& source = *m_source; const device_debug& debugInterface = *source.device()->debug(); debug_view_char *dest = m_viewdata; // Gather a list of all the breakpoints in reverse order int numBPs = 0; device_debug::breakpoint** bpList = NULL; if (debugInterface.breakpoint_first() != NULL) { // Alloc for (device_debug::breakpoint *bp = debugInterface.breakpoint_first(); bp != NULL; bp = bp->next()) numBPs++; bpList = new device_debug::breakpoint*[numBPs]; // Collect int i = 1; for (device_debug::breakpoint *bp = debugInterface.breakpoint_first(); bp != NULL; bp = bp->next()) { bpList[numBPs-i] = bp; i++; } } // Draw for (int row = 0; row < m_visible.y; row++) { UINT32 effrow = m_topleft.y + row; // Header if (effrow == 0) { astring header = "ID En Address Condition Action"; for (int i = 0; i < m_visible.x; i++) { dest->byte = (i < header.len()) ? header[i] : ' '; dest->attrib = DCA_ANCILLARY; dest++; } continue; } // Breakpoints int bpi = effrow-1; if (bpi < numBPs && bpi >= 0) { device_debug::breakpoint* bp = bpList[bpi]; astring buffer; buffer.printf("%x", bp->index()); pad_astring_to_length(buffer, 5); buffer.catprintf("%c", bp->enabled() ? 'X' : 'O'); pad_astring_to_length(buffer, 9); buffer.catprintf("%s", core_i64_hex_format(bp->address(), debugInterface.logaddrchars())); pad_astring_to_length(buffer, 26); if (astring(bp->condition()) != astring("1")) { buffer.catprintf("%s", bp->condition()); pad_astring_to_length(buffer, 44); } if (astring(bp->action()) != astring("")) { buffer.catprintf("%s", bp->action()); pad_astring_to_length(buffer, 60); } for (int i = 0; i < m_visible.x; i++) { dest->byte = (i < buffer.len()) ? buffer[i] : ' '; dest->attrib = DCA_NORMAL; dest++; } continue; } // Fill the remaining vertical space for (int i = 0; i < m_visible.x; i++) { dest->byte = ' '; dest->attrib = DCA_NORMAL; dest++; } } delete bpList; }
void debug_view_watchpoints::view_update() { // Gather a list of all the watchpoints for all the CPUs device_debug::watchpoint** wpList = NULL; const int numWPs = watchpoints(SORT_NONE, wpList); // Set the view region so the scroll bars update m_total.y = numWPs+1; // Draw debug_view_char *dest = m_viewdata; for (int row = 0; row < m_visible.y; row++) { UINT32 effrow = m_topleft.y + row; // Header if (row == 0) { astring header; header.printf("ID"); if (m_sortType == SORT_INDEX_ASCENDING) header.catprintf("\\"); else if (m_sortType == SORT_INDEX_DESCENDING) header.catprintf("/"); pad_astring_to_length(header, tableBreaks[0]); header.catprintf("En"); if (m_sortType == SORT_ENABLED_ASCENDING) header.catprintf("\\"); else if (m_sortType == SORT_ENABLED_DESCENDING) header.catprintf("/"); pad_astring_to_length(header, tableBreaks[1]); header.catprintf("CPU"); if (m_sortType == SORT_CPU_ASCENDING) header.catprintf("\\"); else if (m_sortType == SORT_CPU_DESCENDING) header.catprintf("/"); pad_astring_to_length(header, tableBreaks[2]); header.catprintf("Space"); if (m_sortType == SORT_SPACE_ASCENDING) header.catprintf("\\"); else if (m_sortType == SORT_SPACE_DESCENDING) header.catprintf("/"); pad_astring_to_length(header, tableBreaks[3]); header.catprintf("Addresses"); if (m_sortType == SORT_ADDRESS_ASCENDING) header.catprintf("\\"); else if (m_sortType == SORT_ADDRESS_DESCENDING) header.catprintf("/"); pad_astring_to_length(header, tableBreaks[4]); header.catprintf("Type"); if (m_sortType == SORT_TYPE_ASCENDING) header.catprintf("\\"); else if (m_sortType == SORT_TYPE_DESCENDING) header.catprintf("/"); pad_astring_to_length(header, tableBreaks[5]); header.catprintf("Condition"); if (m_sortType == SORT_CONDITION_ASCENDING) header.catprintf("\\"); else if (m_sortType == SORT_CONDITION_DESCENDING) header.catprintf("/"); pad_astring_to_length(header, tableBreaks[6]); header.catprintf("Action"); if (m_sortType == SORT_ACTION_ASCENDING) header.catprintf("\\"); else if (m_sortType == SORT_ACTION_DESCENDING) header.catprintf("/"); pad_astring_to_length(header, tableBreaks[7]); for (int i = 0; i < m_visible.x; i++) { dest->byte = (i < header.len()) ? header[i] : ' '; dest->attrib = DCA_ANCILLARY; dest++; } continue; } // watchpoints int wpi = effrow-1; if (wpi < numWPs && wpi >= 0) { static const char *const types[] = { "unkn ", "read ", "write", "r/w " }; device_debug::watchpoint* wp = wpList[wpi]; astring buffer; buffer.printf("%x", wp->index()); pad_astring_to_length(buffer, tableBreaks[0]); buffer.catprintf("%c", wp->enabled() ? 'X' : 'O'); pad_astring_to_length(buffer, tableBreaks[1]); buffer.catprintf("%s", wp->debugInterface()->device().tag()); pad_astring_to_length(buffer, tableBreaks[2]); buffer.catprintf("%s", wp->space().name()); pad_astring_to_length(buffer, tableBreaks[3]); buffer.catprintf("%s-%s", core_i64_hex_format(wp->space().byte_to_address(wp->address()), wp->space().addrchars()), core_i64_hex_format(wp->space().byte_to_address_end(wp->address() + wp->length()) - 1, wp->space().addrchars())); pad_astring_to_length(buffer, tableBreaks[4]); buffer.catprintf("%s", types[wp->type() & 3]); pad_astring_to_length(buffer, tableBreaks[5]); if (astring(wp->condition()) != astring("1")) { buffer.catprintf("%s", wp->condition()); pad_astring_to_length(buffer, tableBreaks[6]); } if (astring(wp->action()) != astring("")) { buffer.catprintf("%s", wp->action()); pad_astring_to_length(buffer, tableBreaks[7]); } for (int i = 0; i < m_visible.x; i++) { dest->byte = (i < buffer.len()) ? buffer[i] : ' '; dest->attrib = DCA_NORMAL; // Color disabled watchpoints red if (i == 5 && dest->byte == 'O') dest->attrib = DCA_CHANGED; dest++; } continue; } // Fill the remaining vertical space for (int i = 0; i < m_visible.x; i++) { dest->byte = ' '; dest->attrib = DCA_NORMAL; dest++; } } delete[] wpList; }
void debug_view_breakpoints::view_update() { // Gather a list of all the breakpoints for all the CPUs device_debug::breakpoint** bpList = NULL; const int numBPs = breakpoints(SORT_NONE, bpList); // Set the view region so the scroll bars update m_total.y = numBPs+1; // Draw debug_view_char *dest = m_viewdata; for (int row = 0; row < m_visible.y; row++) { UINT32 effrow = m_topleft.y + row; // Header if (row == 0) { astring header; header.printf("ID"); if (m_sortType == SORT_INDEX_ASCENDING) header.catprintf("\\"); else if (m_sortType == SORT_INDEX_DESCENDING) header.catprintf("/"); pad_astring_to_length(header, tableBreaks[0]); header.catprintf("En"); if (m_sortType == SORT_ENABLED_ASCENDING) header.catprintf("\\"); else if (m_sortType == SORT_ENABLED_DESCENDING) header.catprintf("/"); pad_astring_to_length(header, tableBreaks[1]); header.catprintf("CPU"); if (m_sortType == SORT_CPU_ASCENDING) header.catprintf("\\"); else if (m_sortType == SORT_CPU_DESCENDING) header.catprintf("/"); pad_astring_to_length(header, tableBreaks[2]); header.catprintf("Address"); if (m_sortType == SORT_ADDRESS_ASCENDING) header.catprintf("\\"); else if (m_sortType == SORT_ADDRESS_DESCENDING) header.catprintf("/"); pad_astring_to_length(header, tableBreaks[3]); header.catprintf("Condition"); if (m_sortType == SORT_CONDITION_ASCENDING) header.catprintf("\\"); else if (m_sortType == SORT_CONDITION_DESCENDING) header.catprintf("/"); pad_astring_to_length(header, tableBreaks[4]); header.catprintf("Action"); if (m_sortType == SORT_ACTION_ASCENDING) header.catprintf("\\"); else if (m_sortType == SORT_ACTION_DESCENDING) header.catprintf("/"); pad_astring_to_length(header, tableBreaks[5]); for (int i = 0; i < m_visible.x; i++) { dest->byte = (i < header.len()) ? header[i] : ' '; dest->attrib = DCA_ANCILLARY; dest++; } continue; } // Breakpoints int bpi = effrow-1; if (bpi < numBPs && bpi >= 0) { device_debug::breakpoint* bp = bpList[bpi]; astring buffer; buffer.printf("%x", bp->index()); pad_astring_to_length(buffer, tableBreaks[0]); buffer.catprintf("%c", bp->enabled() ? 'X' : 'O'); pad_astring_to_length(buffer, tableBreaks[1]); buffer.catprintf("%s", bp->debugInterface()->device().tag()); pad_astring_to_length(buffer, tableBreaks[2]); buffer.catprintf("%s", core_i64_hex_format(bp->address(), bp->debugInterface()->logaddrchars())); pad_astring_to_length(buffer, tableBreaks[3]); if (astring(bp->condition()) != astring("1")) { buffer.catprintf("%s", bp->condition()); pad_astring_to_length(buffer, tableBreaks[4]); } if (astring(bp->action()) != astring("")) { buffer.catprintf("%s", bp->action()); pad_astring_to_length(buffer, tableBreaks[5]); } for (int i = 0; i < m_visible.x; i++) { dest->byte = (i < buffer.len()) ? buffer[i] : ' '; dest->attrib = DCA_NORMAL; // Color disabled breakpoints red if (i == 5 && dest->byte == 'O') dest->attrib = DCA_CHANGED; dest++; } continue; } // Fill the remaining vertical space for (int i = 0; i < m_visible.x; i++) { dest->byte = ' '; dest->attrib = DCA_NORMAL; dest++; } } delete[] bpList; }
void debug_view_breakpoints::view_update() { // Gather a list of all the breakpoints for all the CPUs gather_breakpoints(); // Set the view region so the scroll bars update m_total.x = tableBreaks[ARRAY_LENGTH(tableBreaks) - 1]; m_total.y = m_buffer.size() + 1; if (m_total.y < 10) m_total.y = 10; // Draw debug_view_char *dest = &m_viewdata[0]; std::string linebuf; // Header if (m_visible.y > 0) { linebuf.clear(); linebuf.append("ID"); if (m_sortType == &cIndexAscending) linebuf.push_back('\\'); else if (m_sortType == &cIndexDescending) linebuf.push_back('/'); pad_astring_to_length(linebuf, tableBreaks[0]); linebuf.append("En"); if (m_sortType == &cEnabledAscending) linebuf.push_back('\\'); else if (m_sortType == &cEnabledDescending) linebuf.push_back('/'); pad_astring_to_length(linebuf, tableBreaks[1]); linebuf.append("CPU"); if (m_sortType == &cCpuAscending) linebuf.push_back('\\'); else if (m_sortType == &cCpuDescending) linebuf.push_back('/'); pad_astring_to_length(linebuf, tableBreaks[2]); linebuf.append("Address"); if (m_sortType == &cAddressAscending) linebuf.push_back('\\'); else if (m_sortType == &cAddressDescending) linebuf.push_back('/'); pad_astring_to_length(linebuf, tableBreaks[3]); linebuf.append("Condition"); if (m_sortType == &cConditionAscending) linebuf.push_back('\\'); else if (m_sortType == &cConditionDescending) linebuf.push_back('/'); pad_astring_to_length(linebuf, tableBreaks[4]); linebuf.append("Action"); if (m_sortType == &cActionAscending) linebuf.push_back('\\'); else if (m_sortType == &cActionDescending) linebuf.push_back('/'); pad_astring_to_length(linebuf, tableBreaks[5]); for (UINT32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) { dest->byte = (i < linebuf.length()) ? linebuf[i] : ' '; dest->attrib = DCA_ANCILLARY; } } for (int row = 1; row < m_visible.y; row++) { // Breakpoints int bpi = row + m_topleft.y - 1; if ((bpi < m_buffer.size()) && (bpi >= 0)) { device_debug::breakpoint *const bp = m_buffer[bpi]; linebuf.clear(); strcatprintf(linebuf, "%2X", bp->index()); pad_astring_to_length(linebuf, tableBreaks[0]); linebuf.push_back(bp->enabled() ? 'X' : 'O'); pad_astring_to_length(linebuf, tableBreaks[1]); linebuf.append(bp->debugInterface()->device().tag()); pad_astring_to_length(linebuf, tableBreaks[2]); linebuf.append(core_i64_hex_format(bp->address(), bp->debugInterface()->logaddrchars())); pad_astring_to_length(linebuf, tableBreaks[3]); if (strcmp(bp->condition(), "1")) linebuf.append(bp->condition()); pad_astring_to_length(linebuf, tableBreaks[4]); linebuf.append(bp->action()); pad_astring_to_length(linebuf, tableBreaks[5]); for (UINT32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) { dest->byte = (i < linebuf.length()) ? linebuf[i] : ' '; dest->attrib = DCA_NORMAL; // Color disabled breakpoints red if ((i >= tableBreaks[0]) && (i < tableBreaks[1]) && !bp->enabled()) dest->attrib |= DCA_CHANGED; } } else { // Fill the remaining vertical space for (UINT32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) { dest->byte = ' '; dest->attrib = DCA_NORMAL; } } } }
void debug_view_watchpoints::view_update() { // Gather a list of all the watchpoints for all the CPUs gather_watchpoints(); // Set the view region so the scroll bars update m_total.x = tableBreaks[ARRAY_LENGTH(tableBreaks) - 1]; m_total.y = m_buffer.size() + 1; if (m_total.y < 10) m_total.y = 10; // Draw debug_view_char *dest = &m_viewdata[0]; astring linebuf; // Header if (m_visible.y > 0) { linebuf.reset(); linebuf.cat("ID"); if (m_sortType == &cIndexAscending) linebuf.cat('\\'); else if (m_sortType == &cIndexDescending) linebuf.cat('/'); pad_astring_to_length(linebuf, tableBreaks[0]); linebuf.cat("En"); if (m_sortType == &cEnabledAscending) linebuf.cat('\\'); else if (m_sortType == &cEnabledDescending) linebuf.cat('/'); pad_astring_to_length(linebuf, tableBreaks[1]); linebuf.cat("CPU"); if (m_sortType == &cCpuAscending) linebuf.cat('\\'); else if (m_sortType == &cCpuDescending) linebuf.cat('/'); pad_astring_to_length(linebuf, tableBreaks[2]); linebuf.cat("Space"); if (m_sortType == &cSpaceAscending) linebuf.cat('\\'); else if (m_sortType == &cSpaceDescending) linebuf.cat('/'); pad_astring_to_length(linebuf, tableBreaks[3]); linebuf.cat("Addresses"); if (m_sortType == &cAddressAscending) linebuf.cat('\\'); else if (m_sortType == &cAddressDescending) linebuf.cat('/'); pad_astring_to_length(linebuf, tableBreaks[4]); linebuf.cat("Type"); if (m_sortType == &cTypeAscending) linebuf.cat('\\'); else if (m_sortType == &cTypeDescending) linebuf.cat('/'); pad_astring_to_length(linebuf, tableBreaks[5]); linebuf.cat("Condition"); if (m_sortType == &cConditionAscending) linebuf.cat('\\'); else if (m_sortType == &cConditionDescending) linebuf.cat('/'); pad_astring_to_length(linebuf, tableBreaks[6]); linebuf.cat("Action"); if (m_sortType == &cActionAscending) linebuf.cat('\\'); else if (m_sortType == &cActionDescending) linebuf.cat('/'); pad_astring_to_length(linebuf, tableBreaks[7]); for (UINT32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) { dest->byte = (i < linebuf.len()) ? linebuf[i] : ' '; dest->attrib = DCA_ANCILLARY; } } for (int row = 1; row < m_visible.y; row++) { // watchpoints int const wpi = row + m_topleft.y - 1; if ((wpi < m_buffer.size()) && wpi >= 0) { static char const *const types[] = { "unkn ", "read ", "write", "r/w " }; device_debug::watchpoint *const wp = m_buffer[wpi]; linebuf.reset(); linebuf.catprintf("%2X", wp->index()); pad_astring_to_length(linebuf, tableBreaks[0]); linebuf.cat(wp->enabled() ? 'X' : 'O'); pad_astring_to_length(linebuf, tableBreaks[1]); linebuf.cat(wp->debugInterface()->device().tag()); pad_astring_to_length(linebuf, tableBreaks[2]); linebuf.cat(wp->space().name()); pad_astring_to_length(linebuf, tableBreaks[3]); linebuf.cat(core_i64_hex_format(wp->space().byte_to_address(wp->address()), wp->space().addrchars())); linebuf.cat('-'); linebuf.cat(core_i64_hex_format(wp->space().byte_to_address_end(wp->address() + wp->length()) - 1, wp->space().addrchars())); pad_astring_to_length(linebuf, tableBreaks[4]); linebuf.cat(types[wp->type() & 3]); pad_astring_to_length(linebuf, tableBreaks[5]); if (strcmp(wp->condition(), "1")) linebuf.cat(wp->condition()); pad_astring_to_length(linebuf, tableBreaks[6]); linebuf.cat(wp->action()); pad_astring_to_length(linebuf, tableBreaks[7]); for (UINT32 i = m_topleft.x; i < (m_topleft.x + m_visible.x); i++, dest++) { dest->byte = (i < linebuf.len()) ? linebuf[i] : ' '; dest->attrib = DCA_NORMAL; // Color disabled watchpoints red if ((i >= tableBreaks[0]) && (i < tableBreaks[1]) && !wp->enabled()) dest->attrib |= DCA_CHANGED; } } else { // Fill the remaining vertical space for (int i = 0; i < m_visible.x; i++, dest++) { dest->byte = ' '; dest->attrib = DCA_NORMAL; } } } }