summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/debug/debugcmd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/debug/debugcmd.cpp')
-rw-r--r--src/emu/debug/debugcmd.cpp43
1 files changed, 22 insertions, 21 deletions
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;