summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/debug
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/debug')
-rw-r--r--src/emu/debug/debugbuf.cpp2
-rw-r--r--src/emu/debug/debugcmd.cpp43
-rw-r--r--src/emu/debug/debugcmd.h18
-rw-r--r--src/emu/debug/debugcpu.cpp97
-rw-r--r--src/emu/debug/debugcpu.h22
-rw-r--r--src/emu/debug/debugvw.h2
-rw-r--r--src/emu/debug/dvdisasm.cpp12
-rw-r--r--src/emu/debug/dvdisasm.h1
-rw-r--r--src/emu/debug/express.cpp73
-rw-r--r--src/emu/debug/express.h13
10 files changed, 132 insertions, 151 deletions
diff --git a/src/emu/debug/debugbuf.cpp b/src/emu/debug/debugbuf.cpp
index 779b91f84ac..bd24f475340 100644
--- a/src/emu/debug/debugbuf.cpp
+++ b/src/emu/debug/debugbuf.cpp
@@ -176,7 +176,7 @@ void debug_disasm_buffer::debug_data_buffer::data_get(offs_t pc, offs_t size, st
void debug_disasm_buffer::debug_data_buffer::setup_methods()
{
address_space *space = m_space ? m_space : m_back->get_underlying_space();
- int shift = space->addrbus_shift();
+ int shift = space->addr_shift();
int alignment = m_intf->opcode_alignment();
endianness_t endian = space->endianness();
diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp
index 0c7715b523b..38bff17b8c4 100644
--- a/src/emu/debug/debugcmd.cpp
+++ b/src/emu/debug/debugcmd.cpp
@@ -100,15 +100,15 @@ debugger_commands::debugger_commands(running_machine& machine, debugger_cpu& cpu
, m_cpu(cpu)
, m_console(console)
{
- m_global_array = auto_alloc_array_clear(m_machine, global_entry, MAX_GLOBALS);
+ m_global_array = std::make_unique<global_entry []>(MAX_GLOBALS);
symbol_table *symtable = m_cpu.get_global_symtable();
/* add a few simple global functions */
using namespace std::placeholders;
- symtable->add("min", nullptr, 2, 2, std::bind(&debugger_commands::execute_min, this, _1, _2, _3, _4));
- symtable->add("max", nullptr, 2, 2, std::bind(&debugger_commands::execute_max, this, _1, _2, _3, _4));
- symtable->add("if", nullptr, 3, 3, std::bind(&debugger_commands::execute_if, this, _1, _2, _3, _4));
+ symtable->add("min", 2, 2, std::bind(&debugger_commands::execute_min, this, _1, _2, _3));
+ symtable->add("max", 2, 2, std::bind(&debugger_commands::execute_max, this, _1, _2, _3));
+ symtable->add("if", 3, 3, std::bind(&debugger_commands::execute_if, this, _1, _2, _3));
/* add all single-entry save state globals */
for (int itemnum = 0; itemnum < MAX_GLOBALS; itemnum++)
@@ -128,7 +128,10 @@ debugger_commands::debugger_commands(running_machine& machine, debugger_cpu& cpu
sprintf(symname, ".%s", strrchr(name, '/') + 1);
m_global_array[itemnum].base = base;
m_global_array[itemnum].size = valsize;
- symtable->add(symname, &m_global_array, std::bind(&debugger_commands::global_get, this, _1, _2), std::bind(&debugger_commands::global_set, this, _1, _2, _3));
+ symtable->add(
+ symname,
+ std::bind(&debugger_commands::global_get, this, _1, &m_global_array[itemnum]),
+ std::bind(&debugger_commands::global_set, this, _1, &m_global_array[itemnum], _2));
}
}
@@ -293,7 +296,7 @@ debugger_commands::debugger_commands(running_machine& machine, debugger_cpu& cpu
execute_min - return the minimum of two values
-------------------------------------------------*/
-u64 debugger_commands::execute_min(symbol_table &table, void *ref, int params, const u64 *param)
+u64 debugger_commands::execute_min(symbol_table &table, int params, const u64 *param)
{
return (param[0] < param[1]) ? param[0] : param[1];
}
@@ -303,7 +306,7 @@ u64 debugger_commands::execute_min(symbol_table &table, void *ref, int params, c
execute_max - return the maximum of two values
-------------------------------------------------*/
-u64 debugger_commands::execute_max(symbol_table &table, void *ref, int params, const u64 *param)
+u64 debugger_commands::execute_max(symbol_table &table, int params, const u64 *param)
{
return (param[0] > param[1]) ? param[0] : param[1];
}
@@ -313,7 +316,7 @@ u64 debugger_commands::execute_max(symbol_table &table, void *ref, int params, c
execute_if - if (a) return b; else return c;
-------------------------------------------------*/
-u64 debugger_commands::execute_if(symbol_table &table, void *ref, int params, const u64 *param)
+u64 debugger_commands::execute_if(symbol_table &table, int params, const u64 *param)
{
return param[0] ? param[1] : param[2];
}
@@ -328,9 +331,8 @@ u64 debugger_commands::execute_if(symbol_table &table, void *ref, int params, co
global_get - symbol table getter for globals
-------------------------------------------------*/
-u64 debugger_commands::global_get(symbol_table &table, void *ref)
+u64 debugger_commands::global_get(symbol_table &table, global_entry *global)
{
- global_entry *global = (global_entry *)ref;
switch (global->size)
{
case 1: return *(u8 *)global->base;
@@ -346,9 +348,8 @@ u64 debugger_commands::global_get(symbol_table &table, void *ref)
global_set - symbol table setter for globals
-------------------------------------------------*/
-void debugger_commands::global_set(symbol_table &table, void *ref, u64 value)
+void debugger_commands::global_set(symbol_table &table, global_entry *global, u64 value)
{
- global_entry *global = (global_entry *)ref;
switch (global->size)
{
case 1: *(u8 *)global->base = value; break;
@@ -761,7 +762,7 @@ void debugger_commands::execute_tracesym(int ref, const std::vector<std::string>
void debugger_commands::execute_quit(int ref, const std::vector<std::string> &params)
{
- osd_printf_error("Exited via the debugger\n");
+ osd_printf_warning("Exited via the debugger\n");
m_machine.schedule_exit();
}
@@ -1669,7 +1670,7 @@ void debugger_commands::execute_save(int ref, const std::vector<std::string> &pa
/* now write the data out */
auto dis = space->machine().disable_side_effect();
- switch (space->addrbus_shift())
+ switch (space->addr_shift())
{
case -3:
for (offs_t i = offset; i != endoffset; i++)
@@ -1748,10 +1749,10 @@ void debugger_commands::execute_load(int ref, const std::vector<std::string> &pa
f.seekg(0, std::ios::end);
length = f.tellg();
f.seekg(0);
- if (space->addrbus_shift() < 0)
- length >>= -space->addrbus_shift();
- else if (space->addrbus_shift() > 0)
- length <<= space->addrbus_shift();
+ if (space->addr_shift() < 0)
+ length >>= -space->addr_shift();
+ else if (space->addr_shift() > 0)
+ length <<= space->addr_shift();
}
// determine the addresses to read
@@ -1759,7 +1760,7 @@ void debugger_commands::execute_load(int ref, const std::vector<std::string> &pa
offset = offset & space->addrmask();
offs_t i = 0;
// now read the data in, ignore endoffset and load entire file if length has been set to zero (offset-1)
- switch (space->addrbus_shift())
+ switch (space->addr_shift())
{
case -3:
for (i = offset; f.good() && (i <= endoffset || endoffset == offset - 1); i++)
@@ -1850,7 +1851,7 @@ void debugger_commands::execute_dump(int ref, const std::vector<std::string> &pa
if (!validate_cpu_space_parameter((params.size() > 6) ? params[6].c_str() : nullptr, ref, space))
return;
- int shift = space->addrbus_shift();
+ int shift = space->addr_shift();
u64 granularity = shift > 0 ? 2 : 1 << -shift;
/* further validation */
@@ -2453,7 +2454,7 @@ void debugger_commands::execute_find(int ref, const std::vector<std::string> &pa
/* further validation */
endoffset = (offset + length - 1) & space->addrmask();
offset = offset & space->addrmask();
- cur_data_size = space->addrbus_shift() > 0 ? 2 : 1 << -space->addrbus_shift();
+ cur_data_size = space->addr_shift() > 0 ? 2 : 1 << -space->addr_shift();
if (cur_data_size == 0)
cur_data_size = 1;
diff --git a/src/emu/debug/debugcmd.h b/src/emu/debug/debugcmd.h
index 7eca669908e..98b6d8ae03d 100644
--- a/src/emu/debug/debugcmd.h
+++ b/src/emu/debug/debugcmd.h
@@ -37,8 +37,10 @@ public:
private:
struct global_entry
{
- void * base;
- u32 size;
+ global_entry() { }
+
+ void * base = nullptr;
+ u32 size = 0;
};
@@ -79,12 +81,12 @@ private:
u64 cheat_byte_swap(const cheat_system *cheatsys, u64 value);
u64 cheat_read_extended(const cheat_system *cheatsys, address_space &space, offs_t address);
- u64 execute_min(symbol_table &table, void *ref, int params, const u64 *param);
- u64 execute_max(symbol_table &table, void *ref, int params, const u64 *param);
- u64 execute_if(symbol_table &table, void *ref, int params, const u64 *param);
+ u64 execute_min(symbol_table &table, int params, const u64 *param);
+ u64 execute_max(symbol_table &table, int params, const u64 *param);
+ u64 execute_if(symbol_table &table, int params, const u64 *param);
- u64 global_get(symbol_table &table, void *ref);
- void global_set(symbol_table &table, void *ref, u64 value);
+ u64 global_get(symbol_table &table, global_entry *global);
+ void global_set(symbol_table &table, global_entry *global, u64 value);
int mini_printf(char *buffer, const char *format, int params, u64 *param);
@@ -162,7 +164,7 @@ private:
debugger_cpu& m_cpu;
debugger_console& m_console;
- global_entry *m_global_array;
+ std::unique_ptr<global_entry []> m_global_array;
cheat_system m_cheat;
static const size_t MAX_GLOBALS;
diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp
index c5f5a532599..eab6f7771e7 100644
--- a/src/emu/debug/debugcpu.cpp
+++ b/src/emu/debug/debugcpu.cpp
@@ -49,6 +49,7 @@ debugger_cpu::debugger_cpu(running_machine &machine)
, m_breakcpu(nullptr)
, m_symtable(nullptr)
, m_execution_state(EXECUTION_STATE_STOPPED)
+ , m_stop_when_not_device(nullptr)
, m_bpindex(1)
, m_wpindex(1)
, m_rpindex(1)
@@ -72,10 +73,10 @@ debugger_cpu::debugger_cpu(running_machine &machine)
m_symtable->add("wpdata", symbol_table::READ_ONLY, &m_wpdata);
using namespace std::placeholders;
- m_symtable->add("cpunum", nullptr, std::bind(&debugger_cpu::get_cpunum, this, _1, _2));
- m_symtable->add("beamx", (void *)first_screen, std::bind(&debugger_cpu::get_beamx, this, _1, _2));
- m_symtable->add("beamy", (void *)first_screen, std::bind(&debugger_cpu::get_beamy, this, _1, _2));
- m_symtable->add("frame", (void *)first_screen, std::bind(&debugger_cpu::get_frame, this, _1, _2));
+ m_symtable->add("cpunum", std::bind(&debugger_cpu::get_cpunum, this, _1));
+ m_symtable->add("beamx", std::bind(&debugger_cpu::get_beamx, this, _1, first_screen));
+ m_symtable->add("beamy", std::bind(&debugger_cpu::get_beamy, this, _1, first_screen));
+ m_symtable->add("frame", std::bind(&debugger_cpu::get_frame, this, _1, first_screen));
/* add the temporary variables to the global symbol table */
for (int regnum = 0; regnum < NUM_TEMP_VARIABLES; regnum++)
@@ -1341,9 +1342,8 @@ expression_error::error_code debugger_cpu::expression_validate(void *param, cons
get_beamx - get beam horizontal position
-------------------------------------------------*/
-u64 debugger_cpu::get_beamx(symbol_table &table, void *ref)
+u64 debugger_cpu::get_beamx(symbol_table &table, screen_device *screen)
{
- screen_device *screen = reinterpret_cast<screen_device *>(ref);
return (screen != nullptr) ? screen->hpos() : 0;
}
@@ -1352,9 +1352,8 @@ u64 debugger_cpu::get_beamx(symbol_table &table, void *ref)
get_beamy - get beam vertical position
-------------------------------------------------*/
-u64 debugger_cpu::get_beamy(symbol_table &table, void *ref)
+u64 debugger_cpu::get_beamy(symbol_table &table, screen_device *screen)
{
- screen_device *screen = reinterpret_cast<screen_device *>(ref);
return (screen != nullptr) ? screen->vpos() : 0;
}
@@ -1363,9 +1362,8 @@ u64 debugger_cpu::get_beamy(symbol_table &table, void *ref)
get_frame - get current frame number
-------------------------------------------------*/
-u64 debugger_cpu::get_frame(symbol_table &table, void *ref)
+u64 debugger_cpu::get_frame(symbol_table &table, screen_device *screen)
{
- screen_device *screen = reinterpret_cast<screen_device *>(ref);
return (screen != nullptr) ? screen->frame_number() : 0;
}
@@ -1375,7 +1373,7 @@ u64 debugger_cpu::get_frame(symbol_table &table, void *ref)
'cpunum' symbol
-------------------------------------------------*/
-u64 debugger_cpu::get_cpunum(symbol_table &table, void *ref)
+u64 debugger_cpu::get_cpunum(symbol_table &table)
{
execute_interface_iterator iter(m_machine.root_device());
return iter.indexof(m_visiblecpu->execute());
@@ -1538,22 +1536,34 @@ device_debug::device_debug(device_t &device)
// add global symbol for cycles and totalcycles
if (m_exec != nullptr)
{
- m_symtable.add("cycles", nullptr, get_cycles);
- m_symtable.add("totalcycles", nullptr, get_totalcycles);
- m_symtable.add("lastinstructioncycles", nullptr, get_lastinstructioncycles);
+ m_symtable.add("cycles", get_cycles);
+ m_symtable.add("totalcycles", get_totalcycles);
+ m_symtable.add("lastinstructioncycles", get_lastinstructioncycles);
}
// add entries to enable/disable unmap reporting for each space
if (m_memory != nullptr)
{
if (m_memory->has_space(AS_PROGRAM))
- m_symtable.add("logunmap", (void *)&m_memory->space(AS_PROGRAM), get_logunmap, set_logunmap);
+ m_symtable.add(
+ "logunmap",
+ [&space = m_memory->space(AS_PROGRAM)] (symbol_table &table) { return space.log_unmap(); },
+ [&space = m_memory->space(AS_PROGRAM)] (symbol_table &table, u64 value) { return space.set_log_unmap(bool(value)); });
if (m_memory->has_space(AS_DATA))
- m_symtable.add("logunmapd", (void *)&m_memory->space(AS_DATA), get_logunmap, set_logunmap);
+ m_symtable.add(
+ "logunmap",
+ [&space = m_memory->space(AS_DATA)] (symbol_table &table) { return space.log_unmap(); },
+ [&space = m_memory->space(AS_DATA)] (symbol_table &table, u64 value) { return space.set_log_unmap(bool(value)); });
if (m_memory->has_space(AS_IO))
- m_symtable.add("logunmapi", (void *)&m_memory->space(AS_IO), get_logunmap, set_logunmap);
+ m_symtable.add(
+ "logunmap",
+ [&space = m_memory->space(AS_IO)] (symbol_table &table) { return space.log_unmap(); },
+ [&space = m_memory->space(AS_IO)] (symbol_table &table, u64 value) { return space.set_log_unmap(bool(value)); });
if (m_memory->has_space(AS_OPCODES))
- m_symtable.add("logunmapo", (void *)&m_memory->space(AS_OPCODES), get_logunmap, set_logunmap);
+ m_symtable.add(
+ "logunmap",
+ [&space = m_memory->space(AS_OPCODES)] (symbol_table &table) { return space.log_unmap(); },
+ [&space = m_memory->space(AS_OPCODES)] (symbol_table &table, u64 value) { return space.set_log_unmap(bool(value)); });
}
// add all registers into it
@@ -1563,8 +1573,13 @@ device_debug::device_debug(device_t &device)
// TODO: floating point registers
if (!entry->is_float())
{
+ using namespace std::placeholders;
strmakelower(tempstr.assign(entry->symbol()));
- m_symtable.add(tempstr.c_str(), (void *)(uintptr_t)entry->index(), get_state, entry->writeable() ? set_state : nullptr, entry->format_string());
+ m_symtable.add(
+ tempstr.c_str(),
+ std::bind(&device_debug::get_state, _1, entry->index()),
+ entry->writeable() ? std::bind(&device_debug::set_state, _1, entry->index(), _2) : symbol_table::setter_func(nullptr),
+ entry->format_string());
}
}
}
@@ -1575,8 +1590,8 @@ device_debug::device_debug(device_t &device)
m_flags = DEBUG_FLAG_OBSERVING | DEBUG_FLAG_HISTORY;
// if no curpc, add one
- if (m_state != nullptr && m_symtable.find("curpc") == nullptr)
- m_symtable.add("curpc", nullptr, get_current_pc);
+ if (m_state && !m_symtable.find("curpc"))
+ m_symtable.add("curpc", get_current_pc);
}
// set up trace
@@ -2875,7 +2890,7 @@ void device_debug::hotspot_check(address_space &space, offs_t address)
// current instruction pointer
//-------------------------------------------------
-u64 device_debug::get_current_pc(symbol_table &table, void *ref)
+u64 device_debug::get_current_pc(symbol_table &table)
{
device_t *device = reinterpret_cast<device_t *>(table.globalref());
return device->safe_pcbase();
@@ -2887,7 +2902,7 @@ u64 device_debug::get_current_pc(symbol_table &table, void *ref)
// 'cycles' symbol
//-------------------------------------------------
-u64 device_debug::get_cycles(symbol_table &table, void *ref)
+u64 device_debug::get_cycles(symbol_table &table)
{
device_t *device = reinterpret_cast<device_t *>(table.globalref());
return device->debug()->m_exec->cycles_remaining();
@@ -2899,7 +2914,7 @@ u64 device_debug::get_cycles(symbol_table &table, void *ref)
// 'totalcycles' symbol
//-------------------------------------------------
-u64 device_debug::get_totalcycles(symbol_table &table, void *ref)
+u64 device_debug::get_totalcycles(symbol_table &table)
{
device_t *device = reinterpret_cast<device_t *>(table.globalref());
return device->debug()->m_total_cycles;
@@ -2911,7 +2926,7 @@ u64 device_debug::get_totalcycles(symbol_table &table, void *ref)
// 'lastinstructioncycles' symbol
//-------------------------------------------------
-u64 device_debug::get_lastinstructioncycles(symbol_table &table, void *ref)
+u64 device_debug::get_lastinstructioncycles(symbol_table &table)
{
device_t *device = reinterpret_cast<device_t *>(table.globalref());
device_debug *debug = device->debug();
@@ -2920,38 +2935,14 @@ u64 device_debug::get_lastinstructioncycles(symbol_table &table, void *ref)
//-------------------------------------------------
-// get_logunmap - getter callback for the logumap
-// symbols
-//-------------------------------------------------
-
-u64 device_debug::get_logunmap(symbol_table &table, void *ref)
-{
- address_space &space = *reinterpret_cast<address_space *>(table.globalref());
- return space.log_unmap();
-}
-
-
-//-------------------------------------------------
-// set_logunmap - setter callback for the logumap
-// symbols
-//-------------------------------------------------
-
-void device_debug::set_logunmap(symbol_table &table, void *ref, u64 value)
-{
- address_space &space = *reinterpret_cast<address_space *>(table.globalref());
- space.set_log_unmap(value ? true : false);
-}
-
-
-//-------------------------------------------------
// get_state - getter callback for a device's
// state symbols
//-------------------------------------------------
-u64 device_debug::get_state(symbol_table &table, void *ref)
+u64 device_debug::get_state(symbol_table &table, int index)
{
device_t *device = reinterpret_cast<device_t *>(table.globalref());
- return device->debug()->m_state->state_int(reinterpret_cast<uintptr_t>(ref));
+ return device->debug()->m_state->state_int(index);
}
@@ -2960,10 +2951,10 @@ u64 device_debug::get_state(symbol_table &table, void *ref)
// state symbols
//-------------------------------------------------
-void device_debug::set_state(symbol_table &table, void *ref, u64 value)
+void device_debug::set_state(symbol_table &table, int index, u64 value)
{
device_t *device = reinterpret_cast<device_t *>(table.globalref());
- device->debug()->m_state->set_state_int(reinterpret_cast<uintptr_t>(ref), value);
+ device->debug()->m_state->set_state_int(index, value);
}
diff --git a/src/emu/debug/debugcpu.h b/src/emu/debug/debugcpu.h
index e00ac9576cc..388e497cb0a 100644
--- a/src/emu/debug/debugcpu.h
+++ b/src/emu/debug/debugcpu.h
@@ -288,14 +288,12 @@ private:
void hotspot_check(address_space &space, offs_t address);
// symbol get/set callbacks
- static u64 get_current_pc(symbol_table &table, void *ref);
- static u64 get_cycles(symbol_table &table, void *ref);
- static u64 get_totalcycles(symbol_table &table, void *ref);
- static u64 get_lastinstructioncycles(symbol_table &table, void *ref);
- static u64 get_logunmap(symbol_table &table, void *ref);
- static void set_logunmap(symbol_table &table, void *ref, u64 value);
- static u64 get_state(symbol_table &table, void *ref);
- static void set_state(symbol_table &table, void *ref, u64 value);
+ static u64 get_current_pc(symbol_table &table);
+ static u64 get_cycles(symbol_table &table);
+ static u64 get_totalcycles(symbol_table &table);
+ static u64 get_lastinstructioncycles(symbol_table &table);
+ static u64 get_state(symbol_table &table, int index);
+ static void set_state(symbol_table &table, int index, u64 value);
// basic device information
device_t & m_device; // device we are attached to
@@ -585,10 +583,10 @@ private:
device_t* expression_get_device(const char *tag);
/* variable getters/setters */
- u64 get_cpunum(symbol_table &table, void *ref);
- u64 get_beamx(symbol_table &table, void *ref);
- u64 get_beamy(symbol_table &table, void *ref);
- u64 get_frame(symbol_table &table, void *ref);
+ u64 get_cpunum(symbol_table &table);
+ u64 get_beamx(symbol_table &table, screen_device *screen);
+ u64 get_beamy(symbol_table &table, screen_device *screen);
+ u64 get_frame(symbol_table &table, screen_device *screen);
/* internal helpers */
void on_vblank(screen_device &device, bool vblank_state);
diff --git a/src/emu/debug/debugvw.h b/src/emu/debug/debugvw.h
index d456eacdbeb..374af7f384e 100644
--- a/src/emu/debug/debugvw.h
+++ b/src/emu/debug/debugvw.h
@@ -158,7 +158,7 @@ public:
void set_visible_position(debug_view_xy pos);
void set_cursor_position(debug_view_xy pos);
void set_cursor_visible(bool visible = true);
- void set_source(const debug_view_source &source);
+ virtual void set_source(const debug_view_source &source);
// helpers
void process_char(int character) { view_char(character); }
diff --git a/src/emu/debug/dvdisasm.cpp b/src/emu/debug/dvdisasm.cpp
index 9ad6cb968c2..2292e766132 100644
--- a/src/emu/debug/dvdisasm.cpp
+++ b/src/emu/debug/dvdisasm.cpp
@@ -231,7 +231,7 @@ bool debug_view_disasm::generate_with_pc(debug_disasm_buffer &buffer, offs_t pc)
{
// Consider that instructions are 64 bytes max
const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source);
- int shift = source.m_space.addrbus_shift();
+ int shift = source.m_space.addr_shift();
offs_t backwards_offset;
if(shift < 0)
@@ -559,3 +559,13 @@ void debug_view_disasm::set_selected_address(offs_t address)
break;
}
}
+
+//-------------------------------------------------
+// set_source - set the current subview
+//-------------------------------------------------
+
+void debug_view_disasm::set_source(const debug_view_source &source)
+{
+ debug_view::set_source(source);
+ m_dasm.clear();
+}
diff --git a/src/emu/debug/dvdisasm.h b/src/emu/debug/dvdisasm.h
index dcf756117b8..ef9e4209f1b 100644
--- a/src/emu/debug/dvdisasm.h
+++ b/src/emu/debug/dvdisasm.h
@@ -80,6 +80,7 @@ public:
void set_backward_steps(u32 steps);
void set_disasm_width(u32 width);
void set_selected_address(offs_t address);
+ virtual void set_source(const debug_view_source &source) override;
protected:
// view overrides
diff --git a/src/emu/debug/express.cpp b/src/emu/debug/express.cpp
index 9661d80a35a..06e12e09800 100644
--- a/src/emu/debug/express.cpp
+++ b/src/emu/debug/express.cpp
@@ -114,7 +114,7 @@ public:
// construction/destruction
integer_symbol_entry(symbol_table &table, const char *name, symbol_table::read_write rw, u64 *ptr = nullptr);
integer_symbol_entry(symbol_table &table, const char *name, u64 constval);
- integer_symbol_entry(symbol_table &table, const char *name, void *ref, symbol_table::getter_func getter, symbol_table::setter_func setter, const std::string &format);
+ integer_symbol_entry(symbol_table &table, const char *name, symbol_table::getter_func getter, symbol_table::setter_func setter, const std::string &format);
// symbol access
virtual bool is_lval() const override;
@@ -122,10 +122,6 @@ public:
virtual void set_value(u64 newvalue) override;
private:
- // internal helpers
- static u64 internal_getter(symbol_table &table, void *symref);
- static void internal_setter(symbol_table &table, void *symref, u64 value);
-
// internal state
symbol_table::getter_func m_getter;
symbol_table::setter_func m_setter;
@@ -138,7 +134,7 @@ class function_symbol_entry : public symbol_entry
{
public:
// construction/destruction
- function_symbol_entry(symbol_table &table, const char *name, void *ref, int minparams, int maxparams, symbol_table::execute_func execute);
+ function_symbol_entry(symbol_table &table, const char *name, int minparams, int maxparams, symbol_table::execute_func execute);
// symbol access
virtual bool is_lval() const override;
@@ -203,13 +199,12 @@ const char *expression_error::code_string() const
// symbol_entry - constructor
//-------------------------------------------------
-symbol_entry::symbol_entry(symbol_table &table, symbol_type type, const char *name, const std::string &format, void *ref)
+symbol_entry::symbol_entry(symbol_table &table, symbol_type type, const char *name, const std::string &format)
: m_next(nullptr),
m_table(table),
m_type(type),
m_name(name),
- m_format(format),
- m_ref(ref)
+ m_format(format)
{
}
@@ -233,25 +228,31 @@ symbol_entry::~symbol_entry()
//-------------------------------------------------
integer_symbol_entry::integer_symbol_entry(symbol_table &table, const char *name, symbol_table::read_write rw, u64 *ptr)
- : symbol_entry(table, SMT_INTEGER, name, "", (ptr == nullptr) ? &m_value : ptr),
- m_getter(internal_getter),
- m_setter((rw == symbol_table::READ_ONLY) ? nullptr : internal_setter),
+ : symbol_entry(table, SMT_INTEGER, name, ""),
+ m_getter(ptr
+ ? symbol_table::getter_func([ptr] (symbol_table &table) { return *ptr; })
+ : symbol_table::getter_func([this] (symbol_table &table) { return m_value; })),
+ m_setter((rw == symbol_table::READ_ONLY)
+ ? symbol_table::setter_func(nullptr)
+ : ptr
+ ? symbol_table::setter_func([ptr] (symbol_table &table, u64 value) { *ptr = value; })
+ : symbol_table::setter_func([this] (symbol_table &table, u64 value) { m_value = value; })),
m_value(0)
{
}
integer_symbol_entry::integer_symbol_entry(symbol_table &table, const char *name, u64 constval)
- : symbol_entry(table, SMT_INTEGER, name, "", &m_value),
- m_getter(internal_getter),
+ : symbol_entry(table, SMT_INTEGER, name, ""),
+ m_getter([this] (symbol_table &table) { return m_value; }),
m_setter(nullptr),
m_value(constval)
{
}
-integer_symbol_entry::integer_symbol_entry(symbol_table &table, const char *name, void *ref, symbol_table::getter_func getter, symbol_table::setter_func setter, const std::string &format)
- : symbol_entry(table, SMT_INTEGER, name, format, ref),
+integer_symbol_entry::integer_symbol_entry(symbol_table &table, const char *name, symbol_table::getter_func getter, symbol_table::setter_func setter, const std::string &format)
+ : symbol_entry(table, SMT_INTEGER, name, format),
m_getter(getter),
m_setter(setter),
m_value(0)
@@ -275,7 +276,7 @@ bool integer_symbol_entry::is_lval() const
u64 integer_symbol_entry::value() const
{
- return m_getter(m_table, m_ref);
+ return m_getter(m_table);
}
@@ -286,34 +287,12 @@ u64 integer_symbol_entry::value() const
void integer_symbol_entry::set_value(u64 newvalue)
{
if (m_setter != nullptr)
- m_setter(m_table, m_ref, newvalue);
+ m_setter(m_table, newvalue);
else
throw emu_fatalerror("Symbol '%s' is read-only", m_name.c_str());
}
-//-------------------------------------------------
-// internal_getter - internal helper for
-// returning the value of a variable
-//-------------------------------------------------
-
-u64 integer_symbol_entry::internal_getter(symbol_table &table, void *symref)
-{
- return *(u64 *)symref;
-}
-
-
-//-------------------------------------------------
-// internal_setter - internal helper for setting
-// the value of a variable
-//-------------------------------------------------
-
-void integer_symbol_entry::internal_setter(symbol_table &table, void *symref, u64 value)
-{
- *(u64 *)symref = value;
-}
-
-
//**************************************************************************
// FUNCTION SYMBOL ENTRY
@@ -323,8 +302,8 @@ void integer_symbol_entry::internal_setter(symbol_table &table, void *symref, u6
// function_symbol_entry - constructor
//-------------------------------------------------
-function_symbol_entry::function_symbol_entry(symbol_table &table, const char *name, void *ref, int minparams, int maxparams, symbol_table::execute_func execute)
- : symbol_entry(table, SMT_FUNCTION, name, "", ref),
+function_symbol_entry::function_symbol_entry(symbol_table &table, const char *name, int minparams, int maxparams, symbol_table::execute_func execute)
+ : symbol_entry(table, SMT_FUNCTION, name, ""),
m_minparams(minparams),
m_maxparams(maxparams),
m_execute(execute)
@@ -372,7 +351,7 @@ u64 function_symbol_entry::execute(int numparams, const u64 *paramlist)
throw emu_fatalerror("Function '%s' requires at least %d parameters", m_name.c_str(), m_minparams);
if (numparams > m_maxparams)
throw emu_fatalerror("Function '%s' accepts no more than %d parameters", m_name.c_str(), m_maxparams);
- return m_execute(m_table, m_ref, numparams, paramlist);
+ return m_execute(m_table, numparams, paramlist);
}
@@ -435,10 +414,10 @@ void symbol_table::add(const char *name, u64 value)
// add - add a new register symbol
//-------------------------------------------------
-void symbol_table::add(const char *name, void *ref, getter_func getter, setter_func setter, const std::string &format_string)
+void symbol_table::add(const char *name, getter_func getter, setter_func setter, const std::string &format_string)
{
m_symlist.erase(name);
- m_symlist.emplace(name, std::make_unique<integer_symbol_entry>(*this, name, ref, getter, setter, format_string));
+ m_symlist.emplace(name, std::make_unique<integer_symbol_entry>(*this, name, getter, setter, format_string));
}
@@ -446,10 +425,10 @@ void symbol_table::add(const char *name, void *ref, getter_func getter, setter_f
// add - add a new function symbol
//-------------------------------------------------
-void symbol_table::add(const char *name, void *ref, int minparams, int maxparams, execute_func execute)
+void symbol_table::add(const char *name, int minparams, int maxparams, execute_func execute)
{
m_symlist.erase(name);
- m_symlist.emplace(name, std::make_unique<function_symbol_entry>(*this, name, ref, minparams, maxparams, execute));
+ m_symlist.emplace(name, std::make_unique<function_symbol_entry>(*this, name, minparams, maxparams, execute));
}
diff --git a/src/emu/debug/express.h b/src/emu/debug/express.h
index 19381786d1b..8084cf84e8f 100644
--- a/src/emu/debug/express.h
+++ b/src/emu/debug/express.h
@@ -114,7 +114,7 @@ protected:
};
// construction/destruction
- symbol_entry(symbol_table &table, symbol_type type, const char *name, const std::string &format, void *ref);
+ symbol_entry(symbol_table &table, symbol_type type, const char *name, const std::string &format);
public:
virtual ~symbol_entry();
@@ -138,7 +138,6 @@ protected:
symbol_type m_type; // type of symbol
std::string m_name; // name of the symbol
std::string m_format; // format of symbol (or empty if unspecified)
- void * m_ref; // internal reference
};
@@ -150,11 +149,11 @@ class symbol_table
{
public:
// callback functions for getting/setting a symbol value
- typedef std::function<u64(symbol_table &table, void *symref)> getter_func;
- typedef std::function<void(symbol_table &table, void *symref, u64 value)> setter_func;
+ typedef std::function<u64(symbol_table &table)> getter_func;
+ typedef std::function<void(symbol_table &table, u64 value)> setter_func;
// callback functions for function execution
- typedef std::function<u64(symbol_table &table, void *symref, int numparams, const u64 *paramlist)> execute_func;
+ typedef std::function<u64(symbol_table &table, int numparams, const u64 *paramlist)> execute_func;
// callback functions for memory reads/writes
typedef std::function<expression_error::error_code(void *cbparam, const char *name, expression_space space)> valid_func;
@@ -181,8 +180,8 @@ public:
// symbol access
void add(const char *name, read_write rw, u64 *ptr = nullptr);
void add(const char *name, u64 constvalue);
- void add(const char *name, void *ref, getter_func getter, setter_func setter = nullptr, const std::string &format_string = "");
- void add(const char *name, void *ref, int minparams, int maxparams, execute_func execute);
+ void add(const char *name, getter_func getter, setter_func setter = nullptr, const std::string &format_string = "");
+ void add(const char *name, int minparams, int maxparams, execute_func execute);
symbol_entry *find(const char *name) const { if (name) { auto search = m_symlist.find(name); if (search != m_symlist.end()) return search->second.get(); else return nullptr; } else return nullptr; }
symbol_entry *find_deep(const char *name);