diff options
Diffstat (limited to 'src/emu/debug')
-rw-r--r-- | src/emu/debug/debugcmd.cpp | 5 | ||||
-rw-r--r-- | src/emu/debug/debugcpu.cpp | 21 | ||||
-rw-r--r-- | src/emu/debug/debugvw.cpp | 29 | ||||
-rw-r--r-- | src/emu/debug/debugvw.h | 2 | ||||
-rw-r--r-- | src/emu/debug/dvdisasm.cpp | 10 | ||||
-rw-r--r-- | src/emu/debug/dvstate.cpp | 18 | ||||
-rw-r--r-- | src/emu/debug/textbuf.cpp | 6 |
7 files changed, 44 insertions, 47 deletions
diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index 4558413b2c3..7ad039806ea 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -2381,11 +2381,12 @@ static void execute_find(running_machine &machine, int ref, int params, const ch for (int i = 2; i < params; i++) { const char *pdata = param[i]; + size_t pdatalen = strlen(pdata) - 1; /* check for a string */ - if (pdata[0] == '"' && pdata[strlen(pdata) - 1] == '"') + if (pdata[0] == '"' && pdata[pdatalen] == '"') { - for (j = 1; j < strlen(pdata) - 1; j++) + for (j = 1; j < pdatalen; j++) { data_to_find[data_count] = pdata[j]; data_size[data_count++] = 1; diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp index 82c175251fe..c4686c5566f 100644 --- a/src/emu/debug/debugcpu.cpp +++ b/src/emu/debug/debugcpu.cpp @@ -19,6 +19,7 @@ #include "uiinput.h" #include "xmlfile.h" #include "coreutil.h" +#include "luaengine.h" #include <ctype.h> @@ -486,7 +487,7 @@ UINT16 debug_read_word(address_space &space, offs_t address, int apply_translati address &= space.logbytemask(); /* if this is misaligned read, or if there are no word readers, just read two bytes */ - if ((address & 1) != 0) + if (!WORD_ALIGNED(address)) { UINT8 byte0 = debug_read_byte(space, address + 0, apply_translation); UINT8 byte1 = debug_read_byte(space, address + 1, apply_translation); @@ -540,7 +541,7 @@ UINT32 debug_read_dword(address_space &space, offs_t address, int apply_translat address &= space.logbytemask(); /* if this is misaligned read, or if there are no dword readers, just read two words */ - if ((address & 3) != 0) + if (!DWORD_ALIGNED(address)) { UINT16 word0 = debug_read_word(space, address + 0, apply_translation); UINT16 word1 = debug_read_word(space, address + 2, apply_translation); @@ -594,7 +595,7 @@ UINT64 debug_read_qword(address_space &space, offs_t address, int apply_translat address &= space.logbytemask(); /* if this is misaligned read, or if there are no qword readers, just read two dwords */ - if ((address & 7) != 0) + if (!QWORD_ALIGNED(address)) { UINT32 dword0 = debug_read_dword(space, address + 0, apply_translation); UINT32 dword1 = debug_read_dword(space, address + 4, apply_translation); @@ -699,7 +700,7 @@ void debug_write_word(address_space &space, offs_t address, UINT16 data, int app address &= space.logbytemask(); /* if this is a misaligned write, or if there are no word writers, just read two bytes */ - if ((address & 1) != 0) + if (!WORD_ALIGNED(address)) { if (space.endianness() == ENDIANNESS_LITTLE) { @@ -751,7 +752,7 @@ void debug_write_dword(address_space &space, offs_t address, UINT32 data, int ap address &= space.logbytemask(); /* if this is a misaligned write, or if there are no dword writers, just read two words */ - if ((address & 3) != 0) + if (!DWORD_ALIGNED(address)) { if (space.endianness() == ENDIANNESS_LITTLE) { @@ -803,7 +804,7 @@ void debug_write_qword(address_space &space, offs_t address, UINT64 data, int ap address &= space.logbytemask(); /* if this is a misaligned write, or if there are no qword writers, just read two dwords */ - if ((address & 7) != 0) + if (!QWORD_ALIGNED(address)) { if (space.endianness() == ENDIANNESS_LITTLE) { @@ -966,7 +967,7 @@ UINT64 debug_read_opcode(address_space &space, offs_t address, int size) case 2: result = space.direct().read_word(address & ~1, addrxor); - if ((address & 1) != 0) + if (!WORD_ALIGNED(address)) { result2 = space.direct().read_word((address & ~1) + 2, addrxor); if (space.endianness() == ENDIANNESS_LITTLE) @@ -979,7 +980,7 @@ UINT64 debug_read_opcode(address_space &space, offs_t address, int size) case 4: result = space.direct().read_dword(address & ~3, addrxor); - if ((address & 3) != 0) + if (!DWORD_ALIGNED(address)) { result2 = space.direct().read_dword((address & ~3) + 4, addrxor); if (space.endianness() == ENDIANNESS_LITTLE) @@ -992,7 +993,7 @@ UINT64 debug_read_opcode(address_space &space, offs_t address, int size) case 8: result = space.direct().read_qword(address & ~7, addrxor); - if ((address & 7) != 0) + if (!QWORD_ALIGNED(address)) { result2 = space.direct().read_qword((address & ~7) + 8, addrxor); if (space.endianness() == ENDIANNESS_LITTLE) @@ -1928,6 +1929,8 @@ void device_debug::instruction_hook(offs_t curpc) // flush any pending updates before waiting again machine.debug_view().flush_osd_updates(); + machine.manager().lua()->periodic_check(); + // clear the memory modified flag and wait global->memory_modified = false; if (machine.debug_flags & DEBUG_FLAG_OSD_ENABLED) diff --git a/src/emu/debug/debugvw.cpp b/src/emu/debug/debugvw.cpp index eea867f3a63..641a31b41f0 100644 --- a/src/emu/debug/debugvw.cpp +++ b/src/emu/debug/debugvw.cpp @@ -33,13 +33,8 @@ debug_view_source::debug_view_source(const char *name, device_t *device) : m_next(nullptr), m_name(name), - m_device(device), - m_is_octal(false) + m_device(device) { - device_execute_interface *intf; - if (device && device->interface(intf)) - m_is_octal = intf->is_octal(); - } @@ -331,7 +326,7 @@ debug_view_manager::~debug_view_manager() { debug_view *oldhead = m_viewlist; m_viewlist = oldhead->m_next; - auto_free(machine(), oldhead); + global_free(oldhead); } } @@ -345,31 +340,31 @@ debug_view *debug_view_manager::alloc_view(debug_view_type type, debug_view_osd_ switch (type) { case DVT_CONSOLE: - return append(auto_alloc(machine(), debug_view_console(machine(), osdupdate, osdprivate))); + return append(global_alloc(debug_view_console(machine(), osdupdate, osdprivate))); case DVT_STATE: - return append(auto_alloc(machine(), debug_view_state(machine(), osdupdate, osdprivate))); + return append(global_alloc(debug_view_state(machine(), osdupdate, osdprivate))); case DVT_DISASSEMBLY: - return append(auto_alloc(machine(), debug_view_disasm(machine(), osdupdate, osdprivate))); + return append(global_alloc(debug_view_disasm(machine(), osdupdate, osdprivate))); case DVT_MEMORY: - return append(auto_alloc(machine(), debug_view_memory(machine(), osdupdate, osdprivate))); + return append(global_alloc(debug_view_memory(machine(), osdupdate, osdprivate))); case DVT_LOG: - return append(auto_alloc(machine(), debug_view_log(machine(), osdupdate, osdprivate))); + return append(global_alloc(debug_view_log(machine(), osdupdate, osdprivate))); case DVT_TIMERS: -// return append(auto_alloc(machine(), debug_view_timers(machine(), osdupdate, osdprivate))); +// return append(global_alloc(debug_view_timers(machine(), osdupdate, osdprivate))); case DVT_ALLOCS: -// return append(auto_alloc(machine(), debug_view_allocs(machine(), osdupdate, osdprivate))); +// return append(global_alloc(debug_view_allocs(machine(), osdupdate, osdprivate))); case DVT_BREAK_POINTS: - return append(auto_alloc(machine(), debug_view_breakpoints(machine(), osdupdate, osdprivate))); + return append(global_alloc(debug_view_breakpoints(machine(), osdupdate, osdprivate))); case DVT_WATCH_POINTS: - return append(auto_alloc(machine(), debug_view_watchpoints(machine(), osdupdate, osdprivate))); + return append(global_alloc(debug_view_watchpoints(machine(), osdupdate, osdprivate))); default: fatalerror("Attempt to create invalid debug view type %d\n", type); @@ -389,7 +384,7 @@ void debug_view_manager::free_view(debug_view &view) if (*viewptr == &view) { *viewptr = view.m_next; - auto_free(machine(), &view); + global_free(&view); break; } } diff --git a/src/emu/debug/debugvw.h b/src/emu/debug/debugvw.h index 437e68d68f6..ab4c986172e 100644 --- a/src/emu/debug/debugvw.h +++ b/src/emu/debug/debugvw.h @@ -124,14 +124,12 @@ public: const char *name() const { return m_name.c_str(); } debug_view_source *next() const { return m_next; } device_t *device() const { return m_device; } - bool is_octal() const { return m_is_octal; } private: // internal state debug_view_source * m_next; // link to next item std::string m_name; // name of the source item device_t * m_device; // associated device (if applicable) - bool m_is_octal; // is view in octal or hex }; diff --git a/src/emu/debug/dvdisasm.cpp b/src/emu/debug/dvdisasm.cpp index e8becd1954d..9b05345b6ff 100644 --- a/src/emu/debug/dvdisasm.cpp +++ b/src/emu/debug/dvdisasm.cpp @@ -308,16 +308,16 @@ offs_t debug_view_disasm::find_pc_backwards(offs_t targetpc, int numinstrs) void debug_view_disasm::generate_bytes(offs_t pcbyte, int numbytes, int minbytes, char *string, int maxchars, bool encrypted) { const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source); - int char_num = source.is_octal() ? 3 : 2; + int char_num = source.m_space.is_octal() ? 3 : 2; // output the first value int offset = 0; if (maxchars >= char_num * minbytes) - offset = sprintf(string, "%s", core_i64_format(debug_read_opcode(source.m_decrypted_space, pcbyte, minbytes), minbytes * char_num, source.is_octal())); + offset = sprintf(string, "%s", core_i64_format(debug_read_opcode(source.m_decrypted_space, pcbyte, minbytes), minbytes * char_num, source.m_space.is_octal())); // output subsequent values int byte; for (byte = minbytes; byte < numbytes && offset + 1 + char_num * minbytes < maxchars; byte += minbytes) - offset += sprintf(&string[offset], " %s", core_i64_format(debug_read_opcode(encrypted ? source.m_space : source.m_decrypted_space, pcbyte + byte, minbytes), minbytes * char_num, source.is_octal())); + offset += sprintf(&string[offset], " %s", core_i64_format(debug_read_opcode(encrypted ? source.m_space : source.m_decrypted_space, pcbyte + byte, minbytes), minbytes * char_num, source.m_space.is_octal())); // if we ran out of room, indicate more string[maxchars - 1] = 0; @@ -335,7 +335,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) { bool changed = false; const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source); - int char_num = source.is_octal() ? 3 : 2; + int char_num = source.m_space.is_octal() ? 3 : 2; // determine how many characters we need for an address and set the divider m_divider1 = 1 + (source.m_space.logaddrchars()/2*char_num) + 1; @@ -383,7 +383,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) // convert back and set the address of this instruction m_byteaddress[instr] = pcbyte; - sprintf(&destbuf[0], " %s ", core_i64_format(source.m_space.byte_to_address(pcbyte), source.m_space.logaddrchars()/2*char_num, source.is_octal())); + sprintf(&destbuf[0], " %s ", core_i64_format(source.m_space.byte_to_address(pcbyte), source.m_space.logaddrchars()/2*char_num, source.m_space.is_octal())); // make sure we can translate the address, and then disassemble the result char buffer[100]; diff --git a/src/emu/debug/dvstate.cpp b/src/emu/debug/dvstate.cpp index 578b423725d..d0d741ed21e 100644 --- a/src/emu/debug/dvstate.cpp +++ b/src/emu/debug/dvstate.cpp @@ -98,7 +98,7 @@ void debug_view_state::reset() { state_item *oldhead = m_state_list; m_state_list = oldhead->m_next; - auto_free(machine(), oldhead); + global_free(oldhead); } } @@ -117,39 +117,39 @@ void debug_view_state::recompute() // add a cycles entry: cycles:99999999 state_item **tailptr = &m_state_list; - *tailptr = auto_alloc(machine(), state_item(REG_CYCLES, "cycles", 8)); + *tailptr = global_alloc(state_item(REG_CYCLES, "cycles", 8)); tailptr = &(*tailptr)->m_next; // add a beam entry: beamx:1234 - *tailptr = auto_alloc(machine(), state_item(REG_BEAMX, "beamx", 4)); + *tailptr = global_alloc(state_item(REG_BEAMX, "beamx", 4)); tailptr = &(*tailptr)->m_next; // add a beam entry: beamy:5678 - *tailptr = auto_alloc(machine(), state_item(REG_BEAMY, "beamy", 4)); + *tailptr = global_alloc(state_item(REG_BEAMY, "beamy", 4)); tailptr = &(*tailptr)->m_next; // add a beam entry: frame:123456 - *tailptr = auto_alloc(machine(), state_item(REG_FRAME, "frame", 6)); + *tailptr = global_alloc(state_item(REG_FRAME, "frame", 6)); tailptr = &(*tailptr)->m_next; // add a flags entry: flags:xxxxxxxx - *tailptr = auto_alloc(machine(), state_item(STATE_GENFLAGS, "flags", source.m_stateintf->state_string_max_length(STATE_GENFLAGS))); + *tailptr = global_alloc(state_item(STATE_GENFLAGS, "flags", source.m_stateintf->state_string_max_length(STATE_GENFLAGS))); tailptr = &(*tailptr)->m_next; // add a divider entry - *tailptr = auto_alloc(machine(), state_item(REG_DIVIDER, "", 0)); + *tailptr = global_alloc(state_item(REG_DIVIDER, "", 0)); tailptr = &(*tailptr)->m_next; // add all registers into it for (const device_state_entry *entry = source.m_stateintf->state_first(); entry != nullptr; entry = entry->next()) if (entry->divider()) { - *tailptr = auto_alloc(machine(), state_item(REG_DIVIDER, "", 0)); + *tailptr = global_alloc(state_item(REG_DIVIDER, "", 0)); tailptr = &(*tailptr)->m_next; } else if (entry->visible()) { - *tailptr = auto_alloc(machine(), state_item(entry->index(), entry->symbol(), source.m_stateintf->state_string_max_length(entry->index()))); + *tailptr = global_alloc(state_item(entry->index(), entry->symbol(), source.m_stateintf->state_string_max_length(entry->index()))); tailptr = &(*tailptr)->m_next; } diff --git a/src/emu/debug/textbuf.cpp b/src/emu/debug/textbuf.cpp index e7daf96571a..476fe6e1efc 100644 --- a/src/emu/debug/textbuf.cpp +++ b/src/emu/debug/textbuf.cpp @@ -86,12 +86,12 @@ text_buffer *text_buffer_alloc(UINT32 bytes, UINT32 lines) text_buffer *text; /* allocate memory for the text buffer object */ - text = (text_buffer *)global_alloc(text_buffer); + text = global_alloc_nothrow(text_buffer); if (!text) return nullptr; /* allocate memory for the buffer itself */ - text->buffer = (char *)global_alloc_array(char, bytes); + text->buffer = global_alloc_array_nothrow(char, bytes); if (!text->buffer) { global_free(text); @@ -99,7 +99,7 @@ text_buffer *text_buffer_alloc(UINT32 bytes, UINT32 lines) } /* allocate memory for the lines array */ - text->lineoffs = (INT32 *)global_alloc_array(INT32, lines); + text->lineoffs = global_alloc_array_nothrow(INT32, lines); if (!text->lineoffs) { global_free_array(text->buffer); |