diff options
| author | 2017-10-12 14:39:51 -0400 | |
|---|---|---|
| committer | 2017-10-12 14:39:51 -0400 | |
| commit | 8113e27292af16a28c00cbee7a712730f06aa301 (patch) | |
| tree | 3d5528975159c3c00a81585ae0d9c024563b918a /src/emu/debug/debugcon.cpp | |
| parent | a01b133b78166febc35506c3b08d9edccd5859d0 (diff) | |
device_state_interface: Polymorphism and std::function for entries (nw) (#2690)
* device_state_interface: Polymorphism and std::function for entries (nw)
- Create a templated subclass of device_state_entry to provide separate read/write interfaces for registers of varying widths. The efficiency impact of this should be minimal, given that this eliminates the need to make each byte width a subcase for reads and writes.
- Create similarly templated "pseudo-register" versions of device_state_entry that provides custom read/write interfaces through std::function. The intent of this is to eventually replace the dummy register + state_export interface hitherto necessary to provide debugger access to bankswitched or computed state registers.
- State registers can now be made read-only, and this is automatically done now when state_add is called with a std::function read handler but no write handler. This property is honored by MAME debug expressions.
* Add override keyword (nw)
* Remove explicit instantiations that were causing linking errors in tools build (nw)
Diffstat (limited to 'src/emu/debug/debugcon.cpp')
| -rw-r--r-- | src/emu/debug/debugcon.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/emu/debug/debugcon.cpp b/src/emu/debug/debugcon.cpp index 8b0cd786bff..16f15fbbc60 100644 --- a/src/emu/debug/debugcon.cpp +++ b/src/emu/debug/debugcon.cpp @@ -344,7 +344,7 @@ CMDERR debugger_console::execute_command(const std::string &command, bool echo) if (!echo) printf(">%s\n", command.c_str()); printf(" %*s^\n", CMDERR_ERROR_OFFSET(result), ""); - printf("%s\n", cmderr_to_string(result)); + printf("%s\n", cmderr_to_string(result).c_str()); } /* update all views */ @@ -404,8 +404,9 @@ void debugger_console::register_command(const char *command, u32 flags, int ref, for a given command error -------------------------------------------------*/ -const char *debugger_console::cmderr_to_string(CMDERR error) +std::string debugger_console::cmderr_to_string(CMDERR error) { + int offset = CMDERR_ERROR_OFFSET(error); switch (CMDERR_ERROR_CLASS(error)) { case CMDERR_UNKNOWN_COMMAND: return "unknown command"; @@ -414,7 +415,8 @@ const char *debugger_console::cmderr_to_string(CMDERR error) case CMDERR_UNBALANCED_QUOTES: return "unbalanced quotes"; case CMDERR_NOT_ENOUGH_PARAMS: return "not enough parameters for command"; case CMDERR_TOO_MANY_PARAMS: return "too many parameters for command"; - case CMDERR_EXPRESSION_ERROR: return "error in assignment expression"; + case CMDERR_EXPRESSION_ERROR: return string_format("error in assignment expression: %s", + expression_error(static_cast<expression_error::error_code>(offset)).code_string()); default: return "unknown error"; } } |
