debugger: Extended target address syntax to include device/address space. (#8630)

Added a validity check to ensure address space names are tag-like and unique, since they're now used as identifiers in debugger commands.

Extended the syntax for target addresses to allow them to be qualified with a colon followed by an optional device tag and/or address space name.  If only the device needs to be specified, a debugger CPU number may also be used.  This makes commands like bpset and wpset more flexible, as they can operate on CPUs other than the currently visible CPU.  Commands like find, fill, dump and load are more flexible as they can access any space of any device.

Removed now-redundant CPU parameters from many commands, and renamed pcatmemp to pcatmem for consistency with other commands.  Extended region syntax for saver/loadr to support tags relative to the visible CPU (e.g. you can use "." for the region with the same name as the visible CPU, or "^sibling" syntax).  Added an optional root device parameter to memdump.  Changed interpretation of Boolean values to support numeric expressions as well as true/false strings and literal 1/0.

Added checks that the specified device is CPU-like to various commands that require a CPU (e.g. focus).  Previously these commands would crash or trigger an assertion failure if a tag for a non-CPU devices was specified.

Fixed the cpunum symbol so it uses the same rules for determining what is or isn't a CPU as parameter parsing.

Made device_t sanitise subtags better.  Previously you could cause an assertion failure or crash MAME by giving it unexpected relative tags via Lua or the debugger.

Added help topic alias support, and reworked the data structures to improve the performance of looking up debugger commands and help topics.  Removed the "ref" parameter from debugger command functions (std::bind can hold extra argument values for you if you need them).  Also added an error message if duplicate debugger commands are registered.

Updated help for commands that changed syntax, and also updated summaries for some commands that had changed in the past without corresponding help updates.
bemani_k573msu_wip
Vas Crabb 2 years ago committed by GitHub
parent 6eee76c1a0
commit 360d3a5950
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      doxygen/doxygen.config
  2. 2
      src/devices/bus/gio64/gio64.cpp
  3. 8
      src/devices/bus/isa/isa.cpp
  4. 2
      src/devices/bus/qbus/qbus.cpp
  5. 2
      src/devices/bus/sbus/sbus.cpp
  6. 2
      src/devices/bus/vme/vme.cpp
  7. 2
      src/devices/cpu/adsp2100/adsp2100.cpp
  8. 14
      src/devices/cpu/arm7/arm7.cpp
  9. 6
      src/devices/cpu/arm7/arm7.h
  10. 2
      src/devices/cpu/h16/hd641016.cpp
  11. 2
      src/devices/cpu/h8500/h8500.cpp
  12. 2
      src/devices/cpu/m6502/r65c19.cpp
  13. 4
      src/devices/cpu/m68000/m68kcpu.cpp
  14. 28
      src/devices/cpu/ns32000/ns32000.cpp
  15. 10
      src/devices/cpu/ns32000/ns32000.h
  16. 4
      src/devices/cpu/pdp8/hd6120.cpp
  17. 2
      src/devices/cpu/rx01/rx01.cpp
  18. 5
      src/devices/cpu/sparc/sparc.cpp
  19. 1
      src/devices/cpu/sparc/sparc.h
  20. 4
      src/devices/cpu/upd78k/upd78k0.cpp
  21. 4
      src/devices/cpu/upd78k/upd78k2.cpp
  22. 4
      src/devices/cpu/upd78k/upd78k3.cpp
  23. 2
      src/devices/cpu/vt61/vt61.cpp
  24. 6
      src/devices/cpu/z8000/z8000.cpp
  25. 6
      src/devices/machine/acorn_memc.cpp
  26. 2
      src/devices/machine/acorn_memc.h
  27. 4
      src/devices/machine/sun4c_mmu.cpp
  28. 2
      src/devices/machine/sun4c_mmu.h
  29. 2
      src/devices/sound/dave.cpp
  30. 4
      src/devices/sound/ymopn.cpp
  31. 1801
      src/emu/debug/debugcmd.cpp
  32. 199
      src/emu/debug/debugcmd.h
  33. 96
      src/emu/debug/debugcon.cpp
  34. 24
      src/emu/debug/debugcon.h
  35. 717
      src/emu/debug/debughlp.cpp
  36. 6
      src/emu/debug/debughlp.h
  37. 14
      src/emu/debug/express.cpp
  38. 6
      src/emu/debug/express.h
  39. 49
      src/emu/device.cpp
  40. 35
      src/emu/dimemory.cpp
  41. 18
      src/mame/drivers/chihiro.cpp
  42. 82
      src/mame/drivers/konamim2.cpp
  43. 4
      src/mame/includes/dgn_beta.h
  44. 2
      src/mame/includes/mbc55x.h
  45. 8
      src/mame/includes/model2.h
  46. 4
      src/mame/includes/rmnimbus.h
  47. 34
      src/mame/includes/xbox.h
  48. 14
      src/mame/machine/6883sam.cpp
  49. 8
      src/mame/machine/dgn_beta.cpp
  50. 20
      src/mame/machine/hpc3.cpp
  51. 16
      src/mame/machine/model2.cpp
  52. 4
      src/mame/machine/rmnimbus.cpp
  53. 68
      src/mame/machine/xbox.cpp
  54. 4
      src/mame/video/mbc55x.cpp
  55. 12
      src/mame/video/midtunit.cpp
  56. 6
      src/mame/video/midtunit.h
  57. 4
      src/mame/video/rmnimbus.cpp

@ -133,7 +133,7 @@ ABBREVIATE_BRIEF =
# description.
# The default value is: NO.
ALWAYS_DETAILED_SEC = YES
ALWAYS_DETAILED_SEC = NO
# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
# inherited members of a class in the documentation of that class as if those
@ -318,7 +318,7 @@ OPTIMIZE_OUTPUT_SLICE = NO
#
# Note see also the list of default file extension mappings.
EXTENSION_MAPPING = h=C++ inc=C++
EXTENSION_MAPPING = inc=C++
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
# according to the Markdown format, which allows for more readable
@ -1156,7 +1156,7 @@ HTML_FILE_EXTENSION = .html
# of the possible markers and block names see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_HEADER = doxygen/header.html
#HTML_HEADER = doxygen/header.html
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
# generated HTML page. If the tag is left blank doxygen will generate a standard
@ -1166,7 +1166,7 @@ HTML_HEADER = doxygen/header.html
# that doxygen normally uses.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_FOOTER = doxygen/footer.html
#HTML_FOOTER = doxygen/footer.html
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
# sheet that is used by each HTML page. It can be used to fine-tune the look of
@ -1191,7 +1191,7 @@ HTML_STYLESHEET =
# list). For an example see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_EXTRA_STYLESHEET = doxygen/style.css
#HTML_EXTRA_STYLESHEET = doxygen/style.css
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
@ -1201,7 +1201,7 @@ HTML_EXTRA_STYLESHEET = doxygen/style.css
# files will be copied as-is; there are no commands or markers available.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_EXTRA_FILES = doxygen/doxy-boot.js
#HTML_EXTRA_FILES = doxygen/doxy-boot.js
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the style sheet and background images according to
@ -2330,7 +2330,7 @@ DOT_FONTPATH =
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
CLASS_GRAPH = NO
CLASS_GRAPH = YES
# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
# graph for each documented class showing the direct and indirect implementation
@ -2339,7 +2339,7 @@ CLASS_GRAPH = NO
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
COLLABORATION_GRAPH = NO
COLLABORATION_GRAPH = YES
# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
# groups, showing the direct groups dependencies.

@ -68,7 +68,7 @@ gio64_device::gio64_device(const machine_config &mconfig, const char *tag, devic
gio64_device::gio64_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, type, tag, owner, clock)
, device_memory_interface(mconfig, *this)
, m_space_config("GIO64 Space", ENDIANNESS_BIG, 64, 32, 0)
, m_space_config("gio64", ENDIANNESS_BIG, 64, 32, 0)
, m_interrupt_cb(*this)
{
}

@ -107,10 +107,10 @@ isa8_device::isa8_device(const machine_config &mconfig, const char *tag, device_
isa8_device::isa8_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, type, tag, owner, clock),
device_memory_interface(mconfig, *this),
m_mem_config("ISA 8-bit mem", ENDIANNESS_LITTLE, 8, 24, 0, address_map_constructor()),
m_io_config("ISA 8-bit I/O", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor()),
m_mem16_config("ISA 16-bit mem", ENDIANNESS_LITTLE, 16, 24, 0, address_map_constructor()),
m_io16_config("ISA 16-bit I/O", ENDIANNESS_LITTLE, 16, 16, 0, address_map_constructor()),
m_mem_config("mem8", ENDIANNESS_LITTLE, 8, 24, 0, address_map_constructor()),
m_io_config("io8", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor()),
m_mem16_config("mem16", ENDIANNESS_LITTLE, 16, 24, 0, address_map_constructor()),
m_io16_config("io16", ENDIANNESS_LITTLE, 16, 16, 0, address_map_constructor()),
m_memspace(*this, finder_base::DUMMY_TAG, -1),
m_iospace(*this, finder_base::DUMMY_TAG, -1),
m_memwidth(0),

@ -90,7 +90,7 @@ qbus_device::qbus_device(const machine_config &mconfig, const char *tag, device_
device_t(mconfig, QBUS, tag, owner, clock),
device_memory_interface(mconfig, *this),
device_z80daisy_interface(mconfig, *this),
m_program_config("QBUS A18", ENDIANNESS_BIG, 16, 16, 0, address_map_constructor()),
m_program_config("a18", ENDIANNESS_BIG, 16, 16, 0, address_map_constructor()),
m_space(*this, finder_base::DUMMY_TAG, -1),
m_out_birq4_cb(*this),
m_out_birq5_cb(*this),

@ -83,7 +83,7 @@ sbus_device::sbus_device(const machine_config &mconfig, const char *tag, device_
sbus_device::sbus_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, type, tag, owner, clock)
, device_memory_interface(mconfig, *this)
, m_space_config("SBus Space", ENDIANNESS_BIG, 32, 32, 0, address_map_constructor())
, m_space_config("sbus", ENDIANNESS_BIG, 32, 32, 0, address_map_constructor())
, m_maincpu(*this, finder_base::DUMMY_TAG)
, m_type1space(*this, finder_base::DUMMY_TAG, -1)
, m_irq_cb(*this)

@ -211,7 +211,7 @@ vme_device::vme_device(const machine_config &mconfig, const char *tag, device_t
vme_device::vme_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, type, tag, owner, clock)
, device_memory_interface(mconfig, *this)
, m_a32_config("VME A32", ENDIANNESS_BIG, 32, 32, 0, address_map_constructor())
, m_a32_config("a32", ENDIANNESS_BIG, 32, 32, 0, address_map_constructor())
, m_allocspaces(true)
, m_cputag("maincpu")
{

@ -275,7 +275,7 @@ adsp2115_device::adsp2115_device(const machine_config &mconfig, const char *tag,
adsp2181_device::adsp2181_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: adsp21xx_device(mconfig, ADSP2181, tag, owner, clock, CHIP_TYPE_ADSP2181)
, m_io_config("I/O", ENDIANNESS_LITTLE, 16, 11, -1)
, m_io_config("io", ENDIANNESS_LITTLE, 16, 11, -1)
{ }

@ -841,17 +841,17 @@ bool arm7_cpu_device::translate_vaddr_to_paddr(offs_t &vaddr, const int flags)
}
}
void arm7_cpu_device::translate_insn_command(int ref, const std::vector<std::string> &params)
void arm7_cpu_device::translate_insn_command(const std::vector<std::string> &params)
{
translate_command(ref, params, TRANSLATE_FETCH);
translate_command(params, TRANSLATE_FETCH);
}
void arm7_cpu_device::translate_data_command(int ref, const std::vector<std::string> &params)
void arm7_cpu_device::translate_data_command(const std::vector<std::string> &params)
{
translate_command(ref, params, TRANSLATE_READ);
translate_command(params, TRANSLATE_READ);
}
void arm7_cpu_device::translate_command(int ref, const std::vector<std::string> &params, int intention)
void arm7_cpu_device::translate_command(const std::vector<std::string> &params, int intention)
{
uint64_t vaddr;
@ -1024,8 +1024,8 @@ void arm7_cpu_device::device_start()
if (machine().debug_flags & DEBUG_FLAG_ENABLED)
{
using namespace std::placeholders;
machine().debugger().console().register_command("translate_insn", CMDFLAG_NONE, 0, 1, 1, std::bind(&arm7_cpu_device::translate_insn_command, this, _1, _2));
machine().debugger().console().register_command("translate_data", CMDFLAG_NONE, 0, 1, 1, std::bind(&arm7_cpu_device::translate_data_command, this, _1, _2));
machine().debugger().console().register_command("translate_insn", CMDFLAG_NONE, 1, 1, std::bind(&arm7_cpu_device::translate_insn_command, this, _1));
machine().debugger().console().register_command("translate_data", CMDFLAG_NONE, 1, 1, std::bind(&arm7_cpu_device::translate_data_command, this, _1));
}
}

@ -146,9 +146,9 @@ protected:
uint32_t m_r[/*NUM_REGS*/37];
void translate_insn_command(int ref, const std::vector<std::string> &params);
void translate_data_command(int ref, const std::vector<std::string> &params);
void translate_command(int ref, const std::vector<std::string> &params, int intention);
void translate_insn_command(const std::vector<std::string> &params);
void translate_data_command(const std::vector<std::string> &params);
void translate_command(const std::vector<std::string> &params, int intention);
void update_insn_prefetch(uint32_t curr_pc);
bool insn_fetch_thumb(uint32_t pc, uint32_t &out_insn);

@ -19,7 +19,7 @@ hd641016_device::hd641016_device(const machine_config &mconfig, const char *tag,
: cpu_device(mconfig, HD641016, tag, owner, clock)
, m_program_config("program", ENDIANNESS_BIG, 16, 24, 0)
, m_data_config("data", ENDIANNESS_BIG, 32, 10, 0, address_map_constructor(FUNC(hd641016_device::ram_map), this))
, m_io_config("I/O", ENDIANNESS_BIG, 32, 9, 0, address_map_constructor(FUNC(hd641016_device::io_map), this))
, m_io_config("io", ENDIANNESS_BIG, 32, 9, 0, address_map_constructor(FUNC(hd641016_device::io_map), this))
, m_pc(0)
, m_ssp(0)
, m_bsp(0)

@ -15,7 +15,7 @@
h8500_device::h8500_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int addrbits, int buswidth, int ramsize, int defmode, address_map_constructor map)
: cpu_device(mconfig, type, tag, owner, clock)
, m_program_config("program", ENDIANNESS_BIG, buswidth, addrbits, 0, map)
, m_ram_config("internal RAM", ENDIANNESS_BIG, 16, ramsize, 0, address_map_constructor(FUNC(h8500_device::ram_map), this))
, m_ram_config("intram", ENDIANNESS_BIG, 16, ramsize, 0, address_map_constructor(FUNC(h8500_device::ram_map), this))
, m_mode_control(defmode)
, m_pc(0)
, m_ppc(0)

@ -34,7 +34,7 @@ r65c19_device::r65c19_device(const machine_config &mconfig, const char *tag, dev
c39_device::c39_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, address_map_constructor internal_map)
: r65c19_device(mconfig, type, tag, owner, clock, internal_map)
, m_exp_config("expansion", ENDIANNESS_LITTLE, 8, 21, 0)
, m_es4_config("ES4", ENDIANNESS_LITTLE, 8, 9, 0)
, m_es4_config("es4", ENDIANNESS_LITTLE, 8, 9, 0)
{
}

@ -2318,7 +2318,7 @@ m68000_base_device::m68000_base_device(const machine_config &mconfig, const char
: cpu_device(mconfig, type, tag, owner, clock),
m_program_config("program", ENDIANNESS_BIG, prg_data_width, prg_address_bits, 0, internal_map),
m_oprogram_config("decrypted_opcodes", ENDIANNESS_BIG, prg_data_width, prg_address_bits, 0, internal_map),
m_cpu_space_config("cpu space", ENDIANNESS_BIG, prg_data_width, prg_address_bits, 0, address_map_constructor(FUNC(m68000_base_device::default_autovectors_map), this)),
m_cpu_space_config("cpu_space", ENDIANNESS_BIG, prg_data_width, prg_address_bits, 0, address_map_constructor(FUNC(m68000_base_device::default_autovectors_map), this)),
m_interrupt_mixer(true),
m_cpu_space_id(AS_CPU_SPACE),
m_reset_instr_callback(*this),
@ -2335,7 +2335,7 @@ m68000_base_device::m68000_base_device(const machine_config &mconfig, const char
: cpu_device(mconfig, type, tag, owner, clock),
m_program_config("program", ENDIANNESS_BIG, prg_data_width, prg_address_bits),
m_oprogram_config("decrypted_opcodes", ENDIANNESS_BIG, prg_data_width, prg_address_bits),
m_cpu_space_config("cpu space", ENDIANNESS_BIG, prg_data_width, prg_address_bits, 0, address_map_constructor(FUNC(m68000_base_device::default_autovectors_map), this)),
m_cpu_space_config("cpu_space", ENDIANNESS_BIG, prg_data_width, prg_address_bits, 0, address_map_constructor(FUNC(m68000_base_device::default_autovectors_map), this)),
m_interrupt_mixer(true),
m_cpu_space_id(AS_CPU_SPACE),
m_reset_instr_callback(*this),

@ -94,7 +94,15 @@ static const u32 size_mask[] = { 0x000000ffU, 0x0000ffffU, 0x00000000U, 0xffffff
template <int Width>ns32000_device<Width>::ns32000_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int databits, int addrbits)
: cpu_device(mconfig, type, tag, owner, clock)
, m_program_config("program", ENDIANNESS_LITTLE, databits, addrbits, 0)
, m_interrupt_config("interrupt", ENDIANNESS_LITTLE, databits, addrbits, 0)
, m_iam_config("iam", ENDIANNESS_LITTLE, databits, addrbits, 0)
, m_iac_config("iac", ENDIANNESS_LITTLE, databits, addrbits, 0)
, m_eim_config("eim", ENDIANNESS_LITTLE, databits, addrbits, 0)
, m_eic_config("eic", ENDIANNESS_LITTLE, databits, addrbits, 0)
, m_sif_config("sif", ENDIANNESS_LITTLE, databits, addrbits, 0)
, m_nif_config("nif", ENDIANNESS_LITTLE, databits, addrbits, 0)
, m_odt_config("odt", ENDIANNESS_LITTLE, databits, addrbits, 0)
, m_rmw_config("rmw", ENDIANNESS_LITTLE, databits, addrbits, 0)
, m_ear_config("ear", ENDIANNESS_LITTLE, databits, addrbits, 0)
, m_fpu(*this, finder_base::DUMMY_TAG)
, m_mmu(*this, finder_base::DUMMY_TAG)
, m_icount(0)
@ -3327,15 +3335,15 @@ template <int Width> device_memory_interface::space_config_vector ns32000_device
return space_config_vector{
std::make_pair(AS_PROGRAM, &m_program_config),
std::make_pair(ST_IAM, &m_interrupt_config),
std::make_pair(ST_IAC, &m_interrupt_config),
std::make_pair(ST_EIM, &m_interrupt_config),
std::make_pair(ST_EIC, &m_interrupt_config),
std::make_pair(ST_SIF, &m_program_config),
std::make_pair(ST_NIF, &m_program_config),
std::make_pair(ST_ODT, &m_program_config),
std::make_pair(ST_RMW, &m_program_config),
std::make_pair(ST_EAR, &m_program_config),
std::make_pair(ST_IAM, &m_iam_config),
std::make_pair(ST_IAC, &m_iac_config),
std::make_pair(ST_EIM, &m_eim_config),
std::make_pair(ST_EIC, &m_eic_config),
std::make_pair(ST_SIF, &m_sif_config),
std::make_pair(ST_NIF, &m_nif_config),
std::make_pair(ST_ODT, &m_odt_config),
std::make_pair(ST_RMW, &m_rmw_config),
std::make_pair(ST_EAR, &m_ear_config),
};
}

@ -142,7 +142,15 @@ protected:
private:
// configuration
address_space_config m_program_config;
address_space_config m_interrupt_config;
address_space_config m_iam_config;
address_space_config m_iac_config;
address_space_config m_eim_config;
address_space_config m_eic_config;
address_space_config m_sif_config;
address_space_config m_nif_config;
address_space_config m_odt_config;
address_space_config m_rmw_config;
address_space_config m_ear_config;
optional_device<ns32000_slave_interface> m_fpu;
optional_device<ns32000_mmu_interface> m_mmu;

@ -168,8 +168,8 @@ hd6120_device::hd6120_device(const machine_config &config, const char *tag, devi
: cpu_device(config, HD6120, tag, owner, clock)
, m_inst_config("instruction", ENDIANNESS_BIG, 16, 16, -1) // 12 data bits
, m_data_config("data", ENDIANNESS_BIG, 16, 16, -1) // 12 data bits
, m_io_config("I/O", ENDIANNESS_BIG, 16, 9, -1) // 12 data bits
, m_devctl_config("device control", ENDIANNESS_BIG, 8, 9, 0) // only 3 bits used
, m_io_config("io", ENDIANNESS_BIG, 16, 9, -1) // 12 data bits
, m_devctl_config("devctl", ENDIANNESS_BIG, 8, 9, 0) // only 3 bits used
, m_lxmar_callback(*this)
, m_lxpar_callback(*this)
, m_lxdar_callback(*this)

@ -38,7 +38,7 @@ DEFINE_DEVICE_TYPE(RX01_CPU, rx01_cpu_device, "rx01_cpu", "DEC RX01 CPU")
rx01_cpu_device::rx01_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: cpu_device(mconfig, RX01_CPU, tag, owner, clock)
, m_inst_config("program", ENDIANNESS_LITTLE, 8, 12, 0)
, m_data_config("sector data", ENDIANNESS_LITTLE, 8, 10, 0) // actually 1 bit wide
, m_data_config("sectordata", ENDIANNESS_LITTLE, 8, 10, 0) // actually 1 bit wide
, m_interface_callback(*this)
, m_pc(0)
, m_ppc(0)

@ -45,12 +45,11 @@ sparc_base_device::sparc_base_device(const machine_config &mconfig, device_type
: cpu_device(mconfig, type, tag, owner, clock)
, m_mmu(*this, finder_base::DUMMY_TAG)
{
char asi_buf[10];
m_debugger_config = address_space_config("debug", ENDIANNESS_BIG, 32, 32);
for (int i = 0; i < 0x10; i++)
{
snprintf(asi_buf, std::size(asi_buf), "asi%X", i);
m_asi_config[i] = address_space_config(asi_buf, ENDIANNESS_BIG, 32, 32);
m_asi_names[i] = util::string_format("asi%x", i);
m_asi_config[i] = address_space_config(m_asi_names[i].c_str(), ENDIANNESS_BIG, 32, 32);
}
}

@ -155,6 +155,7 @@ protected:
required_device<sparc_mmu_interface> m_mmu;
// address spaces
std::string m_asi_names[0x10];
address_space_config m_debugger_config;
address_space_config m_asi_config[0x10];
memory_access<32, 2, 0, ENDIANNESS_BIG>::specific m_asi[0x20];

@ -26,9 +26,9 @@ DEFINE_DEVICE_TYPE(UPD78053, upd78053_device, "upd78053", "NEC uPD78053")
upd78k0_device::upd78k0_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, u16 iram_size, address_map_constructor mem_map, address_map_constructor sfr_map)
: cpu_device(mconfig, type, tag, owner, clock)
, m_program_config("program", ENDIANNESS_LITTLE, 8, 16, 0, mem_map)
, m_iram_config("internal high-speed RAM", ENDIANNESS_LITTLE, 16, iram_size > 0x200 ? 10 : iram_size > 0x100 ? 9 : 8, 0,
, m_iram_config("iram", ENDIANNESS_LITTLE, 16, iram_size > 0x200 ? 10 : iram_size > 0x100 ? 9 : 8, 0,
address_map_constructor(FUNC(upd78k0_device::iram_map), this))
, m_sfr_config("SFR", ENDIANNESS_LITTLE, 16, 8, 0, sfr_map)
, m_sfr_config("sfr", ENDIANNESS_LITTLE, 16, 8, 0, sfr_map)
, m_iram_size(iram_size)
, m_subclock(0)
, m_pc(0)

@ -27,8 +27,8 @@ DEFINE_DEVICE_TYPE(UPD78213, upd78213_device, "upd78213", "NEC uPD78213")
upd78k2_device::upd78k2_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int iram_bits, address_map_constructor mem_map, address_map_constructor sfr_map)
: cpu_device(mconfig, type, tag, owner, clock)
, m_program_config("program", ENDIANNESS_LITTLE, 8, 20, 0, mem_map)
, m_iram_config("IRAM", ENDIANNESS_LITTLE, 16, iram_bits, 0, address_map_constructor(FUNC(upd78k2_device::iram_map), this))
, m_sfr_config("SFR", ENDIANNESS_LITTLE, 16, 8, 0, sfr_map)
, m_iram_config("iram", ENDIANNESS_LITTLE, 16, iram_bits, 0, address_map_constructor(FUNC(upd78k2_device::iram_map), this))
, m_sfr_config("sfr", ENDIANNESS_LITTLE, 16, 8, 0, sfr_map)
, m_iram_addrmask((offs_t(1) << iram_bits) - 1)
, m_pc(0)
, m_ppc(0)

@ -27,8 +27,8 @@ DEFINE_DEVICE_TYPE(UPD78312, upd78312_device, "upd78312", "NEC uPD78312")
upd78k3_device::upd78k3_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, address_map_constructor mem_map, address_map_constructor sfr_map)
: cpu_device(mconfig, type, tag, owner, clock)
, m_program_config("program", ENDIANNESS_LITTLE, 8, 16, 0, mem_map)
, m_iram_config("IRAM", ENDIANNESS_LITTLE, 16, 8, 0, address_map_constructor(FUNC(upd78k3_device::iram_map), this))
, m_sfr_config("SFR", ENDIANNESS_LITTLE, 16, 8, 0, sfr_map)
, m_iram_config("iram", ENDIANNESS_LITTLE, 16, 8, 0, address_map_constructor(FUNC(upd78k3_device::iram_map), this))
, m_sfr_config("sfr", ENDIANNESS_LITTLE, 16, 8, 0, sfr_map)
, m_iram(*this, "iram")
, m_pc(0)
, m_ppc(0)

@ -22,7 +22,7 @@ vt61_cpu_device::vt61_cpu_device(const machine_config &mconfig, const char *tag,
: cpu_device(mconfig, VT61_CPU, tag, owner, clock)
, m_program_config("microprogram", ENDIANNESS_LITTLE, 16, 10, -1)
, m_memory_config("memory", ENDIANNESS_LITTLE, 8, 16, 0)
, m_idr_config("IDR", ENDIANNESS_LITTLE, 8, 6, 0)
, m_idr_config("idr", ENDIANNESS_LITTLE, 8, 6, 0)
, m_time_state(state::T1)
, m_pc(0)
, m_pc_mode(pc_mode::CLR)

@ -36,10 +36,10 @@ z8002_device::z8002_device(const machine_config &mconfig, device_type type, cons
: cpu_device(mconfig, type, tag, owner, clock)
, m_program_config("program", ENDIANNESS_BIG, 16, addrbits, 0)
, m_data_config("data", ENDIANNESS_BIG, 16, addrbits, 0)
, m_io_config("I/O", ENDIANNESS_BIG, 16, 16, 0)
, m_opcodes_config("first word", ENDIANNESS_BIG, 16, addrbits, 0)
, m_io_config("io_std", ENDIANNESS_BIG, 16, 16, 0)
, m_opcodes_config("first_word", ENDIANNESS_BIG, 16, addrbits, 0)
, m_stack_config("stack", ENDIANNESS_BIG, 16, addrbits, 0)
, m_sio_config("special I/O", ENDIANNESS_BIG, 16, 16, 0)
, m_sio_config("io_spc", ENDIANNESS_BIG, 16, 16, 0)
, m_iack_in(*this)
, m_mo_out(*this)
, m_ppc(0), m_pc(0), m_psapseg(0), m_psapoff(0), m_fcw(0), m_refresh(0), m_nspseg(0), m_nspoff(0), m_irq_req(0), m_irq_vec(0), m_op_valid(0), m_nmi_state(0), m_mi(0), m_halt(false), m_icount(0)

@ -32,7 +32,7 @@ acorn_memc_device::acorn_memc_device(const machine_config &mconfig, const char *
: device_t(mconfig, ACORN_MEMC, tag, owner, clock)
, device_memory_interface(mconfig, *this)
, m_vidc(*this, finder_base::DUMMY_TAG)
, m_space_config("MEMC", ENDIANNESS_LITTLE, 32, 26, 0)
, m_space_config("memc", ENDIANNESS_LITTLE, 32, 26, 0)
, m_abort_w(*this)
, m_sirq_w(*this)
, m_output_dram_rowcol(false)
@ -51,7 +51,7 @@ device_memory_interface::space_config_vector acorn_memc_device::memory_space_con
};
}
void acorn_memc_device::memc_map_debug_commands(int ref, const std::vector<std::string> &params)
void acorn_memc_device::memc_map_debug_commands(const std::vector<std::string> &params)
{
uint64_t offset;
if (params.size() != 1 || !machine().debugger().commands().validate_number_parameter(params[0], offset))
@ -103,7 +103,7 @@ void acorn_memc_device::device_start()
if (machine().debug_flags & DEBUG_FLAG_ENABLED)
{
using namespace std::placeholders;
machine().debugger().console().register_command("memc_map", CMDFLAG_NONE, 0, 1, 1, std::bind(&acorn_memc_device::memc_map_debug_commands, this, _1, _2));
machine().debugger().console().register_command("memc_map", CMDFLAG_NONE, 1, 1, std::bind(&acorn_memc_device::memc_map_debug_commands, this, _1));
}
}

@ -60,7 +60,7 @@ protected:
virtual space_config_vector memory_space_config() const override;
private:
void memc_map_debug_commands(int ref, const std::vector<std::string> &params);
void memc_map_debug_commands(const std::vector<std::string> &params);
uint32_t dram_address(uint32_t address);
bool is_valid_access(int page, bool write);
uint32_t invalid_access(bool is_write, offs_t offset, uint32_t data, uint32_t mem_mask = ~0);

@ -151,7 +151,7 @@ void sun4_mmu_base_device::device_start()
if (machine().debug_flags & DEBUG_FLAG_ENABLED)
{
using namespace std::placeholders;
machine().debugger().console().register_command("l2p", CMDFLAG_NONE, 0, 1, 1, std::bind(&sun4_mmu_base_device::l2p_command, this, _1, _2));
machine().debugger().console().register_command("l2p", CMDFLAG_NONE, 1, 1, std::bind(&sun4_mmu_base_device::l2p_command, this, _1));
}
m_cache_word_size = m_cache_line_size >> 2;
@ -985,7 +985,7 @@ bool sun4_mmu_base_device::translate(uint32_t &addr)
return entry.valid;
}
void sun4_mmu_base_device::l2p_command(int ref, const std::vector<std::string> &params)
void sun4_mmu_base_device::l2p_command(const std::vector<std::string> &params)
{
uint64_t addr, offset;

@ -138,7 +138,7 @@ protected:
void type0_timeout_r(const uint32_t offset);
void type0_timeout_w(const uint32_t offset);
bool translate(uint32_t &addr);
void l2p_command(int ref, const std::vector<std::string> &params);
void l2p_command(const std::vector<std::string> &params);
uint32_t vaddr_to_cache_line(uint32_t vaddr);
enum

@ -62,7 +62,7 @@ dave_device::dave_device(const machine_config &mconfig, const char *tag, device_
device_memory_interface(mconfig, *this),
device_sound_interface(mconfig, *this),
m_program_space_config("program", ENDIANNESS_LITTLE, 8, 22, 0, address_map_constructor(FUNC(dave_device::program_map), this)),
m_io_space_config("i/o", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(FUNC(dave_device::io_map), this)),
m_io_space_config("io", ENDIANNESS_LITTLE, 8, 16, 0, address_map_constructor(FUNC(dave_device::io_map), this)),
m_write_irq(*this),
m_write_lh(*this),
m_write_rh(*this),

@ -150,8 +150,8 @@ template<typename ChipClass>
ym2610_device_base<ChipClass>::ym2610_device_base(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, device_type type) :
ymfm_ssg_device_base<ChipClass>(mconfig, tag, owner, clock, type),
device_memory_interface(mconfig, *this),
m_adpcm_a_config("adpcm-a", ENDIANNESS_LITTLE, 8, 24, 0),
m_adpcm_b_config("adpcm-b", ENDIANNESS_LITTLE, 8, 24, 0),
m_adpcm_a_config("adpcm_a", ENDIANNESS_LITTLE, 8, 24, 0),
m_adpcm_b_config("adpcm_b", ENDIANNESS_LITTLE, 8, 24, 0),
m_adpcm_a_region(*this, "adpcma"),
m_adpcm_b_region(*this, "adpcmb")
{

File diff suppressed because it is too large Load Diff

@ -16,26 +16,34 @@
#include "debugcpu.h"
#include "debugcon.h"
#include <string_view>
class debugger_commands
{
public:
debugger_commands(running_machine& machine, debugger_cpu& cpu, debugger_console& console);
debugger_commands(running_machine &machine, debugger_cpu &cpu, debugger_console &console);
/* validates a parameter as a boolean value */
// validates a parameter as a boolean value
bool validate_boolean_parameter(const std::string &param, bool &result);
/* validates a parameter as a numeric value */
bool validate_number_parameter(const std::string &param, u64 &result);
// validates a parameter as a numeric value
bool validate_number_parameter(std::string_view param, u64 &result);
// validates a parameter as a device
bool validate_device_parameter(std::string_view param, device_t *&result);
/* validates a parameter as a cpu */
bool validate_cpu_parameter(const char *param, device_t *&result);
// validates a parameter as a CPU
bool validate_cpu_parameter(std::string_view param, device_t *&result);
/* validates a parameter as a cpu and retrieves the given address space */
bool validate_cpu_space_parameter(const char *param, int spacenum, address_space *&result);
// validates a parameter as an address space identifier
bool validate_device_space_parameter(std::string_view param, int spacenum, address_space *&result);
/* validates a parameter as a memory region name and retrieves the given region */
bool validate_memory_region_parameter(const std::string &param, memory_region *&result);
// validates a parameter as a target address and retrieves the given address space and address
bool validate_target_address_parameter(std::string_view param, int spacenum, address_space *&space, u64 &addr);
// validates a parameter as a memory region name and retrieves the given region
bool validate_memory_region_parameter(std::string_view param, memory_region *&result);
private:
struct global_entry
@ -67,7 +75,6 @@ private:
u8 swapped_cheat;
};
struct cheat_region_map
{
u64 offset;
@ -76,7 +83,9 @@ private:
u8 disabled;
};
bool debug_command_parameter_expression(const std::string &param, parsed_expression &result);
device_t &get_device_search_base(std::string_view &param);
device_t *get_cpu_by_index(u64 cpunum);
bool debug_command_parameter_expression(std::string_view param, parsed_expression &result);
bool debug_command_parameter_command(const char *param);
bool cheat_address_is_valid(address_space &space, offs_t address);
@ -84,14 +93,6 @@ 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(int params, const u64 *param);
u64 execute_max(int params, const u64 *param);
u64 execute_if(int params, const u64 *param);
u64 execute_abs(int params, const u64 *param);
u64 execute_bit(int params, const u64 *param);
u64 execute_s8(int params, const u64 *param);
u64 execute_s16(int params, const u64 *param);
u64 execute_s32(int params, const u64 *param);
u64 get_cpunum();
u64 global_get(global_entry *global);
@ -99,85 +100,85 @@ private:
int mini_printf(char *buffer, const char *format, int params, u64 *param);
void execute_trace_internal(int ref, const std::vector<std::string> &params, bool trace_over);
void execute_help(int ref, const std::vector<std::string> &params);
void execute_print(int ref, const std::vector<std::string> &params);
void execute_printf(int ref, const std::vector<std::string> &params);
void execute_logerror(int ref, const std::vector<std::string> &params);
void execute_tracelog(int ref, const std::vector<std::string> &params);
void execute_tracesym(int ref, const std::vector<std::string> &params);
void execute_cls(int ref, const std::vector<std::string> &params);
void execute_quit(int ref, const std::vector<std::string> &params);
void execute_do(int ref, const std::vector<std::string> &params);
void execute_step(int ref, const std::vector<std::string> &params);
void execute_over(int ref, const std::vector<std::string> &params);
void execute_out(int ref, const std::vector<std::string> &params);
void execute_go(int ref, const std::vector<std::string> &params);
void execute_go_vblank(int ref, const std::vector<std::string> &params);
void execute_go_interrupt(int ref, const std::vector<std::string> &params);
void execute_go_exception(int ref, const std::vector<std::string> &params);
void execute_go_time(int ref, const std::vector<std::string> &params);
void execute_go_privilege(int ref, const std::vector<std::string> &params);
void execute_focus(int ref, const std::vector<std::string> &params);
void execute_ignore(int ref, const std::vector<std::string> &params);
void execute_observe(int ref, const std::vector<std::string> &params);
void execute_suspend(int ref, const std::vector<std::string> &params);
void execute_resume(int ref, const std::vector<std::string> &params);
void execute_next(int ref, const std::vector<std::string> &params);
void execute_cpulist(int ref, const std::vector<std::string> &params);
void execute_comment_add(int ref, const std::vector<std::string> &params);
void execute_comment_del(int ref, const std::vector<std::string> &params);
void execute_comment_save(int ref, const std::vector<std::string> &params);
void execute_comment_list(int ref, const std::vector<std::string> &params);
void execute_comment_commit(int ref, const std::vector<std::string> &params);
void execute_bpset(int ref, const std::vector<std::string> &params);
void execute_bpclear(int ref, const std::vector<std::string> &params);
void execute_bpdisenable(int ref, const std::vector<std::string> &params);
void execute_bplist(int ref, const std::vector<std::string> &params);
void execute_wpset(int ref, const std::vector<std::string> &params);
void execute_wpclear(int ref, const std::vector<std::string> &params);
void execute_wpdisenable(int ref, const std::vector<std::string> &params);
void execute_wplist(int ref, const std::vector<std::string> &params);
void execute_rpset(int ref, const std::vector<std::string> &params);
void execute_rpclear(int ref, const std::vector<std::string> &params);
void execute_rpdisenable(int ref, const std::vector<std::string> &params);
void execute_rplist(int ref, const std::vector<std::string> &params);
void execute_statesave(int ref, const std::vector<std::string> &params);
void execute_stateload(int ref, const std::vector<std::string> &params);
void execute_rewind(int ref, const std::vector<std::string> &params);
void execute_save(int ref, const std::vector<std::string> &params);
void execute_saveregion(int ref, const std::vector<std::string> &params);
void execute_load(int ref, const std::vector<std::string> &params);
void execute_loadregion(int ref, const std::vector<std::string> &params);
void execute_dump(int ref, const std::vector<std::string> &params);
void execute_strdump(int ref, const std::vector<std::string> &params);
void execute_cheatinit(int ref, const std::vector<std::string> &params);
void execute_cheatnext(int ref, const std::vector<std::string> &params);
void execute_cheatlist(int ref, const std::vector<std::string> &params);
void execute_cheatundo(int ref, const std::vector<std::string> &params);
void execute_dasm(int ref, const std::vector<std::string> &params);
void execute_find(int ref, const std::vector<std::string> &params);
void execute_fill(int ref, const std::vector<std::string> &params);
void execute_trace(int ref, const std::vector<std::string> &params);
void execute_traceover(int ref, const std::vector<std::string> &params);
void execute_traceflush(int ref, const std::vector<std::string> &params);
void execute_history(int ref, const std::vector<std::string> &params);
void execute_trackpc(int ref, const std::vector<std::string> &params);
void execute_trackmem(int ref, const std::vector<std::string> &params);
void execute_pcatmem(int ref, const std::vector<std::string> &params);
void execute_snap(int ref, const std::vector<std::string> &params);
void execute_source(int ref, const std::vector<std::string> &params);
void execute_map(int ref, const std::vector<std::string> &params);
void execute_memdump(int ref, const std::vector<std::string> &params);
void execute_symlist(int ref, const std::vector<std::string> &params);
void execute_softreset(int ref, const std::vector<std::string> &params);
void execute_hardreset(int ref, const std::vector<std::string> &params);
void execute_images(int ref, const std::vector<std::string> &params);
void execute_mount(int ref, const std::vector<std::string> &params);
void execute_unmount(int ref, const std::vector<std::string> &params);
void execute_input(int ref, const std::vector<std::string> &params);
void execute_dumpkbd(int ref, const std::vector<std::string> &params);
void execute_trace_internal(const std::vector<std::string> &params, bool trace_over);
void execute_help(const std::vector<std::string> &params);
void execute_print(const std::vector<std::string> &params);
void execute_printf(const std::vector<std::string> &params);
void execute_logerror(const std::vector<std::string> &params);
void execute_tracelog(const std::vector<std::string> &params);
void execute_tracesym(const std::vector<std::string> &params);
void execute_cls(const std::vector<std::string> &params);
void execute_quit(const std::vector<std::string> &params);
void execute_do(const std::vector<std::string> &params);
void execute_step(const std::vector<std::string> &params);
void execute_over(const std::vector<std::string> &params);
void execute_out(const std::vector<std::string> &params);
void execute_go(const std::vector<std::string> &params);
void execute_go_vblank(const std::vector<std::string> &params);
void execute_go_interrupt(const std::vector<std::string> &params);
void execute_go_exception(const std::vector<std::string> &params);
void execute_go_time(const std::vector<std::string> &params);
void execute_go_privilege(const std::vector<std::string> &params);
void execute_focus(const std::vector<std::string> &params);
void execute_ignore(const std::vector<std::string> &params);
void execute_observe(const std::vector<std::string> &params);
void execute_suspend(const std::vector<std::string> &params);
void execute_resume(const std::vector<std::string> &params);
void execute_next(const std::vector<std::string> &params);
void execute_cpulist(const std::vector<std::string> &params);
void execute_comment_add(const std::vector<std::string> &params);
void execute_comment_del(const std::vector<std::string> &params);
void execute_comment_save(const std::vector<std::string> &params);
void execute_comment_list(const std::vector<std::string> &params);
void execute_comment_commit(const std::vector<std::string> &params);
void execute_bpset(const std::vector<std::string> &params);
void execute_bpclear(const std::vector<std::string> &params);
void execute_bpdisenable(bool enable, const std::vector<std::string> &params);
void execute_bplist(const std::vector<std::string> &params);
void execute_wpset(int spacenum, const std::vector<std::string> &params);
void execute_wpclear(const std::vector<std::string> &params);
void execute_wpdisenable(bool enable, const std::vector<std::string> &params);
void execute_wplist(const std::vector<std::string> &params);
void execute_rpset(const std::vector<std::string> &params);
void execute_rpclear(const std::vector<std::string> &params);
void execute_rpdisenable(bool enable, const std::vector<std::string> &params);
void execute_rplist(const std::vector<std::string> &params);
void execute_statesave(const std::vector<std::string> &params);
void execute_stateload(const std::vector<std::string> &params);
void execute_rewind(const std::vector<std::string> &params);
void execute_save(int spacenum, const std::vector<std::string> &params);
void execute_saveregion(const std::vector<std::string> &params);
void execute_load(int spacenum, const std::vector<std::string> &params);
void execute_loadregion(const std::vector<std::string> &params);
void execute_dump(int spacenum, const std::vector<std::string> &params);
void execute_strdump(int spacenum, const std::vector<std::string> &params);
void execute_cheatrange(bool init, const std::vector<std::string> &params);
void execute_cheatnext(bool initial, const std::vector<std::string> &params);
void execute_cheatlist(const std::vector<std::string> &params);
void execute_cheatundo(const std::vector<std::string> &params);
void execute_dasm(const std::vector<std::string> &params);
void execute_find(int spacenum, const std::vector<std::string> &params);
void execute_fill(int spacenum, const std::vector<std::string> &params);
void execute_trace(const std::vector<std::string> &params);
void execute_traceover(const std::vector<std::string> &params);
void execute_traceflush(const std::vector<std::string> &params);
void execute_history(const std::vector<std::string> &params);
void execute_trackpc(const std::vector<std::string> &params);
void execute_trackmem(const std::vector<std::string> &params);
void execute_pcatmem(int spacenum, const std::vector<std::string> &params);
void execute_snap(const std::vector<std::string> &params);
void execute_source(const std::vector<std::string> &params);
void execute_map(int spacenum, const std::vector<std::string> &params);
void execute_memdump(const std::vector<std::string> &params);
void execute_symlist(const std::vector<std::string> &params);
void execute_softreset(const std::vector<std::string> &params);
void execute_hardreset(const std::vector<std::string> &params);
void execute_images(const std::vector<std::string> &params);
void execute_mount(const std::vector<std::string> &params);
void execute_unmount(const std::vector<std::string> &params);
void execute_input(const std::vector<std::string> &params);
void execute_dumpkbd(const std::vector<std::string> &params);
running_machine& m_machine;
debugger_console& m_console;

@ -10,13 +10,19 @@
#include "emu.h"
#include "debugcon.h"
#include "debugcpu.h"
#include "debugvw.h"
#include "textbuf.h"
#include "debugger.h"
#include "corestr.h"
#include <cctype>
#include <fstream>
#include <iterator>
/***************************************************************************
CONSTANTS
@ -65,8 +71,8 @@ debugger_console::debugger_console(running_machine &machine)
m_machine.add_logerror_callback(std::bind(&debugger_console::errorlog_write_line, this, _1));
/* register our own custom-command help */
register_command("helpcustom", CMDFLAG_NONE, 0, 0, 0, std::bind(&debugger_console::execute_help_custom, this, _1, _2));
register_command("condump", CMDFLAG_NONE, 0, 1, 1, std::bind(&debugger_console::execute_condump, this, _1, _2));
register_command("helpcustom", CMDFLAG_NONE, 0, 0, std::bind(&debugger_console::execute_help_custom, this, _1));
register_command("condump", CMDFLAG_NONE, 1, 1, std::bind(&debugger_console::execute_condump, this, _1));
/* first CPU is visible by default */
for (device_t &device : device_enumerator(m_machine.root_device()))
@ -106,10 +112,25 @@ void debugger_console::exit()
***************************************************************************/
debugger_console::debug_command::debug_command(const char *_command, u32 _flags, int _ref, int _minparams, int _maxparams, std::function<void(int, const std::vector<std::string> &)> _handler)
: params(nullptr), help(nullptr), handler(std::move(_handler)), flags(_flags), ref(_ref), minparams(_minparams), maxparams(_maxparams)
inline bool debugger_console::debug_command::compare::operator()(const debug_command &a, const debug_command &b) const
{
return core_stricmp(a.command.c_str(), b.command.c_str()) < 0;
}
inline bool debugger_console::debug_command::compare::operator()(const char *a, const debug_command &b) const
{
return core_stricmp(a, b.command.c_str()) < 0;
}
inline bool debugger_console::debug_command::compare::operator()(const debug_command &a, const char *b) const
{
return core_stricmp(a.command.c_str(), b) < 0;
}
debugger_console::debug_command::debug_command(const char *_command, u32 _flags, int _minparams, int _maxparams, std::function<void (const std::vector<std::string> &)> &&_handler)
: command(_command), params(nullptr), help(nullptr), handler(std::move(_handler)), flags(_flags), minparams(_minparams), maxparams(_maxparams)
{
strcpy(command, _command);
}
@ -117,14 +138,14 @@ debugger_console::debug_command::debug_command(const char *_command, u32 _flags,
execute_help_custom - execute the helpcustom command
------------------------------------------------------------*/
void debugger_console::execute_help_custom(int ref, const std::vector<std::string> &params)
void debugger_console::execute_help_custom(const std::vector<std::string> &params)
{
char buf[64];
for (const debug_command &cmd : m_commandlist)
{
if (cmd.flags & CMDFLAG_CUSTOM_HELP)
{
snprintf(buf, 63, "%s help", cmd.command);
snprintf(buf, 63, "%s help", cmd.command.c_str());
buf[63] = 0;
char *temp_params[1] = { buf };
internal_execute_command(true, 1, &temp_params[0]);
@ -136,7 +157,7 @@ void debugger_console::execute_help_custom(int ref, const std::vector<std::strin
execute_condump - execute the condump command
------------------------------------------------------------*/
void debugger_console::execute_condump(int ref, const std::vector<std::string>& params)
void debugger_console::execute_condump(const std::vector<std::string>& params)
{
std::string filename = params[0];
const char* mode;
@ -245,15 +266,12 @@ void debugger_console::trim_parameter(char **paramptr, bool keep_quotes)
CMDERR debugger_console::internal_execute_command(bool execute, int params, char **param)
{
int i, foundcount = 0;
char *p, *command;
size_t len;
/* no params is an error */
// no params is an error
if (params == 0)
return CMDERR::none();
/* the first parameter has the command and the real first parameter; separate them */
// the first parameter has the command and the real first parameter; separate them
char *p, *command;
for (p = param[0]; *p && isspace(u8(*p)); p++) { }
for (command = p; *p && !isspace(u8(*p)); p++) { }
if (*p != 0)
@ -271,46 +289,39 @@ CMDERR debugger_console::internal_execute_command(bool execute, int params, char
param[0] = nullptr;
}
/* search the command list */
len = strlen(command);
debug_command *found = nullptr;
for (debug_command &cmd : m_commandlist)
if (!core_strnicmp(command, cmd.command, len))
{
foundcount++;
found = &cmd;
if (strlen(cmd.command) == len)
{
foundcount = 1;
break;
}
}
// search the command list
size_t const len = strlen(command);
auto const found = m_commandlist.lower_bound(command);
/* error if not found */
if (!found)
// error if not found
if ((m_commandlist.end() == found) || core_strnicmp(command, found->command.c_str(), len))
return CMDERR::unknown_command(0);
if (foundcount > 1)
return CMDERR::ambiguous_command(0);
if (found->command.length() > len)
{
auto const next = std::next(found);
if ((m_commandlist.end() != next) && !core_strnicmp(command, next->command.c_str(), len))
return CMDERR::ambiguous_command(0);
}
/* NULL-terminate and trim space around all the parameters */
for (i = 1; i < params; i++)
// NUL-terminate and trim space around all the parameters
for (int i = 1; i < params; i++)
*param[i]++ = 0;
/* now go back and trim quotes and braces and any spaces they reveal*/
for (i = 0; i < params; i++)
// now go back and trim quotes and braces and any spaces they reveal
for (int i = 0; i < params; i++)
trim_parameter(&param[i], found->flags & CMDFLAG_KEEP_QUOTES);
/* see if we have the right number of parameters */
// see if we have the right number of parameters
if (params < found->minparams)
return CMDERR::not_enough_params(0);
if (params > found->maxparams)
return CMDERR::too_many_params(0);
/* execute the handler */
// execute the handler
if (execute)
{
std::vector<std::string> params_vec(param, param + params);
found->handler(found->ref, params_vec);
found->handler(params_vec);
}
return CMDERR::none();
}
@ -457,15 +468,16 @@ CMDERR debugger_console::validate_command(const char *command)
register_command - register a command handler
-------------------------------------------------*/
void debugger_console::register_command(const char *command, u32 flags, int ref, int minparams, int maxparams, std::function<void(int, const std::vector<std::string> &)> handler)
void debugger_console::register_command(const char *command, u32 flags, int minparams, int maxparams, std::function<void (const std::vector<std::string> &)> &&handler)
{
if (m_machine.phase() != machine_phase::INIT)
throw emu_fatalerror("Can only call debugger_console::register_command() at init time!");
if (!(m_machine.debug_flags & DEBUG_FLAG_ENABLED))
throw emu_fatalerror("Cannot call debugger_console::register_command() when debugger is not running");
assert(strlen(command) < 32);
m_commandlist.emplace_front(command, flags, ref, minparams, maxparams, handler);
auto const ins = m_commandlist.emplace(command, flags, minparams, maxparams, std::move(handler));
if (!ins.second)
osd_printf_error("error: Duplicate debugger command %s registered\n", command);
}

@ -16,6 +16,7 @@
#include "textbuf.h"
#include <functional>
#include <set>
/***************************************************************************
@ -82,7 +83,7 @@ public:
// command handling
CMDERR execute_command(const std::string &command, bool echo);
CMDERR validate_command(const char *command);