mirror of
https://github.com/holub/mame
synced 2025-04-16 13:34:55 +03:00
Major refactoring of debugger core [Ryan Holtz]
* Eliminate globals/file statics * Remove lots of stuff from global scope * Use std::function for custom command registration * Eliminate some trampolines * Build fixes from Vas Crabb and balr0g
This commit is contained in:
parent
bf281b3cad
commit
56bd36c5ef
@ -244,7 +244,7 @@ UINT8 s3virge_vga_device::s3_crtc_reg_read(UINT8 index)
|
||||
break;
|
||||
default:
|
||||
res = vga.crtc.data[index];
|
||||
//debugger_break(machine);
|
||||
//machine.debugger().debug_break();
|
||||
//printf("%02x\n",index);
|
||||
break;
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ void alpha8201_cpu_device::M_UNDEFINED()
|
||||
osd_printf_debug("alpha8201: PC = %03x, Unimplemented opcode = %02x\n", m_pc.w.l-1, M_RDMEM(m_pc.w.l-1));
|
||||
#endif
|
||||
#if BREAK_ON_UNKNOWN_OPCODE
|
||||
debugger_break(machine());
|
||||
machine().debugger().debug_break();
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -287,7 +287,7 @@ void alpha8201_cpu_device::M_UNDEFINED2()
|
||||
osd_printf_debug("alpha8201: PC = %03x, Unimplemented opcode = %02x,%02x\n", m_pc.w.l-2, op,imm);
|
||||
#endif
|
||||
#if BREAK_ON_UNKNOWN_OPCODE
|
||||
debugger_break(machine());
|
||||
machine().debugger().debug_break();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1390,7 +1390,7 @@ void arm_cpu_device::HandleCoProVL86C020( UINT32 insn )
|
||||
0x00<<0 <- Revision number, 0
|
||||
*/
|
||||
SetRegister(rn, 0x41560300);
|
||||
//debugger_break(machine());
|
||||
//machine().debugger().debug_break();
|
||||
}
|
||||
else
|
||||
SetRegister(rn, m_coproRegister[crn]);
|
||||
@ -1407,7 +1407,7 @@ void arm_cpu_device::HandleCoProVL86C020( UINT32 insn )
|
||||
else
|
||||
{
|
||||
printf("%08x: Unimplemented VL86C020 copro instruction %08x %d %d\n", R15 & 0x3ffffff, insn,rn,crn);
|
||||
debugger_break(machine());
|
||||
machine().debugger().debug_break();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -706,7 +706,7 @@ void avr8_device::set_lock_bits(const UINT8 byte)
|
||||
|
||||
void avr8_device::unimplemented_opcode(UINT32 op)
|
||||
{
|
||||
// debugger_break(machine());
|
||||
// machine().debugger().debug_break();
|
||||
fatalerror("AVR8: unknown opcode (%08x) at %08x\n", op, m_shifted_pc);
|
||||
}
|
||||
|
||||
@ -2915,7 +2915,7 @@ READ8_MEMBER( avr8_device::regs_r )
|
||||
|
||||
default:
|
||||
printf("[%08X] AVR8: Unknown Register Read: 0x%03X\n", m_shifted_pc, offset);
|
||||
// debugger_break(machine());
|
||||
// machine().debugger().debug_break();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -358,7 +358,7 @@ inline void dsp32c_device::dau_set_val_flags(int aidx, double res)
|
||||
else if (absres > 3.40282e38)
|
||||
{
|
||||
m_VUflags = VFLAGBIT;
|
||||
// debugger_break(Machine);
|
||||
// machine().debugger().debug_break();
|
||||
// fprintf(stderr, "Result = %g\n", absres);
|
||||
res = (res < 0) ? -3.40282e38 : 3.40282e38;
|
||||
}
|
||||
@ -403,7 +403,7 @@ inline UINT32 dsp32c_device::double_to_dsp(double val)
|
||||
return 0x00000000;
|
||||
else if (exponent > 255)
|
||||
{
|
||||
// debugger_break(Machine);
|
||||
// machine().debugger().debug_break();
|
||||
// fprintf(stderr, "Exponent = %d\n", exponent);
|
||||
return ((INT32)id.i[BYTE_XOR_BE(0)] >= 0) ? 0x7fffffff : 0x800000ff;
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ void mips3_device::generate_exception(int exception, int backup)
|
||||
if (exception != 0)
|
||||
{
|
||||
fprintf(stderr, "Exception: PC=%08X, PPC=%08X\n", m_core->pc, m_ppc);
|
||||
debugger_break(machine());
|
||||
machine().debugger().debug_break();
|
||||
}
|
||||
*/
|
||||
|
||||
|
@ -297,7 +297,7 @@ WRITE32_MEMBER( psxcpu_device::biu_w )
|
||||
|
||||
void psxcpu_device::stop()
|
||||
{
|
||||
debugger_break( machine() );
|
||||
machine().debugger().debug_break();
|
||||
debugger_instruction_hook( this, m_pc );
|
||||
}
|
||||
|
||||
|
@ -3028,7 +3028,7 @@ inline void sh34_base_device::op1111_0xf13(const UINT16 opcode)
|
||||
FRCHG();
|
||||
break;
|
||||
default:
|
||||
debugger_break(machine());
|
||||
machine().debugger().debug_break();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@ -3041,7 +3041,7 @@ inline void sh34_base_device::op1111_0xf13(const UINT16 opcode)
|
||||
|
||||
void sh34_base_device::dbreak(const UINT16 opcode)
|
||||
{
|
||||
debugger_break(machine());
|
||||
machine().debugger().debug_break();
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,7 +74,7 @@ void tms3203x_device::illegal(UINT32 op)
|
||||
if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
|
||||
{
|
||||
logerror("Illegal op @ %06X: %08X (tbl=%03X)\n", m_pc - 1, op, op >> 21);
|
||||
debugger_break(machine());
|
||||
machine().debugger().debug_break();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -814,7 +814,7 @@ void tms3203x_device::execute_run()
|
||||
{
|
||||
// watch for out-of-range stack pointers
|
||||
if (IREG(TMR_SP) & 0xff000000)
|
||||
debugger_break(machine());
|
||||
machine().debugger().debug_break();
|
||||
if ((IREG(TMR_ST) & RMFLAG) && m_pc == IREG(TMR_RE) + 1)
|
||||
{
|
||||
if ((INT32)--IREG(TMR_RC) >= 0)
|
||||
|
@ -99,7 +99,7 @@ void tms340x0_device::unimpl(UINT16 op)
|
||||
if (m_pc == 0 || s_opcode_table[m_direct->read_word(TOBYTE(m_pc)) >> 4] == &tms34010_device::unimpl)
|
||||
{
|
||||
set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
|
||||
debugger_break(machine());
|
||||
machine().debugger().debug_break();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,45 +48,6 @@ static const char *const ints[4] = {
|
||||
int z8k_segm; /* Current disassembler mode: 0 - non-segmented, 1 - segmented */
|
||||
int z8k_segm_mode = Z8K_SEGM_MODE_AUTO; /* User disassembler mode setting: segmented, non-segmented, auto */
|
||||
|
||||
void z8k_disass_mode(running_machine &machine, int ref, int params, const char *param[])
|
||||
{
|
||||
size_t len;
|
||||
if (params == 1)
|
||||
{
|
||||
len = strlen(param[0]);
|
||||
if (!core_strnicmp(param[0], "segmented", len) || !core_stricmp(param[0], "z8001")) {
|
||||
z8k_segm = true;
|
||||
z8k_segm_mode = Z8K_SEGM_MODE_SEG;
|
||||
debug_console_printf(machine, "Disassembler mode set to Z8001/segmented\n");
|
||||
}
|
||||
else if (!core_strnicmp(param[0], "non-segmented", len) || !core_stricmp(param[0], "z8002")) {
|
||||
z8k_segm = false;
|
||||
z8k_segm_mode = Z8K_SEGM_MODE_NONSEG;
|
||||
debug_console_printf(machine, "Disassembler mode set to Z8002/non-segmented\n");
|
||||
}
|
||||
else if (!core_strnicmp(param[0], "automatic", len)) {
|
||||
z8k_segm_mode = Z8K_SEGM_MODE_AUTO;
|
||||
debug_console_printf(machine, "Disassembler mode set to automatic\n");
|
||||
}
|
||||
else
|
||||
goto usage;
|
||||
}
|
||||
else if (params > 1) {
|
||||
usage:
|
||||
debug_console_printf(machine, "Usage: z8k_disass_mode <mode>\n");
|
||||
debug_console_printf(machine, " set disassembler mode\n");
|
||||
debug_console_printf(machine, " mode: \"segmented\" or \"z8001\" - Z8001 mode\n");
|
||||
debug_console_printf(machine, " \"non-segmented\" or \"z8002\" - Z8002 mode\n");
|
||||
debug_console_printf(machine, " \"automatic\" - automatic mode\n");
|
||||
}
|
||||
else {
|
||||
debug_console_printf(machine, "Current disassembler mode: ");
|
||||
if (z8k_segm_mode == Z8K_SEGM_MODE_AUTO)
|
||||
debug_console_printf(machine, "automatic, currently ");
|
||||
debug_console_printf(machine, "%s\n", z8k_segm ? "Z8001/segmented" : "Z8002/non-segmented");
|
||||
}
|
||||
}
|
||||
|
||||
CPU_DISASSEMBLE( z8000 )
|
||||
{
|
||||
int new_pc = pc, i, j, tmp;
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
extern int z8k_segm;
|
||||
extern int z8k_segm_mode;
|
||||
extern void z8k_disass_mode(running_machine &machine, int ref, int params, const char *param[]);
|
||||
|
||||
#include "z8000cpu.h"
|
||||
|
||||
@ -642,7 +641,49 @@ void z8002_device::state_string_export(const device_state_entry &entry, std::str
|
||||
m_fcw & 0x0001 ? '?':'.');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void z8001_device::z8k_disass_mode(int ref, int params, const char *param[])
|
||||
{
|
||||
size_t len;
|
||||
if (params == 1)
|
||||
{
|
||||
len = strlen(param[0]);
|
||||
if (!core_strnicmp(param[0], "segmented", len) || !core_stricmp(param[0], "z8001")) {
|
||||
z8k_segm = true;
|
||||
z8k_segm_mode = Z8K_SEGM_MODE_SEG;
|
||||
machine().debugger().console().printf("Disassembler mode set to Z8001/segmented\n");
|
||||
}
|
||||
else if (!core_strnicmp(param[0], "non-segmented", len) || !core_stricmp(param[0], "z8002"))
|
||||
{
|
||||
z8k_segm = false;
|
||||
z8k_segm_mode = Z8K_SEGM_MODE_NONSEG;
|
||||
machine().debugger().console().printf("Disassembler mode set to Z8002/non-segmented\n");
|
||||
}
|
||||
else if (!core_strnicmp(param[0], "automatic", len))
|
||||
{
|
||||
z8k_segm_mode = Z8K_SEGM_MODE_AUTO;
|
||||
machine().debugger().console().printf("Disassembler mode set to automatic\n");
|
||||
}
|
||||
else
|
||||
goto usage;
|
||||
}
|
||||
else if (params > 1)
|
||||
{
|
||||
usage:
|
||||
machine().debugger().console().printf("Usage: z8k_disass_mode <mode>\n");
|
||||
machine().debugger().console().printf(" set disassembler mode\n");
|
||||
machine().debugger().console().printf(" mode: \"segmented\" or \"z8001\" - Z8001 mode\n");
|
||||
machine().debugger().console().printf(" \"non-segmented\" or \"z8002\" - Z8002 mode\n");
|
||||
machine().debugger().console().printf(" \"automatic\" - automatic mode\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
machine().debugger().console().printf("Current disassembler mode: ");
|
||||
if (z8k_segm_mode == Z8K_SEGM_MODE_AUTO)
|
||||
machine().debugger().console().printf("automatic, currently ");
|
||||
machine().debugger().console().printf("%s\n", z8k_segm ? "Z8001/segmented" : "Z8002/non-segmented");
|
||||
}
|
||||
}
|
||||
|
||||
void z8001_device::device_start()
|
||||
@ -664,7 +705,10 @@ void z8001_device::device_start()
|
||||
z8000_init_tables();
|
||||
|
||||
if (machine().debug_flags & DEBUG_FLAG_ENABLED)
|
||||
debug_console_register_command(machine(), "z8k_disass_mode", CMDFLAG_NONE, 0, 0, 1, z8k_disass_mode);
|
||||
{
|
||||
using namespace std::placeholders;
|
||||
machine().debugger().console().register_command("z8k_disass_mode", CMDFLAG_NONE, 0, 0, 1, std::bind(&z8001_device::z8k_disass_mode, this, _1, _2, _3));
|
||||
}
|
||||
|
||||
z8k_segm = true;
|
||||
|
||||
|
@ -665,6 +665,9 @@ protected:
|
||||
virtual UINT32 F_SEG_Z8001() override;
|
||||
virtual UINT32 PSA_ADDR() override;
|
||||
virtual UINT32 read_irq_vector() override;
|
||||
|
||||
private:
|
||||
void z8k_disass_mode(int ref, int params, const char *param[]);
|
||||
};
|
||||
|
||||
|
||||
|
@ -165,7 +165,7 @@ void aakart_device::device_timer(emu_timer &timer, device_timer_id id, int param
|
||||
READ8_MEMBER( aakart_device::read )
|
||||
{
|
||||
m_out_tx_cb(CLEAR_LINE);
|
||||
//debugger_break(machine());
|
||||
//machine().debugger().debug_break();
|
||||
return m_rx;
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ void ata_hle_device::process_command()
|
||||
m_status |= IDE_STATUS_ERR;
|
||||
m_error = IDE_ERROR_ABRT;
|
||||
set_irq(ASSERT_LINE);
|
||||
//debugger_break(device->machine());
|
||||
//machine().debugger().debug_break();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ WRITE16_MEMBER(l7a1045_sound_device::sound_data_w)
|
||||
READ16_MEMBER(l7a1045_sound_device::sound_data_r)
|
||||
{
|
||||
//printf("%04x (%04x %04x)\n",offset,m_audioregister,m_audiochannel);
|
||||
//debugger_break(machine());
|
||||
//machine().debugger().debug_break();
|
||||
l7a1045_voice *vptr = &m_voice[m_audiochannel];
|
||||
|
||||
switch(m_audioregister)
|
||||
|
@ -2664,7 +2664,7 @@ UINT8 s3_vga_device::s3_crtc_reg_read(UINT8 index)
|
||||
break;
|
||||
default:
|
||||
res = vga.crtc.data[index];
|
||||
//debugger_break(machine);
|
||||
//machine().debugger().debug_break();
|
||||
//printf("%02x\n",index);
|
||||
break;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Aaron Giles
|
||||
// copyright-holders:Aaron Giles,Ryan Holtz
|
||||
/*********************************************************************
|
||||
|
||||
debugcmd.h
|
||||
@ -8,31 +8,163 @@
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __DEBUGCMD_H__
|
||||
#define __DEBUGCMD_H__
|
||||
|
||||
#include "emu.h"
|
||||
#include "debugcpu.h"
|
||||
#include "debugcon.h"
|
||||
|
||||
/***************************************************************************
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
class parsed_expression;
|
||||
class symbol_table;
|
||||
|
||||
/* ----- initialization ----- */
|
||||
class debugger_commands
|
||||
{
|
||||
public:
|
||||
debugger_commands(running_machine& machine, debugger_cpu& cpu, debugger_console& console);
|
||||
|
||||
/* initializes the command system */
|
||||
void debug_command_init(running_machine &machine);
|
||||
/* validates a parameter as a numeric value */
|
||||
bool validate_number_parameter(const char *param, UINT64 *result);
|
||||
|
||||
/* validates a parameter as a cpu */
|
||||
bool validate_cpu_parameter(const char *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);
|
||||
|
||||
private:
|
||||
struct global_entry
|
||||
{
|
||||
void * base;
|
||||
UINT32 size;
|
||||
};
|
||||
|
||||
|
||||
struct cheat_map
|
||||
{
|
||||
UINT64 offset;
|
||||
UINT64 first_value;
|
||||
UINT64 previous_value;
|
||||
UINT8 state:1;
|
||||
UINT8 undo:7;
|
||||
};
|
||||
|
||||
/* ----- parameter validation ----- */
|
||||
// TODO [RH 31 May 2016]: Move this cheat stuff into its own class
|
||||
struct cheat_system
|
||||
{
|
||||
char cpu[2];
|
||||
UINT8 width;
|
||||
std::vector<cheat_map> cheatmap;
|
||||
UINT8 undo;
|
||||
UINT8 signed_cheat;
|
||||
UINT8 swapped_cheat;
|
||||
};
|
||||
|
||||
/* validates a number parameter */
|
||||
int debug_command_parameter_number(running_machine &machine, const char *param, UINT64 *result);
|
||||
|
||||
/* validates a parameter as a cpu */
|
||||
int debug_command_parameter_cpu(running_machine &machine, const char *param, device_t **result);
|
||||
struct cheat_region_map
|
||||
{
|
||||
UINT64 offset;
|
||||
UINT64 endoffset;
|
||||
const char *share;
|
||||
UINT8 disabled;
|
||||
};
|
||||
|
||||
/* validates a parameter as a cpu and retrieves the given address space */
|
||||
int debug_command_parameter_cpu_space(running_machine &machine, const char *param, int spacenum, address_space **result);
|
||||
bool debug_command_parameter_expression(const char *param, parsed_expression &result);
|
||||
bool debug_command_parameter_command(const char *param);
|
||||
|
||||
bool cheat_address_is_valid(address_space &space, offs_t address);
|
||||
UINT64 cheat_sign_extend(const cheat_system *cheatsys, UINT64 value);
|
||||
UINT64 cheat_byte_swap(const cheat_system *cheatsys, UINT64 value);
|
||||
UINT64 cheat_read_extended(const cheat_system *cheatsys, address_space &space, offs_t address);
|
||||
|
||||
UINT64 execute_min(symbol_table &table, void *ref, int params, const UINT64 *param);
|
||||
UINT64 execute_max(symbol_table &table, void *ref, int params, const UINT64 *param);
|
||||
UINT64 execute_if(symbol_table &table, void *ref, int params, const UINT64 *param);
|
||||
|
||||
UINT64 global_get(symbol_table &table, void *ref);
|
||||
void global_set(symbol_table &table, void *ref, UINT64 value);
|
||||
|
||||
int mini_printf(char *buffer, const char *format, int params, UINT64 *param);
|
||||
|
||||
void execute_trace_internal(int ref, int params, const char *param[], bool trace_over);
|
||||
|
||||
void execute_help(int ref, int params, const char **param);
|
||||
void execute_print(int ref, int params, const char **param);
|
||||
void execute_printf(int ref, int params, const char **param);
|
||||
void execute_logerror(int ref, int params, const char **param);
|
||||
void execute_tracelog(int ref, int params, const char **param);
|
||||
void execute_quit(int ref, int params, const char **param);
|
||||
void execute_do(int ref, int params, const char **param);
|
||||
void execute_step(int ref, int params, const char **param);
|
||||
void execute_over(int ref, int params, const char **param);
|
||||
void execute_out(int ref, int params, const char **param);
|
||||
void execute_go(int ref, int params, const char **param);
|
||||
void execute_go_vblank(int ref, int params, const char **param);
|
||||
void execute_go_interrupt(int ref, int params, const char **param);
|
||||
void execute_go_time(int ref, int params, const char *param[]);
|
||||
void execute_focus(int ref, int params, const char **param);
|
||||
void execute_ignore(int ref, int params, const char **param);
|
||||
void execute_observe(int ref, int params, const char **param);
|
||||
void execute_next(int ref, int params, const char **param);
|
||||
void execute_comment_add(int ref, int params, const char **param);
|
||||
void execute_comment_del(int ref, int params, const char **param);
|
||||
void execute_comment_save(int ref, int params, const char **param);
|
||||
void execute_comment_list(int ref, int params, const char **param);
|
||||
void execute_comment_commit(int ref, int params, const char **param);
|
||||
void execute_bpset(int ref, int params, const char **param);
|
||||
void execute_bpclear(int ref, int params, const char **param);
|
||||
void execute_bpdisenable(int ref, int params, const char **param);
|
||||
void execute_bplist(int ref, int params, const char **param);
|
||||
void execute_wpset(int ref, int params, const char **param);
|
||||
void execute_wpclear(int ref, int params, const char **param);
|
||||
void execute_wpdisenable(int ref, int params, const char **param);
|
||||
void execute_wplist(int ref, int params, const char **param);
|
||||
void execute_rpset(int ref, int params, const char **param);
|
||||
void execute_rpclear(int ref, int params, const char **param);
|
||||
void execute_rpdisenable(int ref, int params, const char **param);
|
||||
void execute_rplist(int ref, int params, const char **param);
|
||||
void execute_hotspot(int ref, int params, const char **param);
|
||||
void execute_statesave(int ref, int params, const char **param);
|
||||
void execute_stateload(int ref, int params, const char **param);
|
||||
void execute_save(int ref, int params, const char **param);
|
||||
void execute_load(int ref, int params, const char **param);
|
||||
void execute_dump(int ref, int params, const char **param);
|
||||
void execute_cheatinit(int ref, int params, const char **param);
|
||||
void execute_cheatnext(int ref, int params, const char **param);
|
||||
void execute_cheatlist(int ref, int params, const char **param);
|
||||
void execute_cheatundo(int ref, int params, const char **param);
|
||||
void execute_dasm(int ref, int params, const char **param);
|
||||
void execute_find(int ref, int params, const char **param);
|
||||
void execute_trace(int ref, int params, const char **param);
|
||||
void execute_traceover(int ref, int params, const char **param);
|
||||
void execute_traceflush(int ref, int params, const char **param);
|
||||
void execute_history(int ref, int params, const char **param);
|
||||
void execute_trackpc(int ref, int params, const char **param);
|
||||
void execute_trackmem(int ref, int params, const char **param);
|
||||
void execute_pcatmem(int ref, int params, const char **param);
|
||||
void execute_snap(int ref, int params, const char **param);
|
||||
void execute_source(int ref, int params, const char **param);
|
||||
void execute_map(int ref, int params, const char **param);
|
||||
void execute_memdump(int ref, int params, const char **param);
|
||||
void execute_symlist(int ref, int params, const char **param);
|
||||
void execute_softreset(int ref, int params, const char **param);
|
||||
void execute_hardreset(int ref, int params, const char **param);
|
||||
void execute_images(int ref, int params, const char **param);
|
||||
void execute_mount(int ref, int params, const char **param);
|
||||
void execute_unmount(int ref, int params, const char **param);
|
||||
void execute_input(int ref, int params, const char **param);
|
||||
void execute_dumpkbd(int ref, int params, const char **param);
|
||||
|
||||
running_machine& m_machine;
|
||||
debugger_cpu& m_cpu;
|
||||
debugger_console& m_console;
|
||||
|
||||
global_entry *m_global_array;
|
||||
cheat_system m_cheat;
|
||||
|
||||
static const size_t MAX_GLOBALS;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -16,8 +16,6 @@
|
||||
#include "debugger.h"
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
CONSTANTS
|
||||
***************************************************************************/
|
||||
@ -28,96 +26,61 @@
|
||||
#define ERRORLOG_BUF_SIZE (1024 * 1024)
|
||||
#define ERRORLOG_MAX_LINES (ERRORLOG_BUF_SIZE / 20)
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
TYPE DEFINITIONS
|
||||
***************************************************************************/
|
||||
|
||||
struct debug_command
|
||||
{
|
||||
debug_command * next;
|
||||
char command[32];
|
||||
const char * params;
|
||||
const char * help;
|
||||
void (*handler)(running_machine &machine, int ref, int params, const char **param);
|
||||
void (*handler_ex)(int ref);
|
||||
UINT32 flags;
|
||||
int ref;
|
||||
int minparams;
|
||||
int maxparams;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
LOCAL VARIABLES
|
||||
***************************************************************************/
|
||||
|
||||
static text_buffer *console_textbuf;
|
||||
static text_buffer *errorlog_textbuf;
|
||||
|
||||
static debug_command *commandlist;
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
static void debug_console_exit(running_machine &machine);
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
Initialization and tear down
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
debug_console_init - initializes the console
|
||||
system
|
||||
-------------------------------------------------*/
|
||||
|
||||
void debug_console_init(running_machine &machine)
|
||||
debugger_console::debugger_console(running_machine &machine)
|
||||
: m_machine(machine)
|
||||
, m_console_textbuf(nullptr)
|
||||
, m_errorlog_textbuf(nullptr)
|
||||
, m_commandlist(nullptr)
|
||||
{
|
||||
/* allocate text buffers */
|
||||
console_textbuf = text_buffer_alloc(CONSOLE_BUF_SIZE, CONSOLE_MAX_LINES);
|
||||
if (!console_textbuf)
|
||||
m_console_textbuf = text_buffer_alloc(CONSOLE_BUF_SIZE, CONSOLE_MAX_LINES);
|
||||
if (!m_console_textbuf)
|
||||
return;
|
||||
|
||||
errorlog_textbuf = text_buffer_alloc(ERRORLOG_BUF_SIZE, ERRORLOG_MAX_LINES);
|
||||
if (!errorlog_textbuf)
|
||||
m_errorlog_textbuf = text_buffer_alloc(ERRORLOG_BUF_SIZE, ERRORLOG_MAX_LINES);
|
||||
if (!m_errorlog_textbuf)
|
||||
return;
|
||||
|
||||
/* print the opening lines */
|
||||
debug_console_printf(machine, "%s debugger version %s\n", emulator_info::get_appname(), emulator_info::get_build_version());
|
||||
debug_console_printf(machine, "Currently targeting %s (%s)\n", machine.system().name, machine.system().description);
|
||||
printf("%s debugger version %s\n", emulator_info::get_appname(), emulator_info::get_build_version());
|
||||
printf("Currently targeting %s (%s)\n", m_machine.system().name, m_machine.system().description);
|
||||
|
||||
/* request callback upon exiting */
|
||||
machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(debug_console_exit), &machine));
|
||||
m_machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(debugger_console::exit), this));
|
||||
|
||||
/* listen in on the errorlog */
|
||||
using namespace std::placeholders;
|
||||
m_machine.add_logerror_callback(std::bind(&debugger_console::errorlog_write_line, this, _1));
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
debug_console_exit - frees the console
|
||||
system
|
||||
exit - frees the console system
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void debug_console_exit(running_machine &machine)
|
||||
void debugger_console::exit()
|
||||
{
|
||||
/* free allocated memory */
|
||||
if (console_textbuf)
|
||||
text_buffer_free(console_textbuf);
|
||||
console_textbuf = nullptr;
|
||||
if (m_console_textbuf)
|
||||
{
|
||||
text_buffer_free(m_console_textbuf);
|
||||
}
|
||||
m_console_textbuf = nullptr;
|
||||
|
||||
if (errorlog_textbuf)
|
||||
text_buffer_free(errorlog_textbuf);
|
||||
errorlog_textbuf = nullptr;
|
||||
if (m_errorlog_textbuf)
|
||||
{
|
||||
text_buffer_free(m_errorlog_textbuf);
|
||||
}
|
||||
m_errorlog_textbuf = nullptr;
|
||||
|
||||
/* free the command list */
|
||||
commandlist = nullptr;
|
||||
m_commandlist = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@ -133,16 +96,16 @@ static void debug_console_exit(running_machine &machine)
|
||||
command
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void trim_parameter(char **paramptr, int keep_quotes)
|
||||
void debugger_console::trim_parameter(char **paramptr, bool keep_quotes)
|
||||
{
|
||||
char *param = *paramptr;
|
||||
size_t len = strlen(param);
|
||||
int repeat;
|
||||
bool repeat;
|
||||
|
||||
/* loop until all adornments are gone */
|
||||
do
|
||||
{
|
||||
repeat = 0;
|
||||
repeat = false;
|
||||
|
||||
/* check for begin/end quotes */
|
||||
if (len >= 2 && param[0] == '"' && param[len - 1] == '"')
|
||||
@ -161,7 +124,7 @@ static void trim_parameter(char **paramptr, int keep_quotes)
|
||||
param[len - 1] = 0;
|
||||
param++;
|
||||
len -= 2;
|
||||
repeat = 1;
|
||||
repeat = true;
|
||||
}
|
||||
|
||||
/* check for leading spaces */
|
||||
@ -169,7 +132,7 @@ static void trim_parameter(char **paramptr, int keep_quotes)
|
||||
{
|
||||
param++;
|
||||
len--;
|
||||
repeat = 1;
|
||||
repeat = true;
|
||||
}
|
||||
|
||||
/* check for trailing spaces */
|
||||
@ -177,7 +140,7 @@ static void trim_parameter(char **paramptr, int keep_quotes)
|
||||
{
|
||||
param[len - 1] = 0;
|
||||
len--;
|
||||
repeat = 1;
|
||||
repeat = true;
|
||||
}
|
||||
} while (repeat);
|
||||
|
||||
@ -190,7 +153,7 @@ static void trim_parameter(char **paramptr, int keep_quotes)
|
||||
command
|
||||
-------------------------------------------------*/
|
||||
|
||||
static CMDERR internal_execute_command(running_machine &machine, int execute, int params, char **param)
|
||||
CMDERR debugger_console::internal_execute_command(bool execute, int params, char **param)
|
||||
{
|
||||
debug_command *cmd, *found = nullptr;
|
||||
int i, foundcount = 0;
|
||||
@ -221,7 +184,7 @@ static CMDERR internal_execute_command(running_machine &machine, int execute, in
|
||||
|
||||
/* search the command list */
|
||||
len = strlen(command);
|
||||
for (cmd = commandlist; cmd != nullptr; cmd = cmd->next)
|
||||
for (cmd = m_commandlist; cmd != nullptr; cmd = cmd->next)
|
||||
if (!strncmp(command, cmd->command, len))
|
||||
{
|
||||
foundcount++;
|
||||
@ -255,7 +218,7 @@ static CMDERR internal_execute_command(running_machine &machine, int execute, in
|
||||
|
||||
/* execute the handler */
|
||||
if (execute)
|
||||
(*found->handler)(machine, found->ref, params, (const char **)param);
|
||||
found->handler(found->ref, params, (const char **)param);
|
||||
return CMDERR_NONE;
|
||||
}
|
||||
|
||||
@ -265,7 +228,7 @@ static CMDERR internal_execute_command(running_machine &machine, int execute, in
|
||||
and either executes or just validates it
|
||||
-------------------------------------------------*/
|
||||
|
||||
static CMDERR internal_parse_command(running_machine &machine, const char *original_command, int execute)
|
||||
CMDERR debugger_console::internal_parse_command(const char *original_command, bool execute)
|
||||
{
|
||||
char command[MAX_COMMAND_LENGTH], parens[MAX_COMMAND_LENGTH];
|
||||
char *params[MAX_COMMAND_PARAMS] = { nullptr };
|
||||
@ -338,7 +301,7 @@ static CMDERR internal_parse_command(running_machine &machine, const char *origi
|
||||
try
|
||||
{
|
||||
UINT64 expresult;
|
||||
parsed_expression expression(debug_cpu_get_visible_symtable(machine), command_start, &expresult);
|
||||
parsed_expression expression(m_machine.debugger().cpu().get_visible_symtable(), command_start, &expresult);
|
||||
}
|
||||
catch (expression_error &err)
|
||||
{
|
||||
@ -347,7 +310,7 @@ static CMDERR internal_parse_command(running_machine &machine, const char *origi
|
||||
}
|
||||
else
|
||||
{
|
||||
result = internal_execute_command(machine, execute, paramcount, ¶ms[0]);
|
||||
result = internal_execute_command(execute, paramcount, ¶ms[0]);
|
||||
if (result != CMDERR_NONE)
|
||||
return MAKE_CMDERR(CMDERR_ERROR_CLASS(result), command_start - command);
|
||||
}
|
||||
@ -357,64 +320,59 @@ static CMDERR internal_parse_command(running_machine &machine, const char *origi
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
debug_console_execute_command - execute a
|
||||
command string
|
||||
execute_command - execute a command string
|
||||
-------------------------------------------------*/
|
||||
|
||||
CMDERR debug_console_execute_command(running_machine &machine, const char *command, int echo)
|
||||
CMDERR debugger_console::execute_command(const char *command, bool echo)
|
||||
{
|
||||
CMDERR result;
|
||||
|
||||
/* echo if requested */
|
||||
if (echo)
|
||||
debug_console_printf(machine, ">%s\n", command);
|
||||
printf(">%s\n", command);
|
||||
|
||||
/* parse and execute */
|
||||
result = internal_parse_command(machine, command, TRUE);
|
||||
result = internal_parse_command(command, TRUE);
|
||||
|
||||
/* display errors */
|
||||
if (result != CMDERR_NONE)
|
||||
{
|
||||
if (!echo)
|
||||
debug_console_printf(machine, ">%s\n", command);
|
||||
debug_console_printf(machine, " %*s^\n", CMDERR_ERROR_OFFSET(result), "");
|
||||
debug_console_printf(machine, "%s\n", debug_cmderr_to_string(result));
|
||||
printf(">%s\n", command);
|
||||
printf(" %*s^\n", CMDERR_ERROR_OFFSET(result), "");
|
||||
printf("%s\n", cmderr_to_string(result));
|
||||
}
|
||||
|
||||
/* update all views */
|
||||
if (echo)
|
||||
{
|
||||
machine.debug_view().update_all();
|
||||
machine.debugger().refresh_display();
|
||||
m_machine.debug_view().update_all();
|
||||
m_machine.debugger().refresh_display();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
debug_console_validate_command - validate a
|
||||
command string
|
||||
validate_command - validate a command string
|
||||
-------------------------------------------------*/
|
||||
|
||||
CMDERR debug_console_validate_command(running_machine &machine, const char *command)
|
||||
CMDERR debugger_console::validate_command(const char *command)
|
||||
{
|
||||
return internal_parse_command(machine, command, FALSE);
|
||||
return internal_parse_command(command, false);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
debug_console_register_command - register a
|
||||
command handler
|
||||
register_command - register a command handler
|
||||
-------------------------------------------------*/
|
||||
|
||||
void debug_console_register_command(running_machine &machine, const char *command, UINT32 flags, int ref, int minparams, int maxparams, void (*handler)(running_machine &machine, int ref, int params, const char **param))
|
||||
void debugger_console::register_command(const char *command, UINT32 flags, int ref, int minparams, int maxparams, std::function<void(int, int, const char **)> handler)
|
||||
{
|
||||
debug_command *cmd;
|
||||
assert_always(m_machine.phase() == MACHINE_PHASE_INIT, "Can only call register_command() at init time!");
|
||||
assert_always((m_machine.debug_flags & DEBUG_FLAG_ENABLED) != 0, "Cannot call register_command() when debugger is not running");
|
||||
|
||||
assert_always(machine.phase() == MACHINE_PHASE_INIT, "Can only call debug_console_register_command() at init time!");
|
||||
assert_always((machine.debug_flags & DEBUG_FLAG_ENABLED) != 0, "Cannot call debug_console_register_command() when debugger is not running");
|
||||
|
||||
cmd = auto_alloc_clear(machine, <debug_command>());
|
||||
debug_command *cmd = auto_alloc_clear(m_machine, <debug_command>());
|
||||
|
||||
/* fill in the command */
|
||||
strcpy(cmd->command, command);
|
||||
@ -425,8 +383,8 @@ void debug_console_register_command(running_machine &machine, const char *comman
|
||||
cmd->handler = handler;
|
||||
|
||||
/* link it */
|
||||
cmd->next = commandlist;
|
||||
commandlist = cmd;
|
||||
cmd->next = m_commandlist;
|
||||
m_commandlist = cmd;
|
||||
}
|
||||
|
||||
|
||||
@ -438,11 +396,11 @@ void debug_console_register_command(running_machine &machine, const char *comman
|
||||
***************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
debug_cmderr_to_string - return a friendly
|
||||
string for a given command error
|
||||
cmderr_to_string - return a friendly string
|
||||
for a given command error
|
||||
-------------------------------------------------*/
|
||||
|
||||
const char *debug_cmderr_to_string(CMDERR error)
|
||||
const char *debugger_console::cmderr_to_string(CMDERR error)
|
||||
{
|
||||
switch (CMDERR_ERROR_CLASS(error))
|
||||
{
|
||||
@ -466,83 +424,61 @@ const char *debug_cmderr_to_string(CMDERR error)
|
||||
***************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
debug_console_vprintf - vprintfs the given
|
||||
arguments using the format to the debug
|
||||
console
|
||||
vprintf - vprintfs the given arguments using
|
||||
the format to the debug console
|
||||
-------------------------------------------------*/
|
||||
|
||||
void debug_console_vprintf(running_machine &machine, util::format_argument_pack<std::ostream> const &args)
|
||||
void debugger_console::vprintf(util::format_argument_pack<std::ostream> const &args)
|
||||
{
|
||||
text_buffer_print(console_textbuf, util::string_format(args).c_str());
|
||||
text_buffer_print(m_console_textbuf, util::string_format(args).c_str());
|
||||
|
||||
/* force an update of any console views */
|
||||
machine.debug_view().update_all(DVT_CONSOLE);
|
||||
m_machine.debug_view().update_all(DVT_CONSOLE);
|
||||
}
|
||||
|
||||
void debug_console_vprintf(running_machine &machine, util::format_argument_pack<std::ostream> &&args)
|
||||
void debugger_console::vprintf(util::format_argument_pack<std::ostream> &&args)
|
||||
{
|
||||
text_buffer_print(console_textbuf, util::string_format(std::move(args)).c_str());
|
||||
text_buffer_print(m_console_textbuf, util::string_format(std::move(args)).c_str());
|
||||
|
||||
/* force an update of any console views */
|
||||
machine.debug_view().update_all(DVT_CONSOLE);
|
||||
m_machine.debug_view().update_all(DVT_CONSOLE);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
debug_console_vprintf_wrap - vprintfs the given
|
||||
arguments using the format to the debug
|
||||
console
|
||||
vprintf_wrap - vprintfs the given arguments
|
||||
using the format to the debug console
|
||||
-------------------------------------------------*/
|
||||
|
||||
void debug_console_vprintf_wrap(running_machine &machine, int wrapcol, util::format_argument_pack<std::ostream> const &args)
|
||||
void debugger_console::vprintf_wrap(int wrapcol, util::format_argument_pack<std::ostream> const &args)
|
||||
{
|
||||
text_buffer_print_wrap(console_textbuf, util::string_format(args).c_str(), wrapcol);
|
||||
text_buffer_print_wrap(m_console_textbuf, util::string_format(args).c_str(), wrapcol);
|
||||
|
||||
/* force an update of any console views */
|
||||
machine.debug_view().update_all(DVT_CONSOLE);
|
||||
m_machine.debug_view().update_all(DVT_CONSOLE);
|
||||
}
|
||||
|
||||
void debug_console_vprintf_wrap(running_machine &machine, int wrapcol, util::format_argument_pack<std::ostream> &&args)
|
||||
void debugger_console::vprintf_wrap(int wrapcol, util::format_argument_pack<std::ostream> &&args)
|
||||
{
|
||||
text_buffer_print_wrap(console_textbuf, util::string_format(std::move(args)).c_str(), wrapcol);
|
||||
text_buffer_print_wrap(m_console_textbuf, util::string_format(std::move(args)).c_str(), wrapcol);
|
||||
|
||||
/* force an update of any console views */
|
||||
machine.debug_view().update_all(DVT_CONSOLE);
|
||||
m_machine.debug_view().update_all(DVT_CONSOLE);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
debug_console_get_textbuf - return a pointer
|
||||
to the console text buffer
|
||||
errorlog_write_line - writes a line to the
|
||||
errorlog ring buffer
|
||||
-------------------------------------------------*/
|
||||
|
||||
text_buffer *debug_console_get_textbuf(void)
|
||||
void debugger_console::errorlog_write_line(const char *line)
|
||||
{
|
||||
return console_textbuf;
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
debug_errorlog_write_line - writes a line to
|
||||
the errorlog ring buffer
|
||||
-------------------------------------------------*/
|
||||
|
||||
void debug_errorlog_write_line(const running_machine &machine, const char *line)
|
||||
{
|
||||
if (errorlog_textbuf)
|
||||
text_buffer_print(errorlog_textbuf, line);
|
||||
if (m_errorlog_textbuf)
|
||||
{
|
||||
text_buffer_print(m_errorlog_textbuf, line);
|
||||
}
|
||||
|
||||
/* force an update of any log views */
|
||||
machine.debug_view().update_all(DVT_LOG);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
debug_errorlog_get_textbuf - return a pointer
|
||||
to the errorlog text buffer
|
||||
-------------------------------------------------*/
|
||||
|
||||
text_buffer *debug_errorlog_get_textbuf(void)
|
||||
{
|
||||
return errorlog_textbuf;
|
||||
m_machine.debug_view().update_all(DVT_LOG);
|
||||
}
|
||||
|
@ -11,10 +11,11 @@
|
||||
#ifndef __DEBUGCON_H__
|
||||
#define __DEBUGCON_H__
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "emu.h"
|
||||
#include "textbuf.h"
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
CONSTANTS
|
||||
***************************************************************************/
|
||||
@ -68,42 +69,67 @@
|
||||
/* CMDERR is an error code for command evaluation */
|
||||
typedef UINT32 CMDERR;
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
FUNCTION PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
/* initialization */
|
||||
void debug_console_init(running_machine &machine);
|
||||
|
||||
/* command handling */
|
||||
CMDERR debug_console_execute_command(running_machine &machine, const char *command, int echo);
|
||||
CMDERR debug_console_validate_command(running_machine &machine, const char *command);
|
||||
void debug_console_register_command(running_machine &machine, const char *command, UINT32 flags, int ref, int minparams, int maxparams, void (*handler)(running_machine &machine, int ref, int params, const char **param));
|
||||
const char * debug_cmderr_to_string(CMDERR error);
|
||||
|
||||
/* console management */
|
||||
void debug_console_vprintf(running_machine &machine, util::format_argument_pack<std::ostream> const &args);
|
||||
void debug_console_vprintf(running_machine &machine, util::format_argument_pack<std::ostream> &&args);
|
||||
void debug_console_vprintf_wrap(running_machine &machine, int wrapcol, util::format_argument_pack<std::ostream> const &args);
|
||||
void debug_console_vprintf_wrap(running_machine &machine, int wrapcol, util::format_argument_pack<std::ostream> &&args);
|
||||
text_buffer * debug_console_get_textbuf(void);
|
||||
|
||||
/* errorlog management */
|
||||
void debug_errorlog_write_line(const running_machine &machine, const char *line);
|
||||
text_buffer * debug_errorlog_get_textbuf(void);
|
||||
|
||||
/* convenience templates */
|
||||
template <typename Format, typename... Params>
|
||||
inline void debug_console_printf(running_machine &machine, Format &&fmt, Params &&...args)
|
||||
class debugger_console
|
||||
{
|
||||
debug_console_vprintf(machine, util::make_format_argument_pack(std::forward<Format>(fmt), std::forward<Params>(args)...));
|
||||
}
|
||||
template <typename Format, typename... Params>
|
||||
inline void debug_console_printf_wrap(running_machine &machine, int wrapcol, Format &&fmt, Params &&...args)
|
||||
{
|
||||
debug_console_vprintf_wrap(machine, wrapcol, util::make_format_argument_pack(std::forward<Format>(fmt), std::forward<Params>(args)...));
|
||||
}
|
||||
public:
|
||||
debugger_console(running_machine &machine);
|
||||
|
||||
/* command handling */
|
||||
CMDERR execute_command(const char *command, bool echo);
|
||||
CMDERR validate_command(const char *command);
|
||||
void register_command(const char *command, UINT32 flags, int ref, int minparams, int maxparams, std::function<void(int, int, const char **)> handler);
|
||||
|
||||
/* console management */
|
||||
void vprintf(util::format_argument_pack<std::ostream> const &args);
|
||||
void vprintf(util::format_argument_pack<std::ostream> &&args);
|
||||
void vprintf_wrap(int wrapcol, util::format_argument_pack<std::ostream> const &args);
|
||||
void vprintf_wrap(int wrapcol, util::format_argument_pack<std::ostream> &&args);
|
||||
text_buffer * get_console_textbuf() const { return m_console_textbuf; }
|
||||
|
||||
/* errorlog management */
|
||||
void errorlog_write_line(const char *line);
|
||||
text_buffer * get_errorlog_textbuf() const { return m_errorlog_textbuf; }
|
||||
|
||||
/* convenience templates */
|
||||
template <typename Format, typename... Params>
|
||||
inline void printf(Format &&fmt, Params &&...args)
|
||||
{
|
||||
vprintf(util::make_format_argument_pack(std::forward<Format>(fmt), std::forward<Params>(args)...));
|
||||
}
|
||||
template <typename Format, typename... Params>
|
||||
inline void printf_wrap(int wrapcol, Format &&fmt, Params &&...args)
|
||||
{
|
||||
vprintf_wrap(wrapcol, util::make_format_argument_pack(std::forward<Format>(fmt), std::forward<Params>(args)...));
|
||||
}
|
||||
|
||||
static const char * cmderr_to_string(CMDERR error);
|
||||
|
||||
private:
|
||||
void exit();
|
||||
|
||||
void trim_parameter(char **paramptr, bool keep_quotes);
|
||||
CMDERR internal_execute_command(bool execute, int params, char **param);
|
||||
CMDERR internal_parse_command(const char *original_command, bool execute);
|
||||
|
||||
struct debug_command
|
||||
{
|
||||
debug_command * next;
|
||||
char command[32];
|
||||
const char * params;
|
||||
const char * help;
|
||||
std::function<void(int, int, const char **)> handler;
|
||||
UINT32 flags;
|
||||
int ref;
|
||||
int minparams;
|
||||
int maxparams;
|
||||
};
|
||||
|
||||
running_machine &m_machine;
|
||||
|
||||
text_buffer *m_console_textbuf;
|
||||
text_buffer *m_errorlog_textbuf;
|
||||
|
||||
debug_command *m_commandlist;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -42,6 +42,8 @@ struct xml_data_node;
|
||||
|
||||
// ======================> device_debug
|
||||
|
||||
// [TODO] This whole thing is terrible.
|
||||
|
||||
class device_debug
|
||||
{
|
||||
typedef offs_t (*dasm_override_func)(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options);
|
||||
@ -118,10 +120,10 @@ public:
|
||||
// setters
|
||||
void setEnabled(bool value) { m_enabled = value; }
|
||||
|
||||
private:
|
||||
// internals
|
||||
bool hit(int type, offs_t address, int size);
|
||||
|
||||
private:
|
||||
const device_debug * m_debugInterface; // the interface we were created from
|
||||
watchpoint * m_next; // next in the list
|
||||
address_space & m_space; // address space
|
||||
@ -209,6 +211,7 @@ public:
|
||||
void go_exception(int exception);
|
||||
void go_milliseconds(UINT64 milliseconds);
|
||||
void go_next_device();
|
||||
|
||||
template <typename Format, typename... Params>
|
||||
void halt_on_next_instruction(Format &&fmt, Params &&... args)
|
||||
{
|
||||
@ -278,11 +281,13 @@ public:
|
||||
|
||||
static const int HISTORY_SIZE = 256;
|
||||
|
||||
// debugger_cpu helpers
|
||||
void compute_debug_flags();
|
||||
|
||||
private:
|
||||
void halt_on_next_instruction_impl(util::format_argument_pack<std::ostream> &&args);
|
||||
|
||||
// internal helpers
|
||||
void compute_debug_flags();
|
||||
void prepare_for_step_overout(offs_t pc);
|
||||
UINT32 dasm_wrapped(std::string &buffer, offs_t pc);
|
||||
|
||||
@ -462,100 +467,178 @@ private:
|
||||
DEBUG_FLAG_STOP_INTERRUPT | DEBUG_FLAG_STOP_EXCEPTION | DEBUG_FLAG_STOP_VBLANK | DEBUG_FLAG_STOP_TIME;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// FUNCTION PROTOTYPES
|
||||
// CPU DEBUGGING
|
||||
//**************************************************************************
|
||||
|
||||
/* ----- initialization and cleanup ----- */
|
||||
class debugger_cpu
|
||||
{
|
||||
public:
|
||||
debugger_cpu(running_machine &machine);
|
||||
|
||||
/* initialize the CPU tracking for the debugger */
|
||||
void debug_cpu_init(running_machine &machine);
|
||||
void debug_cpu_configure_memory(running_machine &machine, symbol_table &table);
|
||||
/* ----- initialization and cleanup ----- */
|
||||
|
||||
/* flushes all traces; this is useful if a trace is going on when we fatalerror */
|
||||
void debug_cpu_flush_traces(running_machine &machine);
|
||||
/* flushes all traces; this is useful if a trace is going on when we fatalerror */
|
||||
void flush_traces();
|
||||
|
||||
void configure_memory(symbol_table &table);
|
||||
|
||||
|
||||
/* ----- debugging status & information ----- */
|
||||
|
||||
/* ----- debugging status & information ----- */
|
||||
/* return the visible CPU device (the one that commands should apply to) */
|
||||
device_t *get_visible_cpu();
|
||||
|
||||
/* return the visible CPU device (the one that commands should apply to) */
|
||||
device_t *debug_cpu_get_visible_cpu(running_machine &machine);
|
||||
/* true if the debugger is currently stopped within an instruction hook callback */
|
||||
bool within_instruction_hook();
|
||||
|
||||
/* TRUE if the debugger is currently stopped within an instruction hook callback */
|
||||
int debug_cpu_within_instruction_hook(running_machine &machine);
|
||||
|
||||
/* return TRUE if the current execution state is stopped */
|
||||
int debug_cpu_is_stopped(running_machine &machine);
|
||||
/* return true if the current execution state is stopped */
|
||||
bool is_stopped();
|
||||
|
||||
|
||||
/* ----- symbol table interfaces ----- */
|
||||
|
||||
/* ----- symbol table interfaces ----- */
|
||||
/* return the global symbol table */
|
||||
symbol_table *get_global_symtable();
|
||||
|
||||
/* return the global symbol table */
|
||||
symbol_table *debug_cpu_get_global_symtable(running_machine &machine);
|
||||
|
||||
/* return the locally-visible symbol table */
|
||||
symbol_table *debug_cpu_get_visible_symtable(running_machine &machine);
|
||||
/* return the locally-visible symbol table */
|
||||
symbol_table *get_visible_symtable();
|
||||
|
||||
|
||||
/* ----- misc debugger functions ----- */
|
||||
|
||||
/* ----- misc debugger functions ----- */
|
||||
|
||||
/* specifies a debug command script to execute */
|
||||
void debug_cpu_source_script(running_machine &machine, const char *file);
|
||||
/* specifies a debug command script to execute */
|
||||
void source_script(const char *file);
|
||||
|
||||
|
||||
/* ----- debugger comment helpers ----- */
|
||||
|
||||
/* ----- debugger comment helpers ----- */
|
||||
// save all comments for a given machine
|
||||
bool comment_save();
|
||||
|
||||
// save all comments for a given machine
|
||||
bool debug_comment_save(running_machine &machine);
|
||||
|
||||
// load all comments for a given machine
|
||||
bool debug_comment_load(running_machine &machine,bool is_inline);
|
||||
// load all comments for a given machine
|
||||
bool comment_load(bool is_inline);
|
||||
|
||||
|
||||
/* ----- debugger memory accessors ----- */
|
||||
|
||||
/* ----- debugger memory accessors ----- */
|
||||
/* return the physical address corresponding to the given logical address */
|
||||
bool translate(address_space &space, int intention, offs_t *address);
|
||||
|
||||
/* return the physical address corresponding to the given logical address */
|
||||
int debug_cpu_translate(address_space &space, int intention, offs_t *address);
|
||||
/* return a byte from the specified memory space */
|
||||
UINT8 read_byte(address_space &space, offs_t address, int apply_translation);
|
||||
|
||||
/* return a byte from the specified memory space */
|
||||
UINT8 debug_read_byte(address_space &space, offs_t address, int apply_translation);
|
||||
/* return a word from the specified memory space */
|
||||
UINT16 read_word(address_space &space, offs_t address, int apply_translation);
|
||||
|
||||
/* return a word from the specified memory space */
|
||||
UINT16 debug_read_word(address_space &space, offs_t address, int apply_translation);
|
||||
/* return a dword from the specified memory space */
|
||||
UINT32 read_dword(address_space &space, offs_t address, int apply_translation);
|
||||
|
||||
/* return a dword from the specified memory space */
|
||||
UINT32 debug_read_dword(address_space &space, offs_t address, int apply_translation);
|
||||
/* return a qword from the specified memory space */
|
||||
UINT64 read_qword(address_space &space, offs_t address, int apply_translation);
|
||||
|
||||
/* return a qword from the specified memory space */
|
||||
UINT64 debug_read_qword(address_space &space, offs_t address, int apply_translation);
|
||||
/* return 1,2,4 or 8 bytes from the specified memory space */
|
||||
UINT64 read_memory(address_space &space, offs_t address, int size, int apply_translation);
|
||||
|
||||
/* return 1,2,4 or 8 bytes from the specified memory space */
|
||||
UINT64 debug_read_memory(address_space &space, offs_t address, int size, int apply_translation);
|
||||
/* write a byte to the specified memory space */
|
||||
void write_byte(address_space &space, offs_t address, UINT8 data, int apply_translation);
|
||||
|
||||
/* write a byte to the specified memory space */
|
||||
void debug_write_byte(address_space &space, offs_t address, UINT8 data, int apply_translation);
|
||||
/* write a word to the specified memory space */
|
||||
void write_word(address_space &space, offs_t address, UINT16 data, int apply_translation);
|
||||
|
||||
/* write a word to the specified memory space */
|
||||
void debug_write_word(address_space &space, offs_t address, UINT16 data, int apply_translation);
|
||||
/* write a dword to the specified memory space */
|
||||
void write_dword(address_space &space, offs_t address, UINT32 data, int apply_translation);
|
||||
|
||||
/* write a dword to the specified memory space */
|
||||
void debug_write_dword(address_space &space, offs_t address, UINT32 data, int apply_translation);
|
||||
/* write a qword to the specified memory space */
|
||||
void write_qword(address_space &space, offs_t address, UINT64 data, int apply_translation);
|
||||
|
||||
/* write a qword to the specified memory space */
|
||||
void debug_write_qword(address_space &space, offs_t address, UINT64 data, int apply_translation);
|
||||
/* write 1,2,4 or 8 bytes to the specified memory space */
|
||||
void write_memory(address_space &space, offs_t address, UINT64 data, int size, int apply_translation);
|
||||
|
||||
/* write 1,2,4 or 8 bytes to the specified memory space */
|
||||
void debug_write_memory(address_space &space, offs_t address, UINT64 data, int size, int apply_translation);
|
||||
/* read 1,2,4 or 8 bytes at the given offset from opcode space */
|
||||
UINT64 read_opcode(address_space &space, offs_t offset, int size);
|
||||
|
||||
/* read 1,2,4 or 8 bytes at the given offset from opcode space */
|
||||
UINT64 debug_read_opcode(address_space &space, offs_t offset, int size);
|
||||
// getters
|
||||
bool within_instruction_hook() const { return m_within_instruction_hook; }
|
||||
bool memory_modified() const { return m_memory_modified; }
|
||||
int execution_state() const { return m_execution_state; }
|
||||
device_t *live_cpu() { return m_livecpu; }
|
||||
UINT32 get_breakpoint_index() { return m_bpindex++; }
|
||||
UINT32 get_watchpoint_index() { return m_wpindex++; }
|
||||
UINT32 get_registerpoint_index() { return m_rpindex++; }
|
||||
|
||||
// setters
|
||||
void set_visible_cpu(device_t * visiblecpu) { m_visiblecpu = visiblecpu; }
|
||||
void set_break_cpu(device_t * breakcpu) { m_breakcpu = breakcpu; }
|
||||
void set_within_instruction(bool within_instruction) { m_within_instruction_hook = within_instruction; }
|
||||
void set_memory_modified(bool memory_modified) { m_memory_modified = memory_modified; }
|
||||
void set_execution_state(int execution_state) { m_execution_state = execution_state; }
|
||||
|
||||
// device_debug helpers
|
||||
// [TODO] [RH]: Look into this more later, can possibly merge these two classes
|
||||
void start_hook(device_t *device, bool stop_on_vblank);
|
||||
void stop_hook(device_t *device);
|
||||
void go_next_device(device_t *device);
|
||||
void go_vblank();
|
||||
void halt_on_next_instruction(device_t *device, util::format_argument_pack<std::ostream> &&args);
|
||||
void ensure_comments_loaded();
|
||||
void reset_transient_flags();
|
||||
void process_source_file();
|
||||
void watchpoint_check(address_space& space, int type, offs_t address, UINT64 value_to_write, UINT64 mem_mask, device_debug::watchpoint** wplist);
|
||||
|
||||
private:
|
||||
static const size_t NUM_TEMP_VARIABLES;
|
||||
|
||||
/* expression handlers */
|
||||
UINT64 expression_read_memory(void *param, const char *name, expression_space space, UINT32 address, int size);
|
||||
UINT64 expression_read_program_direct(address_space &space, int opcode, offs_t address, int size);
|
||||
UINT64 expression_read_memory_region(const char *rgntag, offs_t address, int size);
|
||||
void expression_write_memory(void *param, const char *name, expression_space space, UINT32 address, int size, UINT64 data);
|
||||
void expression_write_program_direct(address_space &space, int opcode, offs_t address, int size, UINT64 data);
|
||||
void expression_write_memory_region(const char *rgntag, offs_t address, int size, UINT64 data);
|
||||
expression_error::error_code expression_validate(void *param, const char *name, expression_space space);
|
||||
device_t* expression_get_device(const char *tag);
|
||||
|
||||
/* variable getters/setters */
|
||||
UINT64 get_cpunum(symbol_table &table, void *ref);
|
||||
UINT64 get_beamx(symbol_table &table, void *ref);
|
||||
UINT64 get_beamy(symbol_table &table, void *ref);
|
||||
UINT64 get_frame(symbol_table &table, void *ref);
|
||||
|
||||
/* internal helpers */
|
||||
void exit();
|
||||
void on_vblank(screen_device &device, bool vblank_state);
|
||||
|
||||
running_machine& m_machine;
|
||||
|
||||
device_t * m_livecpu;
|
||||
device_t * m_visiblecpu;
|
||||
device_t * m_breakcpu;
|
||||
|
||||
FILE * m_source_file; // script source file
|
||||
|
||||
symbol_table * m_symtable; // global symbol table
|
||||
|
||||
bool m_within_instruction_hook;
|
||||
bool m_vblank_occurred;
|
||||
bool m_memory_modified;
|
||||
bool m_debugger_access;
|
||||
|
||||
int m_execution_state;
|
||||
device_t * m_stop_when_not_device; // stop execution when the device ceases to be this
|
||||
|
||||
UINT32 m_bpindex;
|
||||
UINT32 m_wpindex;
|
||||
UINT32 m_rpindex;
|
||||
|
||||
UINT64 m_wpdata;
|
||||
UINT64 m_wpaddr;
|
||||
std::unique_ptr<UINT64[]> m_tempvar;
|
||||
|
||||
osd_ticks_t m_last_periodic_update_time;
|
||||
|
||||
bool m_comments_loaded;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "dvbpoints.h"
|
||||
#include "dvwpoints.h"
|
||||
#include "debugcpu.h"
|
||||
#include "debugger.h"
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
@ -452,11 +453,11 @@ debug_view *debug_view_manager::append(debug_view *view)
|
||||
//-------------------------------------------------
|
||||
|
||||
debug_view_expression::debug_view_expression(running_machine &machine)
|
||||
: m_machine(machine),
|
||||
m_dirty(true),
|
||||
m_result(0),
|
||||
m_parsed(debug_cpu_get_global_symtable(machine)),
|
||||
m_string("0")
|
||||
: m_machine(machine)
|
||||
, m_dirty(true)
|
||||
, m_result(0)
|
||||
, m_parsed(machine.debugger().cpu().get_global_symtable())
|
||||
, m_string("0")
|
||||
{
|
||||
}
|
||||
|
||||
@ -477,7 +478,7 @@ debug_view_expression::~debug_view_expression()
|
||||
|
||||
void debug_view_expression::set_context(symbol_table *context)
|
||||
{
|
||||
m_parsed.set_symbols((context != nullptr) ? context : debug_cpu_get_global_symtable(machine()));
|
||||
m_parsed.set_symbols((context != nullptr) ? context : m_machine.debugger().cpu().get_global_symtable());
|
||||
m_dirty = true;
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "debugvw.h"
|
||||
#include "dvdisasm.h"
|
||||
#include "debugcpu.h"
|
||||
|
||||
#include "debugger.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
@ -254,8 +254,8 @@ offs_t debug_view_disasm::find_pc_backwards(offs_t targetpc, int numinstrs)
|
||||
while (curpcbyte < fillpcbyte)
|
||||
{
|
||||
fillpcbyte--;
|
||||
opbuf[1000 + fillpcbyte - targetpcbyte] = debug_read_opcode(source.m_decrypted_space, fillpcbyte, 1);
|
||||
argbuf[1000 + fillpcbyte - targetpcbyte] = debug_read_opcode(source.m_space, fillpcbyte, 1);
|
||||
opbuf[1000 + fillpcbyte - targetpcbyte] = machine().debugger().cpu().read_opcode(source.m_decrypted_space, fillpcbyte, 1);
|
||||
argbuf[1000 + fillpcbyte - targetpcbyte] = machine().debugger().cpu().read_opcode(source.m_space, fillpcbyte, 1);
|
||||
}
|
||||
|
||||
// loop until we get past the target instruction
|
||||
@ -269,7 +269,7 @@ offs_t debug_view_disasm::find_pc_backwards(offs_t targetpc, int numinstrs)
|
||||
|
||||
// get the disassembly, but only if mapped
|
||||
instlen = 1;
|
||||
if (debug_cpu_translate(source.m_space, TRANSLATE_FETCH, &physpcbyte))
|
||||
if (machine().debugger().cpu().translate(source.m_space, TRANSLATE_FETCH, &physpcbyte))
|
||||
{
|
||||
char dasmbuffer[100];
|
||||
instlen = source.device()->debug()->disassemble(dasmbuffer, scanpc, &opbuf[1000 + scanpcbyte - targetpcbyte], &argbuf[1000 + scanpcbyte - targetpcbyte]) & DASMFLAG_LENGTHMASK;
|
||||
@ -315,12 +315,12 @@ void debug_view_disasm::generate_bytes(offs_t pcbyte, int numbytes, int minbytes
|
||||
// output the first value
|
||||
int offset = 0;
|
||||
if (maxchars >= char_num * minbytes)
|
||||
offset += util::stream_format(m_dasm, source.m_space.is_octal() ? "%0*o" : "%0*X", minbytes * char_num, debug_read_opcode(source.m_decrypted_space, pcbyte, minbytes));
|
||||
offset += util::stream_format(m_dasm, source.m_space.is_octal() ? "%0*o" : "%0*X", minbytes * char_num, machine().debugger().cpu().read_opcode(source.m_decrypted_space, pcbyte, minbytes));
|
||||
|
||||
// output subsequent values
|
||||
int byte;
|
||||
for (byte = minbytes; byte < numbytes && offset + 1 + char_num * minbytes < maxchars; byte += minbytes)
|
||||
offset += util::stream_format(m_dasm, source.m_space.is_octal() ? " %0*o" : " %0*X", minbytes * char_num, debug_read_opcode(encrypted ? source.m_space : source.m_decrypted_space, pcbyte + byte, minbytes));
|
||||
offset += util::stream_format(m_dasm, source.m_space.is_octal() ? " %0*o" : " %0*X", minbytes * char_num, machine().debugger().cpu().read_opcode(encrypted ? source.m_space : source.m_decrypted_space, pcbyte + byte, minbytes));
|
||||
|
||||
// if we ran out of room, indicate more
|
||||
if ((byte < numbytes) && (byte != minbytes) && (maxchars > 3))
|
||||
@ -395,15 +395,15 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines)
|
||||
char buffer[100];
|
||||
int numbytes = 0;
|
||||
offs_t physpcbyte = pcbyte;
|
||||
if (debug_cpu_translate(source.m_space, TRANSLATE_FETCH_DEBUG, &physpcbyte))
|
||||
if (machine().debugger().cpu().translate(source.m_space, TRANSLATE_FETCH_DEBUG, &physpcbyte))
|
||||
{
|
||||
UINT8 opbuf[64], argbuf[64];
|
||||
|
||||
// fetch the bytes up to the maximum
|
||||
for (numbytes = 0; numbytes < maxbytes; numbytes++)
|
||||
{
|
||||
opbuf[numbytes] = debug_read_opcode(source.m_decrypted_space, pcbyte + numbytes, 1);
|
||||
argbuf[numbytes] = debug_read_opcode(source.m_space, pcbyte + numbytes, 1);
|
||||
opbuf[numbytes] = machine().debugger().cpu().read_opcode(source.m_decrypted_space, pcbyte + numbytes, 1);
|
||||
argbuf[numbytes] = machine().debugger().cpu().read_opcode(source.m_space, pcbyte + numbytes, 1);
|
||||
}
|
||||
|
||||
// disassemble the result
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "debugvw.h"
|
||||
#include "dvmemory.h"
|
||||
#include "debugcpu.h"
|
||||
#include "debugger.h"
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
@ -747,10 +748,10 @@ bool debug_view_memory::read(UINT8 size, offs_t offs, UINT64 &data)
|
||||
{
|
||||
switch (size)
|
||||
{
|
||||
case 1: data = debug_read_byte(*source.m_space, offs, !m_no_translation); break;
|
||||
case 2: data = debug_read_word(*source.m_space, offs, !m_no_translation); break;
|
||||
case 4: data = debug_read_dword(*source.m_space, offs, !m_no_translation); break;
|
||||
case 8: data = debug_read_qword(*source.m_space, offs, !m_no_translation); break;
|
||||
case 1: data = machine().debugger().cpu().read_byte(*source.m_space, offs, !m_no_translation); break;
|
||||
case 2: data = machine().debugger().cpu().read_word(*source.m_space, offs, !m_no_translation); break;
|
||||
case 4: data = machine().debugger().cpu().read_dword(*source.m_space, offs, !m_no_translation); break;
|
||||
case 8: data = machine().debugger().cpu().read_qword(*source.m_space, offs, !m_no_translation); break;
|
||||
}
|
||||
}
|
||||
return ismapped;
|
||||
@ -819,10 +820,10 @@ void debug_view_memory::write(UINT8 size, offs_t offs, UINT64 data)
|
||||
{
|
||||
switch (size)
|
||||
{
|
||||
case 1: debug_write_byte(*source.m_space, offs, data, !m_no_translation); break;
|
||||
case 2: debug_write_word(*source.m_space, offs, data, !m_no_translation); break;
|
||||
case 4: debug_write_dword(*source.m_space, offs, data, !m_no_translation); break;
|
||||
case 8: debug_write_qword(*source.m_space, offs, data, !m_no_translation); break;
|
||||
case 1: machine().debugger().cpu().write_byte(*source.m_space, offs, data, !m_no_translation); break;
|
||||
case 2: machine().debugger().cpu().write_word(*source.m_space, offs, data, !m_no_translation); break;
|
||||
case 4: machine().debugger().cpu().write_dword(*source.m_space, offs, data, !m_no_translation); break;
|
||||
case 8: machine().debugger().cpu().write_qword(*source.m_space, offs, data, !m_no_translation); break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -12,8 +12,7 @@
|
||||
#include "debugvw.h"
|
||||
#include "dvtext.h"
|
||||
#include "debugcon.h"
|
||||
|
||||
|
||||
#include "debugger.h"
|
||||
|
||||
//**************************************************************************
|
||||
// DEBUG VIEW TEXTBUF
|
||||
@ -135,7 +134,7 @@ void debug_view_textbuf::view_notify(debug_view_notification type)
|
||||
//-------------------------------------------------
|
||||
|
||||
debug_view_console::debug_view_console(running_machine &machine, debug_view_osd_update_func osdupdate, void *osdprivate)
|
||||
: debug_view_textbuf(machine, DVT_CONSOLE, osdupdate, osdprivate, *debug_console_get_textbuf())
|
||||
: debug_view_textbuf(machine, DVT_CONSOLE, osdupdate, osdprivate, *machine.debugger().console().get_console_textbuf())
|
||||
{
|
||||
}
|
||||
|
||||
@ -150,6 +149,6 @@ debug_view_console::debug_view_console(running_machine &machine, debug_view_osd_
|
||||
//-------------------------------------------------
|
||||
|
||||
debug_view_log::debug_view_log(running_machine &machine, debug_view_osd_update_func osdupdate, void *osdprivate)
|
||||
: debug_view_textbuf(machine, DVT_LOG, osdupdate, osdprivate, *debug_errorlog_get_textbuf())
|
||||
: debug_view_textbuf(machine, DVT_LOG, osdupdate, osdprivate, *machine.debugger().console().get_errorlog_textbuf())
|
||||
{
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ bool integer_symbol_entry::is_lval() const
|
||||
|
||||
UINT64 integer_symbol_entry::value() const
|
||||
{
|
||||
return (*m_getter)(m_table, m_ref);
|
||||
return m_getter(m_table, m_ref);
|
||||
}
|
||||
|
||||
|
||||
@ -285,7 +285,7 @@ UINT64 integer_symbol_entry::value() const
|
||||
void integer_symbol_entry::set_value(UINT64 newvalue)
|
||||
{
|
||||
if (m_setter != nullptr)
|
||||
(*m_setter)(m_table, m_ref, newvalue);
|
||||
m_setter(m_table, m_ref, newvalue);
|
||||
else
|
||||
throw emu_fatalerror("Symbol '%s' is read-only", m_name.c_str());
|
||||
}
|
||||
@ -371,7 +371,7 @@ UINT64 function_symbol_entry::execute(int numparams, const UINT64 *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, m_ref, numparams, paramlist);
|
||||
}
|
||||
|
||||
|
||||
@ -504,7 +504,7 @@ expression_error::error_code symbol_table::memory_valid(const char *name, expres
|
||||
for (symbol_table *symtable = this; symtable != nullptr; symtable = symtable->m_parent)
|
||||
if (symtable->m_memory_valid != nullptr)
|
||||
{
|
||||
expression_error::error_code err = (*symtable->m_memory_valid)(symtable->m_memory_param, name, space);
|
||||
expression_error::error_code err = symtable->m_memory_valid(symtable->m_memory_param, name, space);
|
||||
if (err != expression_error::NO_SUCH_MEMORY_SPACE)
|
||||
return err;
|
||||
}
|
||||
@ -522,9 +522,9 @@ UINT64 symbol_table::memory_value(const char *name, expression_space space, UINT
|
||||
for (symbol_table *symtable = this; symtable != nullptr; symtable = symtable->m_parent)
|
||||
if (symtable->m_memory_valid != nullptr)
|
||||
{
|
||||
expression_error::error_code err = (*symtable->m_memory_valid)(symtable->m_memory_param, name, space);
|
||||
expression_error::error_code err = symtable->m_memory_valid(symtable->m_memory_param, name, space);
|
||||
if (err != expression_error::NO_SUCH_MEMORY_SPACE && symtable->m_memory_read != nullptr)
|
||||
return (*symtable->m_memory_read)(symtable->m_memory_param, name, space, offset, size);
|
||||
return symtable->m_memory_read(symtable->m_memory_param, name, space, offset, size);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
@ -541,9 +541,9 @@ void symbol_table::set_memory_value(const char *name, expression_space space, UI
|
||||
for (symbol_table *symtable = this; symtable != nullptr; symtable = symtable->m_parent)
|
||||
if (symtable->m_memory_valid != nullptr)
|
||||
{
|
||||
expression_error::error_code err = (*symtable->m_memory_valid)(symtable->m_memory_param, name, space);
|
||||
expression_error::error_code err = symtable->m_memory_valid(symtable->m_memory_param, name, space);
|
||||
if (err != expression_error::NO_SUCH_MEMORY_SPACE && symtable->m_memory_write != nullptr)
|
||||
(*symtable->m_memory_write)(symtable->m_memory_param, name, space, offset, size, value);
|
||||
symtable->m_memory_write(symtable->m_memory_param, name, space, offset, size, value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,8 @@
|
||||
#ifndef __EXPRESS_H__
|
||||
#define __EXPRESS_H__
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
|
||||
@ -148,16 +150,16 @@ class symbol_table
|
||||
{
|
||||
public:
|
||||
// callback functions for getting/setting a symbol value
|
||||
typedef UINT64 (*getter_func)(symbol_table &table, void *symref);
|
||||
typedef void (*setter_func)(symbol_table &table, void *symref, UINT64 value);
|
||||
typedef std::function<UINT64(symbol_table &table, void *symref)> getter_func;
|
||||
typedef std::function<void(symbol_table &table, void *symref, UINT64 value)> setter_func;
|
||||
|
||||
// callback functions for function execution
|
||||
typedef UINT64 (*execute_func)(symbol_table &table, void *symref, int numparams, const UINT64 *paramlist);
|
||||
typedef std::function<UINT64(symbol_table &table, void *symref, int numparams, const UINT64 *paramlist)> execute_func;
|
||||
|
||||
// callback functions for memory reads/writes
|
||||
typedef expression_error::error_code (*valid_func)(void *cbparam, const char *name, expression_space space);
|
||||
typedef UINT64 (*read_func)(void *cbparam, const char *name, expression_space space, UINT32 offset, int size);
|
||||
typedef void (*write_func)(void *cbparam, const char *name, expression_space space, UINT32 offset, int size, UINT64 value);
|
||||
typedef std::function<expression_error::error_code(void *cbparam, const char *name, expression_space space)> valid_func;
|
||||
typedef std::function<UINT64(void *cbparam, const char *name, expression_space space, UINT32 offset, int size)> read_func;
|
||||
typedef std::function<void(void *cbparam, const char *name, expression_space space, UINT32 offset, int size, UINT64 value)> write_func;
|
||||
|
||||
enum read_write
|
||||
{
|
||||
|
@ -23,6 +23,95 @@
|
||||
static running_machine *g_machine = nullptr;
|
||||
static int g_atexit_registered = FALSE;
|
||||
|
||||
/*-------------------------------------------------
|
||||
debugger_instruction_hook - CPU cores call
|
||||
this once per instruction from CPU cores
|
||||
-------------------------------------------------*/
|
||||
|
||||
void debugger_instruction_hook(device_t *device, offs_t curpc)
|
||||
{
|
||||
#ifndef MAME_DEBUG_FAST
|
||||
if ((device->machine().debug_flags & DEBUG_FLAG_CALL_HOOK) != 0)
|
||||
device->debug()->instruction_hook(curpc);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
debugger_exception_hook - CPU cores call this
|
||||
anytime an exception is generated
|
||||
-------------------------------------------------*/
|
||||
|
||||
void debugger_exception_hook(device_t *device, int exception)
|
||||
{
|
||||
if ((device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
|
||||
device->debug()->exception_hook(exception);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
debugger_start_cpu_hook - the CPU execution
|
||||
system calls this hook before beginning
|
||||
execution for the given CPU
|
||||
-------------------------------------------------*/
|
||||
|
||||
void debugger_start_cpu_hook(device_t *device, const attotime &endtime)
|
||||
{
|
||||
if ((device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
|
||||
device->debug()->start_hook(endtime);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
debugger_stop_cpu_hook - the CPU execution
|
||||
system calls this hook when ending execution
|
||||
for the given CPU
|
||||
-------------------------------------------------*/
|
||||
|
||||
void debugger_stop_cpu_hook(device_t *device)
|
||||
{
|
||||
if ((device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
|
||||
device->debug()->stop_hook();
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
debugger_interrupt_hook - the CPU execution
|
||||
system calls this hook when an interrupt is
|
||||
acknowledged
|
||||
-------------------------------------------------*/
|
||||
|
||||
void debugger_interrupt_hook(device_t *device, int irqline)
|
||||
{
|
||||
if ((device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
|
||||
device->debug()->interrupt_hook(irqline);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
debug_break - stop in the debugger at the next
|
||||
opportunity
|
||||
-------------------------------------------------*/
|
||||
|
||||
void debugger_manager::debug_break()
|
||||
{
|
||||
if ((m_machine.debug_flags & DEBUG_FLAG_ENABLED) != 0)
|
||||
m_cpu->get_visible_cpu()->debug()->halt_on_next_instruction("Internal breakpoint\n");
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
within_instruction_hook - call this to
|
||||
determine if the debugger is currently halted
|
||||
within the instruction hook
|
||||
-------------------------------------------------*/
|
||||
|
||||
bool debugger_manager::within_instruction_hook()
|
||||
{
|
||||
if ((m_machine.debug_flags & DEBUG_FLAG_ENABLED) != 0)
|
||||
return m_cpu->within_instruction_hook();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// DEBUGGER MANAGER
|
||||
//**************************************************************************
|
||||
@ -35,8 +124,9 @@ debugger_manager::debugger_manager(running_machine &machine)
|
||||
: m_machine(machine)
|
||||
{
|
||||
/* initialize the submodules */
|
||||
debug_cpu_init(machine);
|
||||
debug_command_init(machine);
|
||||
m_cpu = std::make_unique<debugger_cpu>(machine);
|
||||
m_console = std::make_unique<debugger_console>(machine);
|
||||
m_commands = std::make_unique<debugger_commands>(machine, cpu(), console());
|
||||
|
||||
g_machine = &machine;
|
||||
|
||||
@ -45,9 +135,6 @@ debugger_manager::debugger_manager(running_machine &machine)
|
||||
atexit(debugger_flush_all_traces_on_abnormal_exit);
|
||||
g_atexit_registered = TRUE;
|
||||
|
||||
/* listen in on the errorlog */
|
||||
machine.add_logerror_callback(debug_errorlog_write_line);
|
||||
|
||||
/* initialize osd debugger features */
|
||||
machine.osd().init_debugger();
|
||||
}
|
||||
@ -61,15 +148,6 @@ debugger_manager::~debugger_manager()
|
||||
g_machine = nullptr;
|
||||
}
|
||||
|
||||
void debugger_manager::initialize()
|
||||
{
|
||||
/* only if debugging is enabled */
|
||||
if (machine().debug_flags & DEBUG_FLAG_ENABLED)
|
||||
{
|
||||
debug_console_init(machine());
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
refresh_display - redraw the current
|
||||
video display
|
||||
@ -89,8 +167,8 @@ void debugger_manager::refresh_display()
|
||||
|
||||
void debugger_flush_all_traces_on_abnormal_exit(void)
|
||||
{
|
||||
if(g_machine!=nullptr)
|
||||
if(g_machine != nullptr)
|
||||
{
|
||||
debug_cpu_flush_traces(*g_machine);
|
||||
g_machine->debugger().cpu().flush_traces();
|
||||
}
|
||||
}
|
||||
|
@ -9,10 +9,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __DEBUGGER_H__
|
||||
#define __DEBUGGER_H__
|
||||
#ifndef EMU_DEBUGGER_H
|
||||
#define EMU_DEBUGGER_H
|
||||
|
||||
#include "debug/debugcpu.h"
|
||||
class debugger_commands;
|
||||
class debugger_cpu;
|
||||
class debugger_console;
|
||||
|
||||
|
||||
// ======================> debugger_manager
|
||||
@ -24,16 +26,26 @@ public:
|
||||
debugger_manager(running_machine &machine);
|
||||
~debugger_manager();
|
||||
|
||||
void initialize();
|
||||
// break into the debugger
|
||||
void debug_break();
|
||||
|
||||
/* redraw the current video display */
|
||||
bool within_instruction_hook();
|
||||
|
||||
// redraw the current video display
|
||||
void refresh_display();
|
||||
|
||||
// getters
|
||||
running_machine &machine() const { return m_machine; }
|
||||
debugger_commands &commands() const { return *m_commands; }
|
||||
debugger_cpu &cpu() const { return *m_cpu; }
|
||||
debugger_console &console() const { return *m_console; }
|
||||
|
||||
private:
|
||||
// internal state
|
||||
running_machine & m_machine; // reference to our machine
|
||||
running_machine & m_machine;
|
||||
|
||||
std::unique_ptr<debugger_commands> m_commands;
|
||||
std::unique_ptr<debugger_cpu> m_cpu;
|
||||
std::unique_ptr<debugger_console> m_console;
|
||||
};
|
||||
|
||||
|
||||
@ -47,108 +59,21 @@ void debugger_flush_all_traces_on_abnormal_exit(void);
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
CPU CORE INLINE FUNCTIONS
|
||||
CPU CORE STATIC FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
debugger_instruction_hook - CPU cores call
|
||||
this once per instruction from CPU cores
|
||||
-------------------------------------------------*/
|
||||
|
||||
static inline void debugger_instruction_hook(device_t *device, offs_t curpc)
|
||||
{
|
||||
#ifndef MAME_DEBUG_FAST
|
||||
if ((device->machine().debug_flags & DEBUG_FLAG_CALL_HOOK) != 0)
|
||||
device->debug()->instruction_hook(curpc);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
debugger_exception_hook - CPU cores call this
|
||||
anytime an exception is generated
|
||||
-------------------------------------------------*/
|
||||
|
||||
static inline void debugger_exception_hook(device_t *device, int exception)
|
||||
{
|
||||
if ((device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
|
||||
device->debug()->exception_hook(exception);
|
||||
}
|
||||
void debugger_instruction_hook(device_t *device, offs_t curpc);
|
||||
void debugger_exception_hook(device_t *device, int exception);
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
CPU EXECUTION SYSTEM INLINE FUNCTIONS
|
||||
CPU EXECUTION SYSTEM STATIC FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
debugger_start_cpu_hook - the CPU execution
|
||||
system calls this hook before beginning
|
||||
execution for the given CPU
|
||||
-------------------------------------------------*/
|
||||
|
||||
static inline void debugger_start_cpu_hook(device_t *device, const attotime &endtime)
|
||||
{
|
||||
if ((device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
|
||||
device->debug()->start_hook(endtime);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
debugger_stop_cpu_hook - the CPU execution
|
||||
system calls this hook when ending execution
|
||||
for the given CPU
|
||||
-------------------------------------------------*/
|
||||
|
||||
static inline void debugger_stop_cpu_hook(device_t *device)
|
||||
{
|
||||
if ((device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
|
||||
device->debug()->stop_hook();
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
debugger_interrupt_hook - the CPU execution
|
||||
system calls this hook when an interrupt is
|
||||
acknowledged
|
||||
-------------------------------------------------*/
|
||||
|
||||
static inline void debugger_interrupt_hook(device_t *device, int irqline)
|
||||
{
|
||||
if ((device->machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
|
||||
device->debug()->interrupt_hook(irqline);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
GENERAL INLINE FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
debugger_break - stop in the debugger at the
|
||||
next opportunity
|
||||
-------------------------------------------------*/
|
||||
|
||||
static inline void debugger_break(running_machine &machine)
|
||||
{
|
||||
if ((machine.debug_flags & DEBUG_FLAG_ENABLED) != 0)
|
||||
debug_cpu_get_visible_cpu(machine)->debug()->halt_on_next_instruction("Internal breakpoint\n");
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
debugger_within_instruction_hook - call this
|
||||
to determine if the debugger is currently
|
||||
halted within the instruction hook
|
||||
-------------------------------------------------*/
|
||||
|
||||
static inline int debugger_within_instruction_hook(running_machine &machine)
|
||||
{
|
||||
if ((machine.debug_flags & DEBUG_FLAG_ENABLED) != 0)
|
||||
return debug_cpu_within_instruction_hook(machine);
|
||||
return FALSE;
|
||||
}
|
||||
void debugger_start_cpu_hook(device_t *device, const attotime &endtime);
|
||||
void debugger_stop_cpu_hook(device_t *device);
|
||||
void debugger_interrupt_hook(device_t *device, int irqline);
|
||||
|
||||
|
||||
#endif /* __DEBUGGER_H__ */
|
||||
|
@ -78,6 +78,7 @@
|
||||
#include "crsshair.h"
|
||||
#include "unzip.h"
|
||||
#include "debug/debugvw.h"
|
||||
#include "debug/debugcpu.h"
|
||||
#include "image.h"
|
||||
#include "network.h"
|
||||
#include "ui/uimain.h"
|
||||
@ -108,7 +109,6 @@ running_machine::running_machine(const machine_config &_config, machine_manager
|
||||
: firstcpu(nullptr),
|
||||
primary_screen(nullptr),
|
||||
debug_flags(0),
|
||||
debugcpu_data(nullptr),
|
||||
m_config(_config),
|
||||
m_system(_config.gamedrv()),
|
||||
m_manager(manager),
|
||||
@ -245,7 +245,6 @@ void running_machine::start()
|
||||
{
|
||||
m_debug_view = std::make_unique<debug_view_manager>(*this);
|
||||
m_debugger = std::make_unique<debugger_manager>(*this);
|
||||
m_debugger->initialize();
|
||||
}
|
||||
|
||||
m_render->resolve_tags();
|
||||
@ -293,7 +292,9 @@ int running_machine::run(bool quiet)
|
||||
m_logfile = std::make_unique<emu_file>(OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
|
||||
osd_file::error filerr = m_logfile->open("error.log");
|
||||
assert_always(filerr == osd_file::error::NONE, "unable to open log file");
|
||||
add_logerror_callback(logfile_callback);
|
||||
|
||||
using namespace std::placeholders;
|
||||
add_logerror_callback(std::bind(&running_machine::logfile_callback, this, _1));
|
||||
}
|
||||
|
||||
// then finish setting up our local machine
|
||||
@ -883,12 +884,12 @@ void running_machine::soft_reset(void *ptr, INT32 param)
|
||||
// logfile
|
||||
//-------------------------------------------------
|
||||
|
||||
void running_machine::logfile_callback(const running_machine &machine, const char *buffer)
|
||||
void running_machine::logfile_callback(const char *buffer)
|
||||
{
|
||||
if (machine.m_logfile != nullptr)
|
||||
if (m_logfile != nullptr)
|
||||
{
|
||||
machine.m_logfile->puts(buffer);
|
||||
machine.m_logfile->flush();
|
||||
m_logfile->puts(buffer);
|
||||
m_logfile->flush();
|
||||
}
|
||||
}
|
||||
|
||||
@ -959,7 +960,7 @@ void running_machine::stop_all_devices()
|
||||
{
|
||||
// first let the debugger save comments
|
||||
if ((debug_flags & DEBUG_FLAG_ENABLED) != 0)
|
||||
debug_comment_save(*this);
|
||||
debugger().cpu().comment_save();
|
||||
|
||||
// iterate over devices and stop them
|
||||
for (device_t &device : device_iterator(root_device()))
|
||||
|
@ -17,6 +17,8 @@
|
||||
#ifndef __MACHINE_H__
|
||||
#define __MACHINE_H__
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "strformat.h"
|
||||
#include "vecstream.h"
|
||||
|
||||
@ -99,7 +101,6 @@ class rom_load_manager;
|
||||
class debugger_manager;
|
||||
class osd_interface;
|
||||
enum class config_type;
|
||||
struct debugcpu_private;
|
||||
|
||||
|
||||
// ======================> system_time
|
||||
@ -144,7 +145,7 @@ class running_machine
|
||||
|
||||
friend class sound_manager;
|
||||
|
||||
typedef void (*logerror_callback)(const running_machine &machine, const char *string);
|
||||
typedef std::function<void(const char*)> logerror_callback;
|
||||
|
||||
// must be at top of member variables
|
||||
resource_pool m_respool; // pool of resources for this machine
|
||||
@ -245,9 +246,6 @@ public:
|
||||
// debugger-related information
|
||||
UINT32 debug_flags; // the current debug flags
|
||||
|
||||
// internal core information
|
||||
debugcpu_private * debugcpu_data; // internal data from debugcpu.c
|
||||
|
||||
private:
|
||||
// internal helpers
|
||||
template <typename T> struct is_null { template <typename U> static bool value(U &&x) { return false; } };
|
||||
@ -264,7 +262,7 @@ private:
|
||||
void popup_message(util::format_argument_pack<std::ostream> const &args) const;
|
||||
|
||||
// internal callbacks
|
||||
static void logfile_callback(const running_machine &machine, const char *buffer);
|
||||
void logfile_callback(const char *buffer);
|
||||
|
||||
// internal device helpers
|
||||
void start_all_devices();
|
||||
@ -401,7 +399,7 @@ inline void running_machine::logerror(Format &&fmt, Params &&... args) const
|
||||
// log to all callbacks
|
||||
char const *const str(&m_string_buffer.vec()[0]);
|
||||
for (auto &cb : m_logerror_list)
|
||||
(cb->m_func)(*this, str);
|
||||
cb->m_func(str);
|
||||
|
||||
g_profiler.stop();
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ void video_manager::frame_update(bool debug)
|
||||
{
|
||||
// reset partial updates if we're paused or if the debugger is active
|
||||
screen_device *screen = machine().first_screen();
|
||||
if (screen != nullptr && (machine().paused() || debug || debugger_within_instruction_hook(machine())))
|
||||
if (screen != nullptr && (machine().paused() || debug || machine().debugger().within_instruction_hook()))
|
||||
screen->reset_partial_updates();
|
||||
}
|
||||
}
|
||||
|
@ -1078,10 +1078,10 @@ cheat_manager::cheat_manager(running_machine &machine)
|
||||
// we rely on the debugger expression callbacks; if the debugger isn't
|
||||
// enabled, we must jumpstart them manually
|
||||
if ((machine.debug_flags & DEBUG_FLAG_ENABLED) == 0)
|
||||
debug_cpu_init(machine);
|
||||
m_cpu = std::make_unique<debugger_cpu>(machine);
|
||||
|
||||
// configure for memory access (shared with debugger)
|
||||
debug_cpu_configure_memory(machine, m_symtable);
|
||||
m_cpu->configure_memory(m_symtable);
|
||||
|
||||
// load the cheats
|
||||
reload();
|
||||
|
@ -14,6 +14,7 @@
|
||||
#define __CHEAT_H__
|
||||
|
||||
#include "debug/express.h"
|
||||
#include "debug/debugcpu.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
@ -48,8 +49,10 @@ class number_and_format
|
||||
public:
|
||||
// construction/destruction
|
||||
number_and_format(UINT64 value = 0, int format = 0)
|
||||
: m_value(value),
|
||||
m_format(format) { }
|
||||
: m_value(value)
|
||||
, m_format(format)
|
||||
{
|
||||
}
|
||||
|
||||
// pass-through to look like a regular number
|
||||
operator UINT64 &() { return m_value; }
|
||||
@ -307,6 +310,7 @@ private:
|
||||
INT8 m_lastline; // last line used for output
|
||||
bool m_disabled; // true if the cheat engine is disabled
|
||||
symbol_table m_symtable; // global symbol table
|
||||
std::unique_ptr<debugger_cpu> m_cpu; // debugger interface for cpus/memory
|
||||
|
||||
// constants
|
||||
static constexpr int CHEAT_VERSION = 1;
|
||||
|
20
src/frontend/mame/ui/slider.cpp
Normal file
20
src/frontend/mame/ui/slider.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Ryan Holtz
|
||||
|
||||
/***************************************************************************
|
||||
|
||||
ui/slider.h
|
||||
|
||||
Internal data representation for an adjustment slider.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "slider.h"
|
||||
|
||||
slider_state::slider_state()
|
||||
{
|
||||
}
|
||||
|
||||
slider_state::~slider_state()
|
||||
{
|
||||
}
|
@ -167,7 +167,7 @@ inline UINT32 atvtrack_state::decode64_32(offs_t offset64, UINT64 data, UINT64 m
|
||||
return (UINT32)(data >> 32);
|
||||
}
|
||||
logerror("Wrong word size in external access\n");
|
||||
//debugger_break(nullptr);
|
||||
//machine().debugger().debug_break();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -366,6 +366,8 @@ Thanks to Alex, Mr Mudkips, and Philip Burke for this info.
|
||||
|
||||
*/
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpu/i386/i386.h"
|
||||
#include "machine/pic8259.h"
|
||||
@ -376,6 +378,7 @@ Thanks to Alex, Mr Mudkips, and Philip Burke for this info.
|
||||
#include "debug/debugcon.h"
|
||||
#include "debug/debugcmd.h"
|
||||
#include "debug/debugcpu.h"
|
||||
#include "debugger.h"
|
||||
#include "includes/chihiro.h"
|
||||
#include "includes/xbox.h"
|
||||
|
||||
@ -475,6 +478,12 @@ public:
|
||||
int usbhack_counter;
|
||||
UINT8 *dimm_board_memory;
|
||||
UINT32 dimm_board_memory_size;
|
||||
|
||||
private:
|
||||
void jamtable_disasm(address_space &space, UINT32 address, UINT32 size);
|
||||
void jamtable_disasm_command(int ref, int params, const char **param);
|
||||
void help_command(int ref, int params, const char **param);
|
||||
void debug_commands(int ref, int params, const char **param);
|
||||
};
|
||||
|
||||
/* jamtable instructions for Chihiro (different from Xbox console)
|
||||
@ -493,29 +502,28 @@ St. Instr. Comment
|
||||
*/
|
||||
|
||||
/* jamtable disassembler */
|
||||
static void jamtable_disasm(running_machine &machine, address_space &space, UINT32 address, UINT32 size) // 0xff000080 == fff00080
|
||||
void chihiro_state::jamtable_disasm(address_space &space, UINT32 address, UINT32 size) // 0xff000080 == fff00080
|
||||
{
|
||||
offs_t base, addr;
|
||||
UINT32 opcode, op1, op2;
|
||||
char sop1[16];
|
||||
char sop2[16];
|
||||
char pcrel[16];
|
||||
|
||||
addr = (offs_t)address;
|
||||
if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &addr))
|
||||
offs_t addr = (offs_t)address;
|
||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &addr))
|
||||
{
|
||||
debug_console_printf(machine, "Address is unmapped.\n");
|
||||
machine().debugger().console().printf("Address is unmapped.\n");
|
||||
return;
|
||||
}
|
||||
while (1)
|
||||
{
|
||||
base = addr;
|
||||
opcode = space.read_byte(addr);
|
||||
offs_t base = addr;
|
||||
|
||||
UINT32 opcode = space.read_byte(addr);
|
||||
addr++;
|
||||
op1 = space.read_dword_unaligned(addr);
|
||||
UINT32 op1 = space.read_dword_unaligned(addr);
|
||||
addr += 4;
|
||||
op2 = space.read_dword_unaligned(addr);
|
||||
UINT32 op2 = space.read_dword_unaligned(addr);
|
||||
addr += 4;
|
||||
|
||||
char sop1[16];
|
||||
char sop2[16];
|
||||
char pcrel[16];
|
||||
if (opcode == 0xe1)
|
||||
{
|
||||
opcode = op2 & 255;
|
||||
@ -531,7 +539,7 @@ static void jamtable_disasm(running_machine &machine, address_space &space, UINT
|
||||
sprintf(sop1, "%08X", op1);
|
||||
sprintf(pcrel, "%08X", base + 9 + op1);
|
||||
}
|
||||
debug_console_printf(machine, "%08X ", base);
|
||||
machine().debugger().console().printf("%08X ", base);
|
||||
// dl=instr ebx=par1 eax=par2
|
||||
switch (opcode)
|
||||
{
|
||||
@ -546,39 +554,39 @@ static void jamtable_disasm(running_machine &machine, address_space &space, UINT
|
||||
// | | Reserved | Bus Number | Device Number | Function Number | Register Number |0|0|
|
||||
// +-+----------+------------+---------------+-----------------+-----------------+-+-+
|
||||
// 31 - Enable bit
|
||||
debug_console_printf(machine, "POKEPCI PCICONF[%s]=%s\n", sop2, sop1);
|
||||
machine().debugger().console().printf("POKEPCI PCICONF[%s]=%s\n", sop2, sop1);
|
||||
break;
|
||||
case 0x02:
|
||||
debug_console_printf(machine, "OUTB PORT[%s]=%s\n", sop2, sop1);
|
||||
machine().debugger().console().printf("OUTB PORT[%s]=%s\n", sop2, sop1);
|
||||
break;
|
||||
case 0x03:
|
||||
debug_console_printf(machine, "POKE MEM[%s]=%s\n", sop2, sop1);
|
||||
machine().debugger().console().printf("POKE MEM[%s]=%s\n", sop2, sop1);
|
||||
break;
|
||||
case 0x04:
|
||||
debug_console_printf(machine, "BNE IF ACC != %s THEN PC=%s\n", sop2, pcrel);
|
||||
machine().debugger().console().printf("BNE IF ACC != %s THEN PC=%s\n", sop2, pcrel);
|
||||
break;
|
||||
case 0x05:
|
||||
// out cf8,op2
|
||||
// in acc,cfc
|
||||
debug_console_printf(machine, "PEEKPCI ACC=PCICONF[%s]\n", sop2);
|
||||
machine().debugger().console().printf("PEEKPCI ACC=PCICONF[%s]\n", sop2);
|
||||
break;
|
||||
case 0x06:
|
||||
debug_console_printf(machine, "AND/OR ACC=(ACC & %s) | %s\n", sop2, sop1);
|
||||
machine().debugger().console().printf("AND/OR ACC=(ACC & %s) | %s\n", sop2, sop1);
|
||||
break;
|
||||
case 0x07:
|
||||
debug_console_printf(machine, "BRA PC=%s\n", pcrel);
|
||||
machine().debugger().console().printf("BRA PC=%s\n", pcrel);
|
||||
break;
|
||||
case 0x08:
|
||||
debug_console_printf(machine, "INB ACC=PORT[%s]\n", sop2);
|
||||
machine().debugger().console().printf("INB ACC=PORT[%s]\n", sop2);
|
||||
break;
|
||||
case 0x09:
|
||||
debug_console_printf(machine, "PEEK ACC=MEM[%s]\n", sop2);
|
||||
machine().debugger().console().printf("PEEK ACC=MEM[%s]\n", sop2);
|
||||
break;
|
||||
case 0xee:
|
||||
debug_console_printf(machine, "END\n");
|
||||
machine().debugger().console().printf("END\n");
|
||||
break;
|
||||
default:
|
||||
debug_console_printf(machine, "NOP ????\n");
|
||||
machine().debugger().console().printf("NOP ????\n");
|
||||
break;
|
||||
}
|
||||
if (opcode == 0xee)
|
||||
@ -589,36 +597,35 @@ static void jamtable_disasm(running_machine &machine, address_space &space, UINT
|
||||
}
|
||||
}
|
||||
|
||||
static void jamtable_disasm_command(running_machine &machine, int ref, int params, const char **param)
|
||||
void chihiro_state::jamtable_disasm_command(int ref, int params, const char **param)
|
||||
{
|
||||
chihiro_state *state = machine.driver_data<chihiro_state>();
|
||||
address_space &space = state->m_maincpu->space();
|
||||
address_space &space = m_maincpu->space();
|
||||
UINT64 addr, size;
|
||||
|
||||
if (params < 2)
|
||||
return;
|
||||
if (!debug_command_parameter_number(machine, param[0], &addr))
|
||||
if (!machine().debugger().commands().validate_number_parameter(param[0], &addr))
|
||||
return;
|
||||
if (!debug_command_parameter_number(machine, param[1], &size))
|
||||
if (!machine().debugger().commands().validate_number_parameter(param[1], &size))
|
||||
return;
|
||||
jamtable_disasm(machine, space, (UINT32)addr, (UINT32)size);
|
||||
jamtable_disasm(space, (UINT32)addr, (UINT32)size);
|
||||
}
|
||||
|
||||
static void help_command(running_machine &machine, int ref, int params, const char **param)
|
||||
void chihiro_state::help_command(int ref, int params, const char **param)
|
||||
{
|
||||
debug_console_printf(machine, "Available Chihiro commands:\n");
|
||||
debug_console_printf(machine, " chihiro jamdis,<start>,<size> -- Disassemble <size> bytes of JamTable instructions starting at <start>\n");
|
||||
debug_console_printf(machine, " chihiro help -- this list\n");
|
||||
machine().debugger().console().printf("Available Chihiro commands:\n");
|
||||
machine().debugger().console().printf(" chihiro jamdis,<start>,<size> -- Disassemble <size> bytes of JamTable instructions starting at <start>\n");
|
||||
machine().debugger().console().printf(" chihiro help -- this list\n");
|
||||
}
|
||||
|
||||
static void chihiro_debug_commands(running_machine &machine, int ref, int params, const char **param)
|
||||
void chihiro_state::debug_commands(int ref, int params, const char **param)
|
||||
{
|
||||
if (params < 1)
|
||||
return;
|
||||
if (strcmp("jamdis", param[0]) == 0)
|
||||
jamtable_disasm_command(machine, ref, params - 1, param + 1);
|
||||
jamtable_disasm_command(ref, params - 1, param + 1);
|
||||
else
|
||||
help_command(machine, ref, params - 1, param + 1);
|
||||
help_command(ref, params - 1, param + 1);
|
||||
}
|
||||
|
||||
void chihiro_state::hack_eeprom()
|
||||
@ -1099,7 +1106,10 @@ void chihiro_state::machine_start()
|
||||
dimm_board_memory = chihiro_devs.dimmboard->memory(dimm_board_memory_size);
|
||||
}
|
||||
if (machine().debug_flags & DEBUG_FLAG_ENABLED)
|
||||
debug_console_register_command(machine(), "chihiro", CMDFLAG_NONE, 0, 1, 4, chihiro_debug_commands);
|
||||
{
|
||||
using namespace std::placeholders;
|
||||
machine().debugger().console().register_command("chihiro", CMDFLAG_NONE, 0, 1, 4, std::bind(&chihiro_state::debug_commands, this, _1, _2, _3));
|
||||
}
|
||||
usbhack_index = -1;
|
||||
for (int a = 1; a < 3; a++)
|
||||
if (strcmp(machine().basename(), hacks[a].game_name) == 0) {
|
||||
|
@ -171,8 +171,8 @@ WRITE8_MEMBER(icatel_state::ci8_w)
|
||||
READ8_MEMBER(icatel_state::ci15_r)
|
||||
{
|
||||
/* TODO: Implement-me! */
|
||||
// debugger_break(machine());
|
||||
// logerror("read: ci15\n");
|
||||
//machine().debugger().debug_break();
|
||||
//logerror("read: ci15\n");
|
||||
return (1 << 3) | (1 << 0);
|
||||
}
|
||||
|
||||
|
@ -1817,7 +1817,7 @@ inline int naomi_state::decode_reg32_64(UINT32 offset, UINT64 mem_mask, UINT64 *
|
||||
if ((mem_mask != U64(0xffffffff00000000)) && (mem_mask != U64(0x00000000ffffffff)))
|
||||
{
|
||||
osd_printf_verbose("%s:Wrong mask!\n", machine().describe_context());
|
||||
// debugger_break(machine);
|
||||
//machine().debugger().debug_break();
|
||||
}
|
||||
|
||||
if (mem_mask == U64(0xffffffff00000000))
|
||||
|
@ -553,7 +553,7 @@ WRITE8_MEMBER(noki3310_state::mad2_io_w)
|
||||
{
|
||||
case 0x02:
|
||||
//printf("DSP %s\n", data & 1 ? "RUN" : "HOLD");
|
||||
//if (data & 0x01) debugger_break(machine());
|
||||
//if (data & 0x01) machine().debugger().debug_break();
|
||||
break;
|
||||
case 0x08:
|
||||
ack_fiq(data);
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "machine/ram.h"
|
||||
#include "sound/dac.h"
|
||||
#include "debugger.h"
|
||||
#include "debug/debugcpu.h"
|
||||
#include "rendlay.h"
|
||||
|
||||
#define MC68328_TAG "dragonball"
|
||||
|
@ -815,14 +815,14 @@ WRITE8_MEMBER( pasopia7_state::video_misc_w )
|
||||
---- x--- pal disable
|
||||
---- xx-- palette selector (both bits enables this, odd hook-up)
|
||||
*/
|
||||
// if(data & 2)
|
||||
// {
|
||||
// printf("VIDEO MISC %02x\n",data);
|
||||
// debugger_break(device->machine());
|
||||
// }
|
||||
//if(data & 2)
|
||||
//{
|
||||
// printf("VIDEO MISC %02x\n",data);
|
||||
// machine().debugger().debug_break();
|
||||
//}
|
||||
m_cursor_blink = data & 0x20;
|
||||
m_attr_wrap = data & 0x10;
|
||||
// m_pal_sel = data & 0x02;
|
||||
//m_pal_sel = data & 0x02;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( pasopia7_state::nmi_mask_w )
|
||||
|
@ -2341,7 +2341,7 @@ IRQ_CALLBACK_MEMBER(pc8801_state::pc8801_irq_callback)
|
||||
}
|
||||
|
||||
printf("IRQ triggered but no vector on the bus! %02x %02x %02x %02x\n",m_i8214_irq_level,m_sound_irq_latch,m_vrtc_irq_latch,m_timer_irq_latch);
|
||||
debugger_break(machine());
|
||||
machine().debugger().debug_break();
|
||||
|
||||
return 4*2; //TODO: mustn't happen
|
||||
}
|
||||
|
@ -856,7 +856,7 @@ WRITE16_MEMBER(raiden2_state::sprite_prot_src_w)
|
||||
dst1 += 8;
|
||||
}
|
||||
//printf("[%08x] %08x %08x %04x %04x\n",src,dx,dy,dst1,dst2);
|
||||
// debugger_break(machine());
|
||||
//machine().debugger().debug_break();
|
||||
}
|
||||
|
||||
READ16_MEMBER(raiden2_state::sprite_prot_dst1_r)
|
||||
|
@ -749,8 +749,8 @@ void segas24_state::reset_reset()
|
||||
if(resetcontrol & 2) {
|
||||
m_subcpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
|
||||
m_subcpu->set_input_line(INPUT_LINE_RESET, PULSE_LINE);
|
||||
// osd_printf_debug("enable 2nd cpu!\n");
|
||||
// debugger_break(machine);
|
||||
//osd_printf_debug("enable 2nd cpu!\n");
|
||||
//machine().debugger().debug_break();
|
||||
if (m_gground_hack_timer)
|
||||
{
|
||||
m_subcpu->set_clock_scale(0.7f); // reduce clock speed temporarily so a check passes, see notes above
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "debug/debugcon.h"
|
||||
#include "debug/debugcmd.h"
|
||||
#include "debug/debugcpu.h"
|
||||
#include "debugger.h"
|
||||
#include "includes/chihiro.h"
|
||||
#include "includes/xbox.h"
|
||||
|
||||
|
@ -220,6 +220,10 @@ public:
|
||||
required_device<floppy_connector> m_floppy2;
|
||||
required_device<floppy_connector> m_floppy3;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
private:
|
||||
void execute_beta_key_dump(int ref, int params, const char *param[]);
|
||||
void execute_beta_dat_log(int ref, int params, const char *param[]);
|
||||
};
|
||||
|
||||
#endif /* DGN_BETA_H_ */
|
||||
|
@ -174,6 +174,10 @@ public:
|
||||
void keyboard_reset();
|
||||
void scan_keyboard();
|
||||
void set_ram_size();
|
||||
|
||||
private:
|
||||
void debug_command(int ref, int params, const char *param[]);
|
||||
void video_debug(int ref, int params, const char *param[]);
|
||||
};
|
||||
|
||||
/*----------- defined in drivers/mbc55x.c -----------*/
|
||||
|
@ -218,4 +218,8 @@ public:
|
||||
|
||||
emu_timer *m_mouse_timer;
|
||||
} m_nimbus_mouse;
|
||||
|
||||
private:
|
||||
void debug_command(int ref, int params, const char *param[]);
|
||||
void video_debug(int ref, int params, const char *param[]);
|
||||
};
|
||||
|
@ -562,6 +562,22 @@ public:
|
||||
int debug_irq_number;
|
||||
required_device<cpu_device> m_maincpu;
|
||||
ohci_usb_controller *ohci_usb;
|
||||
|
||||
private:
|
||||
void dump_string_command(int ref, int params, const char **param);
|
||||
void dump_process_command(int ref, int params, const char **param);
|
||||
void dump_list_command(int ref, int params, const char **param);
|
||||
void dump_dpc_command(int ref, int params, const char **param);
|
||||
void dump_timer_command(int ref, int params, const char **param);
|
||||
void curthread_command(int ref, int params, const char **param);
|
||||
void generate_irq_command(int ref, int params, const char **param);
|
||||
void nv2a_combiners_command(int ref, int params, const char **param);
|
||||
void waitvblank_command(int ref, int params, const char **param);
|
||||
void grab_texture_command(int ref, int params, const char **param);
|
||||
void grab_vprog_command(int ref, int params, const char **param);
|
||||
void vprogdis_command(int ref, int params, const char **param);
|
||||
void help_command(int ref, int params, const char **param);
|
||||
void xbox_debug_commands(int ref, int params, const char **param);
|
||||
};
|
||||
|
||||
ADDRESS_MAP_EXTERN(xbox_base_map, 32);
|
||||
|
@ -1004,7 +1004,7 @@ WRITE32_MEMBER(_3do_state::_3do_clio_w)
|
||||
case 0x17fc/4:
|
||||
/* TODO: DSPP enabled just before enabling DSPP irq! */
|
||||
if(data & 1)
|
||||
debugger_break(machine());
|
||||
machine().debugger().debug_break();
|
||||
|
||||
//printf("%08x\n",data);
|
||||
break;
|
||||
|
@ -244,7 +244,7 @@ int dc_state::decode_reg32_64(UINT32 offset, UINT64 mem_mask, UINT64 *shift)
|
||||
if ((mem_mask != U64(0xffffffff00000000)) && (mem_mask != U64(0x00000000ffffffff)))
|
||||
{
|
||||
osd_printf_verbose("%s:Wrong mask!\n", machine().describe_context());
|
||||
// debugger_break(machine);
|
||||
//machine().debugger().debug_break();
|
||||
}
|
||||
|
||||
if (mem_mask == U64(0xffffffff00000000))
|
||||
@ -268,7 +268,7 @@ int dc_state::decode_reg3216_64(UINT32 offset, UINT64 mem_mask, UINT64 *shift)
|
||||
(mem_mask != U64(0xffffffff00000000)) && (mem_mask != U64(0x00000000ffffffff)))
|
||||
{
|
||||
osd_printf_verbose("%s:Wrong mask!\n", machine().describe_context());
|
||||
// debugger_break(machine);
|
||||
//machine().debugger().debug_break();
|
||||
}
|
||||
|
||||
if (mem_mask & U64(0x0000ffff00000000))
|
||||
|
@ -119,16 +119,17 @@ READ32_MEMBER(dc_cons_state::dc_mess_g1_ctrl_r )
|
||||
{
|
||||
case SB_GDSTARD:
|
||||
printf("G1CTRL: GDSTARD %08x\n", atapi_xferbase); // Hello Kitty reads here
|
||||
debugger_break(machine());
|
||||
machine().debugger().debug_break();
|
||||
return atapi_xferbase;
|
||||
case SB_GDST:
|
||||
break;
|
||||
case SB_GDLEND:
|
||||
//debugger_break(machine());
|
||||
//machine().debugger().debug_break();
|
||||
return atapi_xferlen; // TODO: check me
|
||||
default:
|
||||
printf("G1CTRL: Unmapped read %08x\n", 0x5f7400+offset*4);
|
||||
debugger_break(machine());
|
||||
machine().debugger().debug_break();
|
||||
break;
|
||||
}
|
||||
return g1bus_regs[offset];
|
||||
}
|
||||
|
@ -57,6 +57,8 @@
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include <math.h>
|
||||
#include "emu.h"
|
||||
#include "debug/debugcon.h"
|
||||
@ -66,6 +68,7 @@
|
||||
#include "machine/mos6551.h"
|
||||
#include "imagedev/flopdrv.h"
|
||||
|
||||
#include "debugger.h"
|
||||
#include "debug/debugcpu.h"
|
||||
#include "debug/debugcon.h"
|
||||
#include "machine/ram.h"
|
||||
@ -86,8 +89,6 @@
|
||||
|
||||
/* Debugging commands and handlers. */
|
||||
static offs_t dgnbeta_dasm_override(device_t &device, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, int options);
|
||||
static void execute_beta_dat_log(running_machine &machine, int ref, int params, const char *param[]);
|
||||
static void execute_beta_key_dump(running_machine &machine, int ref, int params, const char *param[]);
|
||||
|
||||
//static int DMA_NMI; /* DMA cpu has received an NMI */
|
||||
|
||||
@ -174,7 +175,7 @@ void dgn_beta_state::UpdateBanks(int first, int last)
|
||||
{
|
||||
readbank = &m_ram->pointer()[MapPage*RamPageSize];
|
||||
if(m_LogDatWrites)
|
||||
debug_console_printf(machine(), "Mapping page %X, pageno=%X, mess_ram)[%X]\n",Page,MapPage,(MapPage*RamPageSize));
|
||||
machine().debugger().console().printf("Mapping page %X, pageno=%X, mess_ram)[%X]\n",Page,MapPage,(MapPage*RamPageSize));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -531,7 +532,7 @@ WRITE_LINE_MEMBER(dgn_beta_state::d_pia0_cb2_w)
|
||||
m_RowShifter = (m_RowShifter<<1) | ((m_d_pia0_pb_last & KOutDat)>>4);
|
||||
m_RowShifter &= 0x3FF;
|
||||
LOG_KEYBOARD(("Rowshifter=$%02X Keyrow=$%02X\n",m_RowShifter,m_Keyrow));
|
||||
if (VERBOSE) debug_console_printf(machine(), "rowshifter clocked, value=%3X, RowNo=%d, Keyrow=%2X\n",m_RowShifter,RowNo,m_Keyrow);
|
||||
if (VERBOSE) machine().debugger().console().printf("rowshifter clocked, value=%3X, RowNo=%d, Keyrow=%2X\n",m_RowShifter,RowNo,m_Keyrow);
|
||||
}
|
||||
|
||||
m_d_pia0_cb2_last=state;
|
||||
@ -945,10 +946,11 @@ void dgn_beta_state::machine_start()
|
||||
/* setup debug commands */
|
||||
if (machine().debug_flags & DEBUG_FLAG_ENABLED)
|
||||
{
|
||||
debug_console_register_command(machine(), "beta_dat_log", CMDFLAG_NONE, 0, 0, 0, execute_beta_dat_log);
|
||||
debug_console_register_command(machine(), "beta_key_dump", CMDFLAG_NONE, 0, 0, 0, execute_beta_key_dump);
|
||||
using namespace std::placeholders;
|
||||
machine().debugger().console().register_command("beta_dat_log", CMDFLAG_NONE, 0, 0, 0, std::bind(&dgn_beta_state::execute_beta_dat_log, this, _1, _2, _3));
|
||||
machine().debugger().console().register_command("beta_key_dump", CMDFLAG_NONE, 0, 0, 0, std::bind(&dgn_beta_state::execute_beta_key_dump, this, _1, _2, _3));
|
||||
}
|
||||
m_LogDatWrites=0;
|
||||
m_LogDatWrites = false;
|
||||
}
|
||||
|
||||
|
||||
@ -1124,21 +1126,17 @@ static offs_t dgnbeta_dasm_override(device_t &device, char *buffer, offs_t pc, c
|
||||
return result;
|
||||
}
|
||||
|
||||
static void execute_beta_dat_log(running_machine &machine, int ref, int params, const char *param[])
|
||||
void dgn_beta_state::execute_beta_dat_log(int ref, int params, const char *param[])
|
||||
{
|
||||
dgn_beta_state *state = machine.driver_data<dgn_beta_state>();
|
||||
state->m_LogDatWrites=!state->m_LogDatWrites;
|
||||
m_LogDatWrites = !m_LogDatWrites;
|
||||
|
||||
debug_console_printf(machine, "DAT register write info set : %d\n",state->m_LogDatWrites);
|
||||
machine().debugger().console().printf("DAT register write info set : %d\n", m_LogDatWrites);
|
||||
}
|
||||
|
||||
static void execute_beta_key_dump(running_machine &machine, int ref, int params, const char *param[])
|
||||
void dgn_beta_state::execute_beta_key_dump(int ref, int params, const char *param[])
|
||||
{
|
||||
dgn_beta_state *state = machine.driver_data<dgn_beta_state>();
|
||||
int Idx;
|
||||
|
||||
for(Idx=0;Idx<NoKeyrows;Idx++)
|
||||
for (int idx = 0; idx < NoKeyrows; idx++)
|
||||
{
|
||||
debug_console_printf(machine, "KeyRow[%d]=%2X\n",Idx,state->m_Keyboard[Idx]);
|
||||
machine().debugger().console().printf("KeyRow[%d]=%2X\n", idx, m_Keyboard[idx]);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Aaron Giles
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "emu.h"
|
||||
#include "machine/fddebug.h"
|
||||
|
||||
@ -422,11 +425,9 @@ static inline void set_constraint(fd1094_constraint *constraint, UINT32 pc, UINT
|
||||
|
||||
static inline void print_possibilities(running_machine &machine)
|
||||
{
|
||||
int i;
|
||||
|
||||
debug_console_printf(machine, "Possibilities @ %06X:\n", posslist[0].basepc);
|
||||
for (i = 0; i < posscount; i++)
|
||||
debug_console_printf(machine, " %c%2x: %s\n", posslist[i].iffy ? ' ' : '*', i, posslist[i].dasm);
|
||||
machine.debugger().console().printf("Possibilities @ %06X:\n", posslist[0].basepc);
|
||||
for (int i = 0; i < posscount; i++)
|
||||
machine.debugger().console().printf(" %c%2x: %s\n", posslist[i].iffy ? ' ' : '*', i, posslist[i].dasm);
|
||||
}
|
||||
|
||||
|
||||
@ -522,23 +523,24 @@ void fd1094_init_debugging(running_machine &machine, const char *cpureg, const c
|
||||
load_overlay_file(machine);
|
||||
|
||||
/* add some commands */
|
||||
debug_console_register_command(machine, "fdsave", CMDFLAG_NONE, 0, 0, 0, execute_fdsave);
|
||||
debug_console_register_command(machine, "fdoutput", CMDFLAG_NONE, 0, 1, 1, execute_fdoutput);
|
||||
debug_console_register_command(machine, "fdseed", CMDFLAG_NONE, 0, 2, 2, execute_fdseed);
|
||||
debug_console_register_command(machine, "fdguess", CMDFLAG_NONE, STATUS_GUESS, 1, 1, execute_fdlockguess);
|
||||
debug_console_register_command(machine, "fdlock", CMDFLAG_NONE, STATUS_LOCKED, 1, 1, execute_fdlockguess);
|
||||
debug_console_register_command(machine, "fdeliminate", CMDFLAG_NONE, 0, 1, 10, execute_fdeliminate);
|
||||
debug_console_register_command(machine, "fdunlock", CMDFLAG_NONE, 0, 1, 1, execute_fdunlock);
|
||||
debug_console_register_command(machine, "fdignore", CMDFLAG_NONE, 0, 0, 1, execute_fdignore);
|
||||
debug_console_register_command(machine, "fdundo", CMDFLAG_NONE, 0, 0, 0, execute_fdundo);
|
||||
debug_console_register_command(machine, "fdstatus", CMDFLAG_NONE, 0, 0, 0, execute_fdstatus);
|
||||
debug_console_register_command(machine, "fdstate", CMDFLAG_NONE, 0, 0, 1, execute_fdstate);
|
||||
debug_console_register_command(machine, "fdpc", CMDFLAG_NONE, 0, 0, 1, execute_fdpc);
|
||||
debug_console_register_command(machine, "fdsearch", CMDFLAG_NONE, 0, 0, 0, execute_fdsearch);
|
||||
debug_console_register_command(machine, "fddasm", CMDFLAG_NONE, 0, 1, 1, execute_fddasm);
|
||||
debug_console_register_command(machine, "fdcset", CMDFLAG_NONE, 0, 2, 4, execute_fdcset);
|
||||
debug_console_register_command(machine, "fdclist", CMDFLAG_NONE, 0, 0, 0, execute_fdclist);
|
||||
debug_console_register_command(machine, "fdcsearch", CMDFLAG_NONE, 0, 0, 0, execute_fdcsearch);
|
||||
using namespace std::placeholder;
|
||||
machine.debugger().console().register_command("fdsave", CMDFLAG_NONE, 0, 0, 0, std::bind(&execute_fdsave, std::ref(machine), _1, _2, _3));
|
||||
machine.debugger().console().register_command("fdoutput", CMDFLAG_NONE, 0, 1, 1, std::bind(&execute_fdoutput, std::ref(machine), _1, _2, _3));
|
||||
machine.debugger().console().register_command("fdseed", CMDFLAG_NONE, 0, 2, 2, std::bind(&execute_fdseed, std::ref(machine), _1, _2, _3));
|
||||
machine.debugger().console().register_command("fdguess", CMDFLAG_NONE, STATUS_GUESS, 1, 1, std::bind(&execute_fdlockguess, std::ref(machine), _1, _2, _3));
|
||||
machine.debugger().console().register_command("fdlock", CMDFLAG_NONE, STATUS_LOCKED, 1, 1, std::bind(&execute_fdlockguess, std::ref(machine), _1, _2, _3));
|
||||
machine.debugger().console().register_command("fdeliminate", CMDFLAG_NONE, 0, 1, 10, std::bind(&execute_fdeliminate, std::ref(machine), _1, _2, _3));
|
||||
machine.debugger().console().register_command("fdunlock", CMDFLAG_NONE, 0, 1, 1, std::bind(&execute_fdunlock, std::ref(machine), _1, _2, _3));
|
||||
machine.debugger().console().register_command("fdignore", CMDFLAG_NONE, 0, 0, 1, std::bind(&execute_fdignore, std::ref(machine), _1, _2, _3));
|
||||
machine.debugger().console().register_command("fdundo", CMDFLAG_NONE, 0, 0, 0, std::bind(&execute_fdundo, std::ref(machine), _1, _2, _3));
|
||||
machine.debugger().console().register_command("fdstatus", CMDFLAG_NONE, 0, 0, 0, std::bind(&execute_fdstatus, std::ref(machine), _1, _2, _3));
|
||||
machine.debugger().console().register_command("fdstate", CMDFLAG_NONE, 0, 0, 1, std::bind(&execute_fdstate, std::ref(machine), _1, _2, _3));
|
||||
machine.debugger().console().register_command("fdpc", CMDFLAG_NONE, 0, 0, 1, std::bind(&execute_fdpc, std::ref(machine), _1, _2, _3));
|
||||
machine.debugger().console().register_command("fdsearch", CMDFLAG_NONE, 0, 0, 0, std::bind(&execute_fdsearch, std::ref(machine), _1, _2, _3));
|
||||
machine.debugger().console().register_command("fddasm", CMDFLAG_NONE, 0, 1, 1, std::bind(&execute_fddasm, std::ref(machine), _1, _2, _3));
|
||||
machine.debugger().console().register_command("fdcset", CMDFLAG_NONE, 0, 2, 4, std::bind(&execute_fdcset, std::ref(machine), _1, _2, _3));
|
||||
machine.debugger().console().register_command("fdclist", CMDFLAG_NONE, 0, 0, 0, std::bind(&execute_fdclist, std::ref(machine), _1, _2, _3));
|
||||
machine.debugger().console().register_command("fdcsearch", CMDFLAG_NONE, 0, 0, 0, std::bind(&execute_fdcsearch, std::ref(machine), _1, _2, _3));
|
||||
|
||||
/* set up the instruction hook */
|
||||
machine.device("maincpu")->debug()->set_instruction_hook(instruction_hook);
|
||||
@ -743,7 +745,7 @@ static int instruction_hook(device_t &device, offs_t curpc)
|
||||
static void execute_fdsave(running_machine &machine, int ref, int params, const char **param)
|
||||
{
|
||||
save_overlay_file(machine);
|
||||
debug_console_printf(machine, "File saved\n");
|
||||
machine.debugger().console().printf("File saved\n");
|
||||
}
|
||||
|
||||
|
||||
@ -764,7 +766,7 @@ static void execute_fdoutput(running_machine &machine, int ref, int params, cons
|
||||
if (filerr == osd_file::error::NONE)
|
||||
file.write(keyregion, KEY_SIZE);
|
||||
|
||||
debug_console_printf(machine, "File '%s' saved\n", param[0]);
|
||||
machine.debugger().console().printf("File '%s' saved\n", param[0]);
|
||||
}
|
||||
|
||||
|
||||
@ -777,9 +779,9 @@ static void execute_fdseed(running_machine &machine, int ref, int params, const
|
||||
UINT64 num1, num2;
|
||||
|
||||
/* extract the parameters */
|
||||
if (!debug_command_parameter_number(machine, param[0], &num1))
|
||||
if (!machine.debugger().commands().validate_number_parameter(param[0], &num1))
|
||||
return;
|
||||
if (!debug_command_parameter_number(machine, param[1], &num2))
|
||||
if (!machine.debugger().commands().validate_number_parameter(param[1], &num2))
|
||||
return;
|
||||
|
||||
/* set the global and seed, and then regenerate the key */
|
||||
@ -804,13 +806,13 @@ static void execute_fdlockguess(running_machine &machine, int ref, int params, c
|
||||
UINT64 num1;
|
||||
|
||||
/* extract the parameter */
|
||||
if (!debug_command_parameter_number(machine, param[0], &num1))
|
||||
if (!machine.debugger().commands().validate_number_parameter(param[0], &num1))
|
||||
return;
|
||||
|
||||
/* make sure it is within range of our recent possibilities */
|
||||
if (num1 >= posscount)
|
||||
{
|
||||
debug_console_printf(machine, "Possibility of out range (%x max)\n", posscount);
|
||||
machine.debugger().console().printf("Possibility of out range (%x max)\n", posscount);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -839,13 +841,13 @@ static void execute_fdeliminate(running_machine &machine, int ref, int params, c
|
||||
UINT64 num1;
|
||||
|
||||
/* extract the parameters */
|
||||
if (!debug_command_parameter_number(machine, param[pnum], &num1))
|
||||
if (!machine.debugger().commands().validate_number_parameter(param[pnum], &num1))
|
||||
return;
|
||||
|
||||
/* make sure it is within range of our recent possibilities */
|
||||
if (num1 >= posscount)
|
||||
{
|
||||
debug_console_printf(machine, "Possibility %x of out range (%x max)\n", (int)num1, posscount);
|
||||
machine.debugger().console().printf("Possibility %x of out range (%x max)\n", (int)num1, posscount);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -881,21 +883,20 @@ static void execute_fdeliminate(running_machine &machine, int ref, int params, c
|
||||
|
||||
static void execute_fdunlock(running_machine &machine, int ref, int params, const char **param)
|
||||
{
|
||||
device_t *cpu = debug_cpu_get_visible_cpu(machine);
|
||||
int reps = keystatus_words / KEY_SIZE;
|
||||
int keyaddr, repnum;
|
||||
UINT64 offset;
|
||||
device_t *cpu = machine.debugger().cpu().get_visible_cpu();
|
||||
|
||||
/* support 0 or 1 parameters */
|
||||
if (params != 1 || !debug_command_parameter_number(machine, param[0], &offset))
|
||||
UINT64 offset;
|
||||
if (params != 1 || !machine.debugger().commands().validate_number_parameter(param[0], &offset))
|
||||
offset = cpu->safe_pc();
|
||||
keyaddr = addr_to_keyaddr(offset / 2);
|
||||
int keyaddr = addr_to_keyaddr(offset / 2);
|
||||
|
||||
/* toggle the ignore PC status */
|
||||
debug_console_printf(machine, "Unlocking PC %06X\n", (int)offset);
|
||||
machine.debugger().console().printf("Unlocking PC %06X\n", (int)offset);
|
||||
|
||||
/* iterate over all reps and unlock them */
|
||||
for (repnum = 0; repnum < reps; repnum++)
|
||||
const int reps = keystatus_words / KEY_SIZE;
|
||||
for (int repnum = 0; repnum < reps; repnum++)
|
||||
{
|
||||
UINT16 *dest = &keystatus[repnum * KEY_SIZE + keyaddr];
|
||||
if ((*dest & STATUS_MASK) == STATUS_LOCKED)
|
||||
@ -919,30 +920,31 @@ static void execute_fdunlock(running_machine &machine, int ref, int params, cons
|
||||
|
||||
static void execute_fdignore(running_machine &machine, int ref, int params, const char **param)
|
||||
{
|
||||
device_t *cpu = debug_cpu_get_visible_cpu(machine);
|
||||
UINT64 offset;
|
||||
device_t *cpu = machine.debugger().cpu().get_visible_cpu();
|
||||
|
||||
/* support 0 or 1 parameters */
|
||||
if (params == 1 && strcmp(param[0], "all") == 0)
|
||||
{
|
||||
ignore_all = TRUE;
|
||||
debug_console_printf(machine, "Ignoring all unknown opcodes\n");
|
||||
machine.debugger().console().printf("Ignoring all unknown opcodes\n");
|
||||
return;
|
||||
}
|
||||
if (params != 1 || !debug_command_parameter_number(machine, param[0], &offset))
|
||||
|
||||
UINT64 offset;
|
||||
if (params != 1 || !machine.debugger().commands().validate_number_parameter(param[0], &offset))
|
||||
offset = cpu->safe_pc();
|
||||
offset /= 2;
|
||||
|
||||
/* toggle the ignore PC status */
|
||||
ignorepc[offset] = !ignorepc[offset];
|
||||
if (ignorepc[offset])
|
||||
debug_console_printf(machine, "Ignoring address %06X\n", (int)offset * 2);
|
||||
machine.debugger().console().printf("Ignoring address %06X\n", (int)offset * 2);
|
||||
else
|
||||
debug_console_printf(machine, "No longer ignoring address %06X\n", (int)offset * 2);
|
||||
machine.debugger().console().printf("No longer ignoring address %06X\n", (int)offset * 2);
|
||||
|
||||
/* if no parameter given, implicitly run as well */
|
||||
if (params == 0)
|
||||
debug_cpu_get_visible_cpu(machine)->debug()->go();
|
||||
machine.debugger().cpu().get_visible_cpu()->debug()->go();
|
||||
}
|
||||
|
||||
|
||||
@ -956,7 +958,7 @@ static void execute_fdundo(running_machine &machine, int ref, int params, const
|
||||
/* copy the undobuffer back and regenerate the key */
|
||||
memcpy(keystatus, undobuff, keystatus_words * 2);
|
||||
fd1094_regenerate_key(machine);
|
||||
debug_console_printf(machine, "Undid last change\n");
|
||||
machine.debugger().console().printf("Undid last change\n");
|
||||
}
|
||||
|
||||
|
||||
@ -986,9 +988,9 @@ static void execute_fdstatus(running_machine &machine, int ref, int params, cons
|
||||
else
|
||||
nomatter++;
|
||||
}
|
||||
debug_console_printf(machine, "%4d/%4d keys locked (%d%%)\n", locked, KEY_SIZE, locked * 100 / KEY_SIZE);
|
||||
debug_console_printf(machine, "%4d/%4d keys guessed (%d%%)\n", guesses, KEY_SIZE, guesses * 100 / KEY_SIZE);
|
||||
debug_console_printf(machine, "%4d/%4d keys don't matter (%d%%)\n", nomatter, KEY_SIZE, nomatter * 100 / KEY_SIZE);
|
||||
machine.debugger().console().printf("%4d/%4d keys locked (%d%%)\n", locked, KEY_SIZE, locked * 100 / KEY_SIZE);
|
||||
machine.debugger().console().printf("%4d/%4d keys guessed (%d%%)\n", guesses, KEY_SIZE, guesses * 100 / KEY_SIZE);
|
||||
machine.debugger().console().printf("%4d/%4d keys don't matter (%d%%)\n", nomatter, KEY_SIZE, nomatter * 100 / KEY_SIZE);
|
||||
}
|
||||
|
||||
|
||||
@ -1004,7 +1006,7 @@ static void execute_fdstate(running_machine &machine, int ref, int params, const
|
||||
/* set the new state if we got a parameter */
|
||||
if (params > 0)
|
||||
{
|
||||
if (!debug_command_parameter_number(machine, param[0], &newstate))
|
||||
if (!machine.debugger().commands().validate_number_parameter(param[0], &newstate))
|
||||
return;
|
||||
fd1094_set_state(keyregion, newstate);
|
||||
fd1094_regenerate_key(machine);
|
||||
@ -1013,7 +1015,7 @@ static void execute_fdstate(running_machine &machine, int ref, int params, const
|
||||
}
|
||||
|
||||
/* 0 parameters displays the current state */
|
||||
debug_console_printf(machine, "FD1094 state = %X\n", fd1094_set_state(keyregion, -1));
|
||||
machine.debugger().console().printf("FD1094 state = %X\n", fd1094_set_state(keyregion, -1));
|
||||
}
|
||||
|
||||
|
||||
@ -1024,11 +1026,11 @@ static void execute_fdstate(running_machine &machine, int ref, int params, const
|
||||
|
||||
static void execute_fdpc(running_machine &machine, int ref, int params, const char **param)
|
||||
{
|
||||
device_t *cpu = debug_cpu_get_visible_cpu(machine);
|
||||
UINT64 newpc;
|
||||
device_t *cpu = machine.debugger().cpu().get_visible_cpu();
|
||||
|
||||
/* support 0 or 1 parameters */
|
||||
if (!debug_command_parameter_number(machine, param[0], &newpc))
|
||||
UINT64 newpc = 0;
|
||||
if (!machine.debugger().commands().validate_number_parameter(param[0], &newpc))
|
||||
newpc = cpu->safe_pc();
|
||||
|
||||
/* set the new PC */
|
||||
@ -1046,7 +1048,7 @@ static void execute_fdpc(running_machine &machine, int ref, int params, const ch
|
||||
|
||||
static void execute_fdsearch(running_machine &machine, int ref, int params, const char **param)
|
||||
{
|
||||
address_space &space = debug_cpu_get_visible_cpu(machine)->memory().space(AS_PROGRAM);
|
||||
address_space &space = machine->debugger().cpu().get_visible_cpu()->memory().space(AS_PROGRAM);
|
||||
int pc = space.device().safe_pc();
|
||||
int length, first = TRUE;
|
||||
UINT8 instrdata[2];
|
||||
@ -1056,14 +1058,14 @@ static void execute_fdsearch(running_machine &machine, int ref, int params, cons
|
||||
if (searchsp == 0 || searchstack[searchsp-1] != pc)
|
||||
{
|
||||
int pcaddr;
|
||||
debug_console_printf(machine, "Starting new search at PC=%06X\n", pc);
|
||||
machine.debugger().console().printf("Starting new search at PC=%06X\n", pc);
|
||||
searchsp = 0;
|
||||
for (pcaddr = 0; pcaddr < coderegion_words; pcaddr++)
|
||||
keystatus[pcaddr] &= ~SEARCH_MASK;
|
||||
}
|
||||
else
|
||||
{
|
||||
debug_console_printf(machine, "Resuming search at PC=%06X\n", pc);
|
||||
machine.debugger().console().printf("Resuming search at PC=%06X\n", pc);
|
||||
searchsp--;
|
||||
}
|
||||
|
||||
@ -1080,7 +1082,7 @@ static void execute_fdsearch(running_machine &machine, int ref, int params, cons
|
||||
pc = searchstack[--searchsp];
|
||||
if ((keystatus[pc/2] & SEARCH_MASK) != 0)
|
||||
{
|
||||
debug_console_printf(machine, "Search stack exhausted\n");
|
||||
machine.debugger().console().printf("Search stack exhausted\n");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1103,7 +1105,7 @@ static void execute_fdsearch(running_machine &machine, int ref, int params, cons
|
||||
length = -length;
|
||||
if (length == 0)
|
||||
{
|
||||
debug_console_printf(machine, "Invalid opcode; unable to advance\n");
|
||||
machine.debugger().console().printf("Invalid opcode; unable to advance\n");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1172,7 +1174,7 @@ static void execute_fdsearch(running_machine &machine, int ref, int params, cons
|
||||
|
||||
static void execute_fddasm(running_machine &machine, int ref, int params, const char **param)
|
||||
{
|
||||
address_space &space = debug_cpu_get_visible_cpu(machine)->memory().space(AS_PROGRAM);
|
||||
address_space &space = machine->debugger().cpu().get_visible_cpu()->memory().space(AS_PROGRAM);
|
||||
int origstate = fd1094_set_state(keyregion, -1);
|
||||
const char *filename;
|
||||
int skipped = FALSE;
|
||||
@ -1186,7 +1188,7 @@ static void execute_fddasm(running_machine &machine, int ref, int params, const
|
||||
osd_file::error filerr = file.open(filename);
|
||||
if (filerr != osd_file::error::NONE)
|
||||
{
|
||||
debug_console_printf(machine, "Unable to create file '%s'\n", filename);
|
||||
machine.debugger().console().printf("Unable to create file '%s'\n", filename);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1292,24 +1294,24 @@ static void execute_fdcset(running_machine &machine, int ref, int params, const
|
||||
int cnum;
|
||||
|
||||
/* extract the parameters */
|
||||
if (!debug_command_parameter_number(machine, param[0], &pc))
|
||||
if (!machine.debugger().commands().validate_number_parameter(param[0], &pc))
|
||||
return;
|
||||
if (!debug_command_parameter_number(machine, param[1], &value))
|
||||
if (!machine.debugger().commands().validate_number_parameter(param[1], &value))
|
||||
return;
|
||||
if (params >= 3 && !debug_command_parameter_number(machine, param[2], &mask))
|
||||
if (params >= 3 && !machine.debugger().commands().validate_number_parameter(param[2], &mask))
|
||||
return;
|
||||
if (params >= 4)
|
||||
{
|
||||
if (strcmp(param[3], "irq") == 0)
|
||||
state = FD1094_STATE_IRQ;
|
||||
else if (!debug_command_parameter_number(machine, param[3], &state))
|
||||
else if (!machine.debugger().commands().validate_number_parameter(param[3], &state))
|
||||
return;
|
||||
}
|
||||
|
||||
/* validate parameters */
|
||||
if ((pc & 1) != 0 || pc > 0xffffff)
|
||||
{
|
||||
debug_console_printf(machine, "Invalid PC specified (%08X)\n", (UINT32)pc);
|
||||
machine.debugger().console().printf("Invalid PC specified (%08X)\n", (UINT32)pc);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1334,7 +1336,7 @@ static void execute_fdcset(running_machine &machine, int ref, int params, const
|
||||
set_constraint(&constraints[cnum], pc, state, value, mask);
|
||||
|
||||
/* explain what we did */
|
||||
debug_console_printf(machine, "Set new constraint at PC=%06X, state=%03X: decrypted & %04X == %04X\n",
|
||||
machine.debugger().console().printf("Set new constraint at PC=%06X, state=%03X: decrypted & %04X == %04X\n",
|
||||
(int)pc, (int)state, (int)mask, (int)value);
|
||||
}
|
||||
|
||||
@ -1352,7 +1354,7 @@ static void execute_fdclist(running_machine &machine, int ref, int params, const
|
||||
for (cnum = 0; cnum < constcount; cnum++)
|
||||
{
|
||||
fd1094_constraint *constraint = &constraints[cnum];
|
||||
debug_console_printf(machine, " PC=%06X, state=%03X: decrypted & %04X == %04X\n",
|
||||
machine.debugger().console().printf(" PC=%06X, state=%03X: decrypted & %04X == %04X\n",
|
||||
constraint->pc, constraint->state, constraint->mask, constraint->value);
|
||||
}
|
||||
}
|
||||
@ -1365,7 +1367,7 @@ static void execute_fdclist(running_machine &machine, int ref, int params, const
|
||||
|
||||
static void execute_fdcsearch(running_machine &machine, int ref, int params, const char **param)
|
||||
{
|
||||
// debug_console_printf(machine, "Searching for possible global keys....\n");
|
||||
// machine.debugger().console().printf("Searching for possible global keys....\n");
|
||||
perform_constrained_search(machine);
|
||||
}
|
||||
|
||||
@ -1565,7 +1567,7 @@ static void tag_possibility(running_machine &machine, fd1094_possibility *possda
|
||||
nomatter++;
|
||||
}
|
||||
|
||||
debug_console_printf(machine, "PC=%06X: locked %d, guessed %d, nochange %d\n", possdata->basepc, locked, guessed, nomatter);
|
||||
machine.debugger().console().printf("PC=%06X: locked %d, guessed %d, nochange %d\n", possdata->basepc, locked, guessed, nomatter);
|
||||
}
|
||||
|
||||
|
||||
@ -1598,7 +1600,7 @@ static void perform_constrained_search(running_machine &machine)
|
||||
global = find_global_key_matches(global + 1, output);
|
||||
if (global == 0)
|
||||
break;
|
||||
// debug_console_printf(machine, "Checking global key %08X (PC=%06X)....\n", global, (output[2] << 16) | output[3]);
|
||||
// machine.debugger().console().printf("Checking global key %08X (PC=%06X)....\n", global, (output[2] << 16) | output[3]);
|
||||
|
||||
/* use the IRQ handler to find more possibilities */
|
||||
numseeds = find_constraint_sequence(global, FALSE);
|
||||
@ -1606,7 +1608,7 @@ static void perform_constrained_search(running_machine &machine)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < numseeds; i++)
|
||||
debug_console_printf(machine, " Possible: global=%08X seed=%06X pc=%04X\n", global, possible_seed[i], output[3]);
|
||||
machine.debugger().console().printf(" Possible: global=%08X seed=%06X pc=%04X\n", global, possible_seed[i], output[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1779,7 +1781,7 @@ static int find_constraint_sequence(UINT32 global, int quick)
|
||||
{
|
||||
UINT32 seedlow;
|
||||
|
||||
// debug_console_printf(machine, "Global %08X ... Looking for keys that generate a keyvalue of %02X at %04X\n",
|
||||
// machine.debugger().console().printf("Global %08X ... Looking for keys that generate a keyvalue of %02X at %04X\n",
|
||||
// global, keyvalue, keyaddr);
|
||||
|
||||
/* iterate over seed possibilities */
|
||||
|
@ -1,4 +1,5 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Aaron Giles
|
||||
|
||||
void fd1094_regenerate_key(running_machine &machine);
|
||||
void fd1094_init_debugging(running_machine &machine, const char *cpureg, const char *keyreg, const char *statreg, void (*changed)(running_machine &));
|
||||
|
@ -9,7 +9,10 @@
|
||||
2011-01-29.
|
||||
*****************************************************************************/
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "includes/mbc55x.h"
|
||||
#include "debug/debugcpu.h"
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
@ -30,7 +33,6 @@
|
||||
|
||||
static void decode_dos21(device_t *device,offs_t pc);
|
||||
//static void mbc55x_recalculate_ints(running_machine &machine);
|
||||
static void mbc55x_debug(running_machine &machine, int ref, int params, const char *param[]);
|
||||
static int instruction_hook(device_t &device, offs_t curpc);
|
||||
//static void fdc_reset(running_machine &machine);
|
||||
//static void set_disk_int(running_machine &machine, int state);
|
||||
@ -334,7 +336,8 @@ void mbc55x_state::machine_start()
|
||||
/* setup debug commands */
|
||||
if (machine().debug_flags & DEBUG_FLAG_ENABLED)
|
||||
{
|
||||
debug_console_register_command(machine(), "mbc55x_debug", CMDFLAG_NONE, 0, 0, 1, mbc55x_debug);
|
||||
using namespace std::placeholders;
|
||||
machine().debugger().console().register_command("mbc55x_debug", CMDFLAG_NONE, 0, 0, 1, std::bind(&mbc55x_state::debug_command, this, _1, _2, _3));
|
||||
|
||||
/* set up the instruction hook */
|
||||
m_maincpu->debug()->set_instruction_hook(instruction_hook);
|
||||
@ -347,18 +350,18 @@ void mbc55x_state::machine_start()
|
||||
}
|
||||
|
||||
|
||||
static void mbc55x_debug(running_machine &machine, int ref, int params, const char *param[])
|
||||
void mbc55x_state::debug_command(int ref, int params, const char *param[])
|
||||
{
|
||||
mbc55x_state *state = machine.driver_data<mbc55x_state>();
|
||||
if(params>0)
|
||||
if (params > 0)
|
||||
{
|
||||
int temp;
|
||||
sscanf(param[0],"%d",&temp); state->m_debug_machine = temp;
|
||||
sscanf(param[0], "%d", &temp);
|
||||
m_debug_machine = temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
debug_console_printf(machine,"Error usage : mbc55x_debug <debuglevel>\n");
|
||||
debug_console_printf(machine,"Current debuglevel=%02X\n",state->m_debug_machine);
|
||||
machine().debugger().console().printf("Error usage : mbc55x_debug <debuglevel>\n");
|
||||
machine().debugger().console().printf("Current debuglevel=%02X\n", m_debug_machine);
|
||||
}
|
||||
}
|
||||
|
||||
@ -410,5 +413,7 @@ static void decode_dos21(device_t *device,offs_t pc)
|
||||
device->logerror("=======================================================================\n");
|
||||
|
||||
if((ax & 0xff00)==0x0900)
|
||||
debugger_break(device->machine());
|
||||
{
|
||||
device->machine().debugger().debug_break();
|
||||
}
|
||||
}
|
||||
|
@ -377,7 +377,7 @@ WRITE8_MEMBER(midway_serial_pic2_device::write)
|
||||
memcpy(m_buffer, m_data, 16);
|
||||
m_total = 16;
|
||||
m_index = 0;
|
||||
debugger_break(machine());
|
||||
machine().debugger().debug_break();
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -59,8 +59,11 @@ chdman createhd -o ST125N.chd -chs 41921,1,1 -ss 512
|
||||
|
||||
*/
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "debugger.h"
|
||||
#include "debug/debugcon.h"
|
||||
#include "debug/debugcpu.h"
|
||||
#include "imagedev/flopdrv.h"
|
||||
#include "includes/rmnimbus.h"
|
||||
|
||||
@ -172,8 +175,6 @@ struct t_nimbus_brush
|
||||
};
|
||||
|
||||
|
||||
static void nimbus_debug(running_machine &machine, int ref, int params, const char *param[]);
|
||||
|
||||
static int instruction_hook(device_t &device, offs_t curpc);
|
||||
static void decode_subbios(device_t *device,offs_t pc, UINT8 raw_flag);
|
||||
static void decode_dos21(device_t *device,offs_t pc);
|
||||
@ -229,7 +230,8 @@ void rmnimbus_state::machine_start()
|
||||
/* setup debug commands */
|
||||
if (machine().debug_flags & DEBUG_FLAG_ENABLED)
|
||||
{
|
||||
debug_console_register_command(machine(), "nimbus_debug", CMDFLAG_NONE, 0, 0, 1, nimbus_debug);
|
||||
using namespace std::placeholders;
|
||||
machine().debugger().console().register_command("nimbus_debug", CMDFLAG_NONE, 0, 0, 1, std::bind(&rmnimbus_state::debug_command, this, _1, _2, _3));
|
||||
|
||||
/* set up the instruction hook */
|
||||
m_maincpu->debug()->set_instruction_hook(instruction_hook);
|
||||
@ -239,18 +241,18 @@ void rmnimbus_state::machine_start()
|
||||
m_fdc->dden_w(0);
|
||||
}
|
||||
|
||||
static void nimbus_debug(running_machine &machine, int ref, int params, const char *param[])
|
||||
void rmnimbus_state::debug_command(int ref, int params, const char *param[])
|
||||
{
|
||||
rmnimbus_state *state = machine.driver_data<rmnimbus_state>();
|
||||
if(params>0)
|
||||
if (params > 0)
|
||||
{
|
||||
int temp;
|
||||
sscanf(param[0],"%d",&temp); state->m_debug_machine = temp;
|
||||
sscanf(param[0],"%d",&temp);
|
||||
m_debug_machine = temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
debug_console_printf(machine,"Error usage : nimbus_debug <debuglevel>\n");
|
||||
debug_console_printf(machine,"Current debuglevel=%02X\n",state->m_debug_machine);
|
||||
machine().debugger().console().printf("Error usage : nimbus_debug <debuglevel>\n");
|
||||
machine().debugger().console().printf("Current debuglevel=%02X\n", m_debug_machine);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1241,13 +1241,13 @@ WRITE16_MEMBER(tx1_state::buggyboy_math_w)
|
||||
else
|
||||
{
|
||||
osd_printf_debug("BB_DSEL was not 3 for P->S load!\n");
|
||||
debugger_break(machine());
|
||||
machine().debugger().debug_break();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
osd_printf_debug("Buggy Boy unknown math state!\n");
|
||||
debugger_break(machine());
|
||||
machine().debugger().debug_break();
|
||||
}
|
||||
|
||||
if (offset & BB_INSLD)
|
||||
|
@ -1,6 +1,8 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Samuele Zannoli
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpu/i386/i386.h"
|
||||
#include "machine/lpci.h"
|
||||
@ -9,6 +11,7 @@
|
||||
#include "machine/idectrl.h"
|
||||
#include "video/poly.h"
|
||||
#include "bitmap.h"
|
||||
#include "debugger.h"
|
||||
#include "debug/debugcon.h"
|
||||
#include "debug/debugcmd.h"
|
||||
#include "debug/debugcpu.h"
|
||||
@ -20,109 +23,113 @@
|
||||
//#define LOG_OHCI
|
||||
#define USB_HACK_ENABLED
|
||||
|
||||
static void dump_string_command(running_machine &machine, int ref, int params, const char **param)
|
||||
void xbox_base_state::dump_string_command(int ref, int params, const char **param)
|
||||
{
|
||||
xbox_base_state *state = machine.driver_data<xbox_base_state>();
|
||||
address_space &space = state->m_maincpu->space();
|
||||
UINT64 addr;
|
||||
offs_t address;
|
||||
UINT32 length, maximumlength;
|
||||
offs_t buffer;
|
||||
address_space &space = m_maincpu->space();
|
||||
|
||||
if (params < 1)
|
||||
return;
|
||||
if (!debug_command_parameter_number(machine, param[0], &addr))
|
||||
|
||||
UINT64 addr;
|
||||
if (!machine().debugger().commands().validate_number_parameter(param[0], &addr))
|
||||
return;
|
||||
address = (offs_t)addr;
|
||||
if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
|
||||
offs_t address = (offs_t)addr;
|
||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
{
|
||||
debug_console_printf(machine, "Address is unmapped.\n");
|
||||
machine().debugger().console().printf("Address is unmapped.\n");
|
||||
return;
|
||||
}
|
||||
length = space.read_word_unaligned(address);
|
||||
maximumlength = space.read_word_unaligned(address + 2);
|
||||
buffer = space.read_dword_unaligned(address + 4);
|
||||
debug_console_printf(machine, "Length %d word\n", length);
|
||||
debug_console_printf(machine, "MaximumLength %d word\n", maximumlength);
|
||||
debug_console_printf(machine, "Buffer %08X byte* ", buffer);
|
||||
if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &buffer))
|
||||
|
||||
UINT32 length = space.read_word_unaligned(address);
|
||||
UINT32 maximumlength = space.read_word_unaligned(address + 2);
|
||||
offs_t buffer = space.read_dword_unaligned(address + 4);
|
||||
machine().debugger().console().printf("Length %d word\n", length);
|
||||
machine().debugger().console().printf("MaximumLength %d word\n", maximumlength);
|
||||
machine().debugger().console().printf("Buffer %08X byte* ", buffer);
|
||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &buffer))
|
||||
{
|
||||
debug_console_printf(machine, "\nBuffer is unmapped.\n");
|
||||
machine().debugger().console().printf("\nBuffer is unmapped.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (length > 256)
|
||||
length = 256;
|
||||
|
||||
for (int a = 0; a < length; a++)
|
||||
{
|
||||
UINT8 c = space.read_byte(buffer + a);
|
||||
debug_console_printf(machine, "%c", c);
|
||||
machine().debugger().console().printf("%c", c);
|
||||
}
|
||||
debug_console_printf(machine, "\n");
|
||||
machine().debugger().console().printf("\n");
|
||||
}
|
||||
|
||||
static void dump_process_command(running_machine &machine, int ref, int params, const char **param)
|
||||
void xbox_base_state::dump_process_command(int ref, int params, const char **param)
|
||||
{
|
||||
xbox_base_state *state = machine.driver_data<xbox_base_state>();
|
||||
address_space &space = state->m_maincpu->space();
|
||||
address_space &space = m_maincpu->space();
|
||||
|
||||
if (params < 1)
|
||||
return;
|
||||
|
||||
UINT64 addr;
|
||||
offs_t address;
|
||||
if (!machine().debugger().commands().validate_number_parameter(param[0], &addr))
|
||||
return;
|
||||
|
||||
if (params < 1)
|
||||
return;
|
||||
if (!debug_command_parameter_number(machine, param[0], &addr))
|
||||
return;
|
||||
address = (offs_t)addr;
|
||||
if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
offs_t address = (offs_t)addr;
|
||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
{
|
||||
debug_console_printf(machine, "Address is unmapped.\n");
|
||||
machine().debugger().console().printf("Address is unmapped.\n");
|
||||
return;
|
||||
}
|
||||
debug_console_printf(machine, "ReadyListHead {%08X,%08X} _LIST_ENTRY\n", space.read_dword_unaligned(address), space.read_dword_unaligned(address + 4));
|
||||
debug_console_printf(machine, "ThreadListHead {%08X,%08X} _LIST_ENTRY\n", space.read_dword_unaligned(address + 8), space.read_dword_unaligned(address + 12));
|
||||
debug_console_printf(machine, "StackCount %d dword\n", space.read_dword_unaligned(address + 16));
|
||||
debug_console_printf(machine, "ThreadQuantum %d dword\n", space.read_dword_unaligned(address + 20));
|
||||
debug_console_printf(machine, "BasePriority %d byte\n", space.read_byte(address + 24));
|
||||
debug_console_printf(machine, "DisableBoost %d byte\n", space.read_byte(address + 25));
|
||||
debug_console_printf(machine, "DisableQuantum %d byte\n", space.read_byte(address + 26));
|
||||
debug_console_printf(machine, "_padding %d byte\n", space.read_byte(address + 27));
|
||||
machine().debugger().console().printf("ReadyListHead {%08X,%08X} _LIST_ENTRY\n", space.read_dword_unaligned(address), space.read_dword_unaligned(address + 4));
|
||||
machine().debugger().console().printf("ThreadListHead {%08X,%08X} _LIST_ENTRY\n", space.read_dword_unaligned(address + 8), space.read_dword_unaligned(address + 12));
|
||||
machine().debugger().console().printf("StackCount %d dword\n", space.read_dword_unaligned(address + 16));
|
||||
machine().debugger().console().printf("ThreadQuantum %d dword\n", space.read_dword_unaligned(address + 20));
|
||||
machine().debugger().console().printf("BasePriority %d byte\n", space.read_byte(address + 24));
|
||||
machine().debugger().console().printf("DisableBoost %d byte\n", space.read_byte(address + 25));
|
||||
machine().debugger().console().printf("DisableQuantum %d byte\n", space.read_byte(address + 26));
|
||||
machine().debugger().console().printf("_padding %d byte\n", space.read_byte(address + 27));
|
||||
}
|
||||
|
||||
static void dump_list_command(running_machine &machine, int ref, int params, const char **param)
|
||||
void xbox_base_state::dump_list_command(int ref, int params, const char **param)
|
||||
{
|
||||
xbox_base_state *state = machine.driver_data<xbox_base_state>();
|
||||
address_space &space = state->m_maincpu->space();
|
||||
UINT64 addr, offs, start, old;
|
||||
offs_t address, offset;
|
||||
address_space &space = m_maincpu->space();
|
||||
|
||||
if (params < 1)
|
||||
return;
|
||||
if (!debug_command_parameter_number(machine, param[0], &addr))
|
||||
|
||||
UINT64 addr;
|
||||
if (!machine().debugger().commands().validate_number_parameter(param[0], &addr))
|
||||
return;
|
||||
offs = 0;
|
||||
offset = 0;
|
||||
|
||||
UINT64 offs = 0;
|
||||
offs_t offset = 0;
|
||||
if (params >= 2)
|
||||
{
|
||||
if (!debug_command_parameter_number(machine, param[1], &offs))
|
||||
if (!machine().debugger().commands().validate_number_parameter(param[1], &offs))
|
||||
return;
|
||||
offset = (offs_t)offs;
|
||||
}
|
||||
start = addr;
|
||||
address = (offs_t)addr;
|
||||
if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
|
||||
UINT64 start = addr;
|
||||
offs_t address = (offs_t)addr;
|
||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
{
|
||||
debug_console_printf(machine, "Address is unmapped.\n");
|
||||
machine().debugger().console().printf("Address is unmapped.\n");
|
||||
return;
|
||||
}
|
||||
if (params >= 2)
|
||||
debug_console_printf(machine, "Entry Object\n");
|
||||
machine().debugger().console().printf("Entry Object\n");
|
||||
else
|
||||
debug_console_printf(machine, "Entry\n");
|
||||
machine().debugger().console().printf("Entry\n");
|
||||
|
||||
UINT64 old;
|
||||
for (int num = 0; num < 32; num++)
|
||||
{
|
||||
if (params >= 2)
|
||||
debug_console_printf(machine, "%08X %08X\n", (UINT32)addr, (offs_t)addr - offset);
|
||||
machine().debugger().console().printf("%08X %08X\n", (UINT32)addr, (offs_t)addr - offset);
|
||||
else
|
||||
debug_console_printf(machine, "%08X\n", (UINT32)addr);
|
||||
machine().debugger().console().printf("%08X\n", (UINT32)addr);
|
||||
old = addr;
|
||||
addr = space.read_dword_unaligned(address);
|
||||
if (addr == start)
|
||||
@ -130,159 +137,151 @@ static void dump_list_command(running_machine &machine, int ref, int params, con
|
||||
if (addr == old)
|
||||
break;
|
||||
address = (offs_t)addr;
|
||||
if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void dump_dpc_command(running_machine &machine, int ref, int params, const char **param)
|
||||
void xbox_base_state::dump_dpc_command(int ref, int params, const char **param)
|
||||
{
|
||||
xbox_base_state *state = machine.driver_data<xbox_base_state>();
|
||||
address_space &space = state->m_maincpu->space();
|
||||
UINT64 addr;
|
||||
offs_t address;
|
||||
address_space &space = m_maincpu->space();
|
||||
|
||||
if (params < 1)
|
||||
return;
|
||||
if (!debug_command_parameter_number(machine, param[0], &addr))
|
||||
|
||||
UINT64 addr;
|
||||
if (!machine().debugger().commands().validate_number_parameter(param[0], &addr))
|
||||
return;
|
||||
address = (offs_t)addr;
|
||||
if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
|
||||
offs_t address = (offs_t)addr;
|
||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
{
|
||||
debug_console_printf(machine, "Address is unmapped.\n");
|
||||
machine().debugger().console().printf("Address is unmapped.\n");
|
||||
return;
|
||||
}
|
||||
debug_console_printf(machine, "Type %d word\n", space.read_word_unaligned(address));
|
||||
debug_console_printf(machine, "Inserted %d byte\n", space.read_byte(address + 2));
|
||||
debug_console_printf(machine, "Padding %d byte\n", space.read_byte(address + 3));
|
||||
debug_console_printf(machine, "DpcListEntry {%08X,%08X} _LIST_ENTRY\n", space.read_dword_unaligned(address + 4), space.read_dword_unaligned(address + 8));
|
||||
debug_console_printf(machine, "DeferredRoutine %08X dword\n", space.read_dword_unaligned(address + 12));
|
||||
debug_console_printf(machine, "DeferredContext %08X dword\n", space.read_dword_unaligned(address + 16));
|
||||
debug_console_printf(machine, "SystemArgument1 %08X dword\n", space.read_dword_unaligned(address + 20));
|
||||
debug_console_printf(machine, "SystemArgument2 %08X dword\n", space.read_dword_unaligned(address + 24));
|
||||
machine().debugger().console().printf("Type %d word\n", space.read_word_unaligned(address));
|
||||
machine().debugger().console().printf("Inserted %d byte\n", space.read_byte(address + 2));
|
||||
machine().debugger().console().printf("Padding %d byte\n", space.read_byte(address + 3));
|
||||
machine().debugger().console().printf("DpcListEntry {%08X,%08X} _LIST_ENTRY\n", space.read_dword_unaligned(address + 4), space.read_dword_unaligned(address + 8));
|
||||
machine().debugger().console().printf("DeferredRoutine %08X dword\n", space.read_dword_unaligned(address + 12));
|
||||
machine().debugger().console().printf("DeferredContext %08X dword\n", space.read_dword_unaligned(address + 16));
|
||||
machine().debugger().console().printf("SystemArgument1 %08X dword\n", space.read_dword_unaligned(address + 20));
|
||||
machine().debugger().console().printf("SystemArgument2 %08X dword\n", space.read_dword_unaligned(address + 24));
|
||||
}
|
||||
|
||||
static void dump_timer_command(running_machine &machine, int ref, int params, const char **param)
|
||||
void xbox_base_state::dump_timer_command(int ref, int params, const char **param)
|
||||
{
|
||||
xbox_base_state *state = machine.driver_data<xbox_base_state>();
|
||||
address_space &space = state->m_maincpu->space();
|
||||
UINT64 addr;
|
||||
offs_t address;
|
||||
address_space &space = m_maincpu->space();
|
||||
|
||||
if (params < 1)
|
||||
return;
|
||||
if (!debug_command_parameter_number(machine, param[0], &addr))
|
||||
|
||||
UINT64 addr;
|
||||
if (!machine().debugger().commands().validate_number_parameter(param[0], &addr))
|
||||
return;
|
||||
address = (offs_t)addr;
|
||||
if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
|
||||
offs_t address = (offs_t)addr;
|
||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
{
|
||||
debug_console_printf(machine, "Address is unmapped.\n");
|
||||
machine().debugger().console().printf("Address is unmapped.\n");
|
||||
return;
|
||||
}
|
||||
debug_console_printf(machine, "Header.Type %d byte\n", space.read_byte(address));
|
||||
debug_console_printf(machine, "Header.Absolute %d byte\n", space.read_byte(address + 1));
|
||||
debug_console_printf(machine, "Header.Size %d byte\n", space.read_byte(address + 2));
|
||||
debug_console_printf(machine, "Header.Inserted %d byte\n", space.read_byte(address + 3));
|
||||
debug_console_printf(machine, "Header.SignalState %08X dword\n", space.read_dword_unaligned(address + 4));
|
||||
debug_console_printf(machine, "Header.WaitListEntry {%08X,%08X} _LIST_ENTRY\n", space.read_dword_unaligned(address + 8), space.read_dword_unaligned(address + 12));
|
||||
debug_console_printf(machine, "%s", string_format("DueTime %I64x qword\n", (INT64)space.read_qword_unaligned(address + 16)).c_str());
|
||||
debug_console_printf(machine, "TimerListEntry {%08X,%08X} _LIST_ENTRY\n", space.read_dword_unaligned(address + 24), space.read_dword_unaligned(address + 28));
|
||||
debug_console_printf(machine, "Dpc %08X dword\n", space.read_dword_unaligned(address + 32));
|
||||
debug_console_printf(machine, "Period %d dword\n", space.read_dword_unaligned(address + 36));
|
||||
machine().debugger().console().printf("Header.Type %d byte\n", space.read_byte(address));
|
||||
machine().debugger().console().printf("Header.Absolute %d byte\n", space.read_byte(address + 1));
|
||||
machine().debugger().console().printf("Header.Size %d byte\n", space.read_byte(address + 2));
|
||||
machine().debugger().console().printf("Header.Inserted %d byte\n", space.read_byte(address + 3));
|
||||
machine().debugger().console().printf("Header.SignalState %08X dword\n", space.read_dword_unaligned(address + 4));
|
||||
machine().debugger().console().printf("Header.WaitListEntry {%08X,%08X} _LIST_ENTRY\n", space.read_dword_unaligned(address + 8), space.read_dword_unaligned(address + 12));
|
||||
machine().debugger().console().printf("%s", string_format("DueTime %I64x qword\n", (INT64)space.read_qword_unaligned(address + 16)).c_str());
|
||||
machine().debugger().console().printf("TimerListEntry {%08X,%08X} _LIST_ENTRY\n", space.read_dword_unaligned(address + 24), space.read_dword_unaligned(address + 28));
|
||||
machine().debugger().console().printf("Dpc %08X dword\n", space.read_dword_unaligned(address + 32));
|
||||
machine().debugger().console().printf("Period %d dword\n", space.read_dword_unaligned(address + 36));
|
||||
}
|
||||
|
||||
static void curthread_command(running_machine &machine, int ref, int params, const char **param)
|
||||
void xbox_base_state::curthread_command(int ref, int params, const char **param)
|
||||
{
|
||||
xbox_base_state *state = machine.driver_data<xbox_base_state>();
|
||||
address_space &space = state->m_maincpu->space();
|
||||
UINT64 fsbase;
|
||||
UINT32 kthrd, topstack, tlsdata;
|
||||
offs_t address;
|
||||
address_space &space = m_maincpu->space();
|
||||
|
||||
fsbase = state->m_maincpu->state_int(44);
|
||||
address = (offs_t)fsbase + 0x28;
|
||||
if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
UINT64 fsbase = m_maincpu->state_int(44);
|
||||
offs_t address = (offs_t)fsbase + 0x28;
|
||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
{
|
||||
debug_console_printf(machine, "Address is unmapped.\n");
|
||||
machine().debugger().console().printf("Address is unmapped.\n");
|
||||
return;
|
||||
}
|
||||
kthrd = space.read_dword_unaligned(address);
|
||||
debug_console_printf(machine, "Current thread is %08X\n", kthrd);
|
||||
|
||||
UINT32 kthrd = space.read_dword_unaligned(address);
|
||||
machine().debugger().console().printf("Current thread is %08X\n", kthrd);
|
||||
|
||||
address = (offs_t)kthrd + 0x1c;
|
||||
if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
return;
|
||||
topstack = space.read_dword_unaligned(address);
|
||||
debug_console_printf(machine, "Current thread stack top is %08X\n", topstack);
|
||||
|
||||
UINT32 topstack = space.read_dword_unaligned(address);
|
||||
machine().debugger().console().printf("Current thread stack top is %08X\n", topstack);
|
||||
|
||||
address = (offs_t)kthrd + 0x28;
|
||||
if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
return;
|
||||
tlsdata = space.read_dword_unaligned(address);
|
||||
|
||||
UINT32 tlsdata = space.read_dword_unaligned(address);
|
||||
if (tlsdata == 0)
|
||||
address = (offs_t)topstack - 0x210 - 8;
|
||||
else
|
||||
address = (offs_t)tlsdata - 8;
|
||||
if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &address))
|
||||
return;
|
||||
debug_console_printf(machine, "Current thread function is %08X\n", space.read_dword_unaligned(address));
|
||||
machine().debugger().console().printf("Current thread function is %08X\n", space.read_dword_unaligned(address));
|
||||
}
|
||||
|
||||
static void generate_irq_command(running_machine &machine, int ref, int params, const char **param)
|
||||
void xbox_base_state::generate_irq_command(int ref, int params, const char **param)
|
||||
{
|
||||
UINT64 irq;
|
||||
xbox_base_state *chst = machine.driver_data<xbox_base_state>();
|
||||
|
||||
if (params < 1)
|
||||
return;
|
||||
if (!debug_command_parameter_number(machine, param[0], &irq))
|
||||
if (!machine().debugger().commands().validate_number_parameter(param[0], &irq))
|
||||
return;
|
||||
if (irq > 15)
|
||||
return;
|
||||
if (irq == 2)
|
||||
return;
|
||||
chst->debug_generate_irq((int)irq, true);
|
||||
debug_generate_irq((int)irq, true);
|
||||
}
|
||||
|
||||
static void nv2a_combiners_command(running_machine &machine, int ref, int params, const char **param)
|
||||
void xbox_base_state::nv2a_combiners_command(int ref, int params, const char **param)
|
||||
{
|
||||
int en;
|
||||
|
||||
xbox_base_state *chst = machine.driver_data<xbox_base_state>();
|
||||
en = chst->nvidia_nv2a->toggle_register_combiners_usage();
|
||||
int en = nvidia_nv2a->toggle_register_combiners_usage();
|
||||
if (en != 0)
|
||||
debug_console_printf(machine, "Register combiners enabled\n");
|
||||
machine().debugger().console().printf("Register combiners enabled\n");
|
||||
else
|
||||
debug_console_printf(machine, "Register combiners disabled\n");
|
||||
machine().debugger().console().printf("Register combiners disabled\n");
|
||||
}
|
||||
|
||||
static void waitvblank_command(running_machine &machine, int ref, int params, const char **param)
|
||||
void xbox_base_state::waitvblank_command(int ref, int params, const char **param)
|
||||
{
|
||||
int en;
|
||||
|
||||
xbox_base_state *chst = machine.driver_data<xbox_base_state>();
|
||||
en = chst->nvidia_nv2a->toggle_wait_vblank_support();
|
||||
int en = nvidia_nv2a->toggle_wait_vblank_support();
|
||||
if (en != 0)
|
||||
debug_console_printf(machine, "Vblank method enabled\n");
|
||||
machine().debugger().console().printf("Vblank method enabled\n");
|
||||
else
|
||||
debug_console_printf(machine, "Vblank method disabled\n");
|
||||
machine().debugger().console().printf("Vblank method disabled\n");
|
||||
}
|
||||
|
||||
static void grab_texture_command(running_machine &machine, int ref, int params, const char **param)
|
||||
void xbox_base_state::grab_texture_command(int ref, int params, const char **param)
|
||||
{
|
||||
UINT64 type;
|
||||
xbox_base_state *chst = machine.driver_data<xbox_base_state>();
|
||||
|
||||
if (params < 2)
|
||||
return;
|
||||
if (!debug_command_parameter_number(machine, param[0], &type))
|
||||
if (!machine().debugger().commands().validate_number_parameter(param[0], &type))
|
||||
return;
|
||||
if ((param[1][0] == 0) || (strlen(param[1]) > 127))
|
||||
return;
|
||||
chst->nvidia_nv2a->debug_grab_texture((int)type, param[1]);
|
||||
nvidia_nv2a->debug_grab_texture((int)type, param[1]);
|
||||
}
|
||||
|
||||
static void grab_vprog_command(running_machine &machine, int ref, int params, const char **param)
|
||||
void xbox_base_state::grab_vprog_command(int ref, int params, const char **param)
|
||||
{
|
||||
xbox_base_state *chst = machine.driver_data<xbox_base_state>();
|
||||
UINT32 instruction[4];
|
||||
FILE *fil;
|
||||
|
||||
@ -293,36 +292,40 @@ static void grab_vprog_command(running_machine &machine, int ref, int params, co
|
||||
if ((fil = fopen(param[0], "wb")) == nullptr)
|
||||
return;
|
||||
for (int n = 0; n < 136; n++) {
|
||||
chst->nvidia_nv2a->debug_grab_vertex_program_slot(n, instruction);
|
||||
nvidia_nv2a->debug_grab_vertex_program_slot(n, instruction);
|
||||
fwrite(instruction, sizeof(UINT32), 4, fil);
|
||||
}
|
||||
fclose(fil);
|
||||
}
|
||||
|
||||
static void vprogdis_command(running_machine &machine, int ref, int params, const char **param)
|
||||
void xbox_base_state::vprogdis_command(int ref, int params, const char **param)
|
||||
{
|
||||
UINT64 address, length, type;
|
||||
UINT32 instruction[4];
|
||||
offs_t addr;
|
||||
vertex_program_disassembler vd;
|
||||
char line[64];
|
||||
xbox_base_state *chst = machine.driver_data<xbox_base_state>();
|
||||
address_space &space = chst->m_maincpu->space();
|
||||
address_space &space = m_maincpu->space();
|
||||
|
||||
if (params < 2)
|
||||
return;
|
||||
if (!debug_command_parameter_number(machine, param[0], &address))
|
||||
|
||||
UINT64 address;
|
||||
if (!machine().debugger().commands().validate_number_parameter(param[0], &address))
|
||||
return;
|
||||
if (!debug_command_parameter_number(machine, param[1], &length))
|
||||
|
||||
UINT64 length;
|
||||
if (!machine().debugger().commands().validate_number_parameter(param[1], &length))
|
||||
return;
|
||||
type = 0;
|
||||
|
||||
UINT64 type = 0;
|
||||
if (params > 2)
|
||||
if (!debug_command_parameter_number(machine, param[2], &type))
|
||||
if (!machine().debugger().commands().validate_number_parameter(param[2], &type))
|
||||
return;
|
||||
while (length > 0) {
|
||||
if (type == 1) {
|
||||
addr = (offs_t)address;
|
||||
if (!debug_cpu_translate(space, TRANSLATE_READ_DEBUG, &addr))
|
||||
|
||||
vertex_program_disassembler vd;
|
||||
while (length > 0)
|
||||
{
|
||||
UINT32 instruction[4];
|
||||
if (type == 1)
|
||||
{
|
||||
offs_t addr = (offs_t)address;
|
||||
if (!machine().debugger().cpu().translate(space, TRANSLATE_READ_DEBUG, &addr))
|
||||
return;
|
||||
instruction[0] = space.read_dword_unaligned(address);
|
||||
instruction[1] = space.read_dword_unaligned(address + 4);
|
||||
@ -330,65 +333,71 @@ static void vprogdis_command(running_machine &machine, int ref, int params, cons
|
||||
instruction[3] = space.read_dword_unaligned(address + 12);
|
||||
}
|
||||
else
|
||||
chst->nvidia_nv2a->debug_grab_vertex_program_slot((int)address, instruction);
|
||||
{
|
||||
nvidia_nv2a->debug_grab_vertex_program_slot((int)address, instruction);
|
||||
}
|
||||
|
||||
char line[64];
|
||||
while (vd.disassemble(instruction, line) != 0)
|
||||
debug_console_printf(machine, "%s\n", line);
|
||||
machine().debugger().console().printf("%s\n", line);
|
||||
|
||||
if (type == 1)
|
||||
address = address + 4 * 4;
|
||||
else
|
||||
address++;
|
||||
|
||||
length--;
|
||||
}
|
||||
}
|
||||
|
||||
static void help_command(running_machine &machine, int ref, int params, const char **param)
|
||||
void xbox_base_state::help_command(int ref, int params, const char **param)
|
||||
{
|
||||
debug_console_printf(machine, "Available Xbox commands:\n");
|
||||
debug_console_printf(machine, " xbox dump_string,<address> -- Dump _STRING object at <address>\n");
|
||||
debug_console_printf(machine, " xbox dump_process,<address> -- Dump _PROCESS object at <address>\n");
|
||||
debug_console_printf(machine, " xbox dump_list,<address>[,<offset>] -- Dump _LIST_ENTRY chain starting at <address>\n");
|
||||
debug_console_printf(machine, " xbox dump_dpc,<address> -- Dump _KDPC object at <address>\n");
|
||||
debug_console_printf(machine, " xbox dump_timer,<address> -- Dump _KTIMER object at <address>\n");
|
||||
debug_console_printf(machine, " xbox curthread -- Print information about current thread\n");
|
||||
debug_console_printf(machine, " xbox irq,<number> -- Generate interrupt with irq number 0-15\n");
|
||||
debug_console_printf(machine, " xbox nv2a_combiners -- Toggle use of register combiners\n");
|
||||
debug_console_printf(machine, " xbox waitvblank -- Toggle support for wait vblank method\n");
|
||||
debug_console_printf(machine, " xbox grab_texture,<type>,<filename> -- Save to <filename> the next used texture of type <type>\n");
|
||||
debug_console_printf(machine, " xbox grab_vprog,<filename> -- save current vertex program instruction slots to <filename>\n");
|
||||
debug_console_printf(machine, " xbox vprogdis,<address>,<length>[,<type>] -- disassemble <lenght> vertex program instructions at <address> of <type>\n");
|
||||
debug_console_printf(machine, " xbox help -- this list\n");
|
||||
machine().debugger().console().printf("Available Xbox commands:\n");
|
||||
machine().debugger().console().printf(" xbox dump_string,<address> -- Dump _STRING object at <address>\n");
|
||||
machine().debugger().console().printf(" xbox dump_process,<address> -- Dump _PROCESS object at <address>\n");
|
||||
machine().debugger().console().printf(" xbox dump_list,<address>[,<offset>] -- Dump _LIST_ENTRY chain starting at <address>\n");
|
||||
machine().debugger().console().printf(" xbox dump_dpc,<address> -- Dump _KDPC object at <address>\n");
|
||||
machine().debugger().console().printf(" xbox dump_timer,<address> -- Dump _KTIMER object at <address>\n");
|
||||
machine().debugger().console().printf(" xbox curthread -- Print information about current thread\n");
|
||||
machine().debugger().console().printf(" xbox irq,<number> -- Generate interrupt with irq number 0-15\n");
|
||||
machine().debugger().console().printf(" xbox nv2a_combiners -- Toggle use of register combiners\n");
|
||||
machine().debugger().console().printf(" xbox waitvblank -- Toggle support for wait vblank method\n");
|
||||
machine().debugger().console().printf(" xbox grab_texture,<type>,<filename> -- Save to <filename> the next used texture of type <type>\n");
|
||||
machine().debugger().console().printf(" xbox grab_vprog,<filename> -- save current vertex program instruction slots to <filename>\n");
|
||||
machine().debugger().console().printf(" xbox vprogdis,<address>,<length>[,<type>] -- disassemble <lenght> vertex program instructions at <address> of <type>\n");
|
||||
machine().debugger().console().printf(" xbox help -- this list\n");
|
||||
}
|
||||
|
||||
static void xbox_debug_commands(running_machine &machine, int ref, int params, const char **param)
|
||||
void xbox_base_state::xbox_debug_commands(int ref, int params, const char **param)
|
||||
{
|
||||
if (params < 1)
|
||||
return;
|
||||
if (strcmp("dump_string", param[0]) == 0)
|
||||
dump_string_command(machine, ref, params - 1, param + 1);
|
||||
dump_string_command(ref, params - 1, param + 1);
|
||||
else if (strcmp("dump_process", param[0]) == 0)
|
||||
dump_process_command(machine, ref, params - 1, param + 1);
|
||||
dump_process_command(ref, params - 1, param + 1);
|
||||
else if (strcmp("dump_list", param[0]) == 0)
|
||||
dump_list_command(machine, ref, params - 1, param + 1);
|
||||
dump_list_command(ref, params - 1, param + 1);
|
||||
else if (strcmp("dump_dpc", param[0]) == 0)
|
||||
dump_dpc_command(machine, ref, params - 1, param + 1);
|
||||
dump_dpc_command(ref, params - 1, param + 1);
|
||||
else if (strcmp("dump_timer", param[0]) == 0)
|
||||
dump_timer_command(machine, ref, params - 1, param + 1);
|
||||
dump_timer_command(ref, params - 1, param + 1);
|
||||
else if (strcmp("curthread", param[0]) == 0)
|
||||
curthread_command(machine, ref, params - 1, param + 1);
|
||||
curthread_command(ref, params - 1, param + 1);
|
||||
else if (strcmp("irq", param[0]) == 0)
|
||||
generate_irq_command(machine, ref, params - 1, param + 1);
|
||||
generate_irq_command(ref, params - 1, param + 1);
|
||||
else if (strcmp("nv2a_combiners", param[0]) == 0)
|
||||
nv2a_combiners_command(machine, ref, params - 1, param + 1);
|
||||
nv2a_combiners_command(ref, params - 1, param + 1);
|
||||
else if (strcmp("waitvblank", param[0]) == 0)
|
||||
waitvblank_command(machine, ref, params - 1, param + 1);
|
||||
waitvblank_command(ref, params - 1, param + 1);
|
||||
else if (strcmp("grab_texture", param[0]) == 0)
|
||||
grab_texture_command(machine, ref, params - 1, param + 1);
|
||||
grab_texture_command(ref, params - 1, param + 1);
|
||||
else if (strcmp("grab_vprog", param[0]) == 0)
|
||||
grab_vprog_command(machine, ref, params - 1, param + 1);
|
||||
grab_vprog_command(ref, params - 1, param + 1);
|
||||
else if (strcmp("vprogdis", param[0]) == 0)
|
||||
vprogdis_command(machine, ref, params - 1, param + 1);
|
||||
vprogdis_command(ref, params - 1, param + 1);
|
||||
else
|
||||
help_command(machine, ref, params - 1, param + 1);
|
||||
help_command(ref, params - 1, param + 1);
|
||||
}
|
||||
|
||||
void xbox_base_state::debug_generate_irq(int irq, bool active)
|
||||
@ -2639,7 +2648,10 @@ void xbox_base_state::machine_start()
|
||||
apust.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(xbox_base_state::audio_apu_timer), this), (void *)"APU Timer");
|
||||
apust.timer->enable(false);
|
||||
if (machine().debug_flags & DEBUG_FLAG_ENABLED)
|
||||
debug_console_register_command(machine(), "xbox", CMDFLAG_NONE, 0, 1, 4, xbox_debug_commands);
|
||||
{
|
||||
using namespace std::placeholders;
|
||||
machine().debugger().console().register_command("xbox", CMDFLAG_NONE, 0, 1, 4, std::bind(&xbox_base_state::xbox_debug_commands, this, _1, _2, _3));
|
||||
}
|
||||
// PIC challenge handshake data
|
||||
pic16lc_buffer[0x1c] = 0x0c;
|
||||
pic16lc_buffer[0x1d] = 0x0d;
|
||||
|
@ -68,6 +68,8 @@ give the leftmost column of the rectangle, the next four give the next column, a
|
||||
|
||||
*************************************************************************************************************/
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "includes/mbc55x.h"
|
||||
|
||||
#define DEBUG_LINES 1
|
||||
@ -75,18 +77,18 @@ give the leftmost column of the rectangle, the next four give the next column, a
|
||||
|
||||
#define DEBUG_SET(flags) ((m_debug_video & (flags))==(flags))
|
||||
|
||||
static void video_debug(running_machine &machine, int ref, int params, const char *param[])
|
||||
void mbc55x_state::video_debug(int ref, int params, const char *param[])
|
||||
{
|
||||
mbc55x_state *mstate = machine.driver_data<mbc55x_state>();
|
||||
if(params>0)
|
||||
if (params > 0)
|
||||
{
|
||||
int temp;
|
||||
sscanf(param[0],"%d",&temp); mstate->m_debug_video = temp;;
|
||||
sscanf(param[0],"%d",&temp);
|
||||
m_debug_video = temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
debug_console_printf(machine,"Error usage : mbc55x_vid_debug <debuglevel>\n");
|
||||
debug_console_printf(machine,"Current debuglevel=%02X\n",mstate->m_debug_video);
|
||||
machine().debugger().console().printf("Error usage : mbc55x_vid_debug <debuglevel>\n");
|
||||
machine().debugger().console().printf("Current debuglevel=%02X\n", m_debug_video);
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,7 +170,8 @@ void mbc55x_state::video_start()
|
||||
|
||||
if (machine().debug_flags & DEBUG_FLAG_ENABLED)
|
||||
{
|
||||
debug_console_register_command(machine(), "mbc55x_vid_debug", CMDFLAG_NONE, 0, 0, 1, video_debug);
|
||||
using namespace std::placeholders;
|
||||
machine().debugger().console().register_command("mbc55x_vid_debug", CMDFLAG_NONE, 0, 0, 1, std::bind(&mbc55x_state::video_debug, this, _1, _2, _3));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -292,10 +292,10 @@ WRITE16_MEMBER( namcos2_state::rozram_word_w )
|
||||
{
|
||||
COMBINE_DATA(&m_rozram[offset]);
|
||||
m_tilemap_roz->mark_tile_dirty(offset);
|
||||
// if( space.machine().input().code_pressed(KEYCODE_Q) )
|
||||
// {
|
||||
// debugger_break(space.machine());
|
||||
// }
|
||||
//if( space.machine().input().code_pressed(KEYCODE_Q) )
|
||||
//{
|
||||
// machine().debugger().debug_break();
|
||||
//}
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
|
@ -1502,13 +1502,13 @@ WRITE32_MEMBER( powervr2_device::ta_yuv_tex_ctrl_w )
|
||||
/* TODO */
|
||||
READ32_MEMBER( powervr2_device::ta_yuv_tex_cnt_r )
|
||||
{
|
||||
debugger_break(machine());
|
||||
machine().debugger().debug_break();
|
||||
return ta_yuv_tex_cnt;
|
||||
}
|
||||
|
||||
WRITE32_MEMBER( powervr2_device::ta_yuv_tex_cnt_w )
|
||||
{
|
||||
debugger_break(machine());
|
||||
machine().debugger().debug_break();
|
||||
COMBINE_DATA(&ta_yuv_tex_cnt);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,10 @@
|
||||
code on the real machine.
|
||||
*/
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "emu.h"
|
||||
#include "debugger.h"
|
||||
#include "debug/debugcpu.h"
|
||||
#include "debug/debugcon.h"
|
||||
#include "includes/rmnimbus.h"
|
||||
@ -45,8 +48,6 @@
|
||||
|
||||
#define DEBUG_SET(flags) ((m_debug_video & (flags))==(flags))
|
||||
|
||||
static void video_debug(running_machine &machine, int ref, int params, const char *param[]);
|
||||
|
||||
READ16_MEMBER(rmnimbus_state::nimbus_video_io_r)
|
||||
{
|
||||
UINT16 result = 0;
|
||||
@ -470,30 +471,31 @@ void rmnimbus_state::change_palette(UINT8 bank, UINT16 colours)
|
||||
}
|
||||
}
|
||||
|
||||
static void video_debug(running_machine &machine, int ref, int params, const char *param[])
|
||||
void rmnimbus_state::video_debug(int ref, int params, const char *param[])
|
||||
{
|
||||
rmnimbus_state *state = machine.driver_data<rmnimbus_state>();
|
||||
if(params>0)
|
||||
if (params > 0)
|
||||
{
|
||||
int temp;
|
||||
sscanf(param[0],"%d",&temp); state->m_debug_video = temp;
|
||||
sscanf(param[0],"%d",&temp);
|
||||
m_debug_video = temp;
|
||||
}
|
||||
else
|
||||
{
|
||||
debug_console_printf(machine,"Error usage : nimbus_vid_debug <debuglevel>\n");
|
||||
debug_console_printf(machine,"Current debuglevel=%02X\n",state->m_debug_video);
|
||||
machine().debugger().console().printf("Error usage : nimbus_vid_debug <debuglevel>\n");
|
||||
machine().debugger().console().printf("Current debuglevel=%02X\n", m_debug_video);
|
||||
}
|
||||
}
|
||||
|
||||
void rmnimbus_state::video_start()
|
||||
{
|
||||
m_debug_video=0;
|
||||
m_debug_video = 0;
|
||||
|
||||
m_screen->register_screen_bitmap(m_video_mem);
|
||||
|
||||
if (machine().debug_flags & DEBUG_FLAG_ENABLED)
|
||||
{
|
||||
debug_console_register_command(machine(), "nimbus_vid_debug", CMDFLAG_NONE, 0, 0, 1, video_debug);
|
||||
using namespace std::placeholders;
|
||||
machine().debugger().console().register_command("nimbus_vid_debug", CMDFLAG_NONE, 0, 0, 1, std::bind(&rmnimbus_state::video_debug, this, _1, _2, _3));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -316,36 +316,36 @@ void debug_imgui::handle_keys()
|
||||
else
|
||||
{
|
||||
m_machine->schedule_soft_reset();
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->go();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->go();
|
||||
}
|
||||
}
|
||||
|
||||
if(ImGui::IsKeyPressed(ITEM_ID_F5,false))
|
||||
{
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->go();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->go();
|
||||
m_running = true;
|
||||
}
|
||||
if(ImGui::IsKeyPressed(ITEM_ID_F6,false))
|
||||
{
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->go_next_device();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->go_next_device();
|
||||
m_running = true;
|
||||
}
|
||||
if(ImGui::IsKeyPressed(ITEM_ID_F7,false))
|
||||
{
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->go_interrupt();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->go_interrupt();
|
||||
m_running = true;
|
||||
}
|
||||
if(ImGui::IsKeyPressed(ITEM_ID_F8,false))
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->go_vblank();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->go_vblank();
|
||||
if(ImGui::IsKeyPressed(ITEM_ID_F9,false))
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step_out();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step_out();
|
||||
if(ImGui::IsKeyPressed(ITEM_ID_F10,false))
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step_over();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step_over();
|
||||
if(ImGui::IsKeyPressed(ITEM_ID_F11,false))
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step();
|
||||
if(ImGui::IsKeyPressed(ITEM_ID_F12,false))
|
||||
{
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->go();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->go();
|
||||
m_hide = true;
|
||||
}
|
||||
|
||||
@ -425,11 +425,11 @@ void debug_imgui::handle_console(running_machine* machine)
|
||||
// if console input is empty, then do a single step
|
||||
if(strlen(view_main_console->console_input) == 0)
|
||||
{
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step();
|
||||
view_main_console->exec_cmd = false;
|
||||
return;
|
||||
}
|
||||
debug_console_execute_command(*m_machine, view_main_console->console_input, 1);
|
||||
m_machine->debugger().console().execute_command(view_main_console->console_input, true);
|
||||
// check for commands that start execution (so that input fields can be disabled)
|
||||
if(strcmp(view_main_console->console_input,"g") == 0)
|
||||
m_running = true;
|
||||
@ -501,7 +501,7 @@ void debug_imgui::draw_view(debug_area* view_ptr, bool exp_change)
|
||||
if(view_ptr->type != DVT_MEMORY) // no scroll bars in memory views
|
||||
ImGui::SetScrollY(view_ptr->view->visible_position().y * fsize.y);
|
||||
}
|
||||
|
||||
|
||||
// update view location, while the cursor is at 0,0.
|
||||
view_ptr->ofs_x = ImGui::GetCursorScreenPos().x;
|
||||
view_ptr->ofs_y = ImGui::GetCursorScreenPos().y;
|
||||
@ -526,7 +526,7 @@ void debug_imgui::draw_view(debug_area* view_ptr, bool exp_change)
|
||||
pos.y = ImGui::GetScrollY() / fsize.y;
|
||||
view_ptr->view->set_visible_position(pos);
|
||||
}
|
||||
|
||||
|
||||
viewdata = view_ptr->view->viewdata();
|
||||
|
||||
xy1.x = view_ptr->ofs_x;
|
||||
@ -866,33 +866,33 @@ void debug_imgui::draw_console()
|
||||
ImGui::Separator();
|
||||
if(ImGui::MenuItem("Run", "F5"))
|
||||
{
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->go();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->go();
|
||||
m_running = true;
|
||||
}
|
||||
if(ImGui::MenuItem("Go to next CPU", "F6"))
|
||||
{
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->go_next_device();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->go_next_device();
|
||||
m_running = true;
|
||||
}
|
||||
if(ImGui::MenuItem("Run until next interrupt", "F7"))
|
||||
{
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->go_interrupt();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->go_interrupt();
|
||||
m_running = true;
|
||||
}
|
||||
if(ImGui::MenuItem("Run until VBLANK", "F8"))
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->go_vblank();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->go_vblank();
|
||||
if(ImGui::MenuItem("Run and hide debugger", "F12"))
|
||||
{
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->go();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->go();
|
||||
m_hide = true;
|
||||
}
|
||||
ImGui::Separator();
|
||||
if(ImGui::MenuItem("Single step", "F11"))
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step();
|
||||
if(ImGui::MenuItem("Step over", "F10"))
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step_over();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step_over();
|
||||
if(ImGui::MenuItem("Step out", "F9"))
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step_out();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step_out();
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
@ -1108,7 +1108,7 @@ void debug_imgui::wait_for_debugger(device_t &device, bool firststop)
|
||||
|
||||
void debug_imgui::debugger_update()
|
||||
{
|
||||
if ((m_machine != nullptr) && (!debug_cpu_is_stopped(*m_machine)) && (m_machine->phase() == MACHINE_PHASE_RUNNING) && !m_hide)
|
||||
if ((m_machine != nullptr) && (!m_machine->debugger().cpu().is_stopped()) && (m_machine->phase() == MACHINE_PHASE_RUNNING) && !m_hide)
|
||||
{
|
||||
UINT32 width = m_machine->render().ui_target().width();
|
||||
UINT32 height = m_machine->render().ui_target().height();
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "debugger.h"
|
||||
#include "debug/debugcpu.h"
|
||||
|
||||
#include "window.h"
|
||||
#include "../input/input_common.h"
|
||||
@ -153,14 +154,14 @@ void debugger_windows::wait_for_debugger(device_t &device, bool firststop)
|
||||
void debugger_windows::debugger_update()
|
||||
{
|
||||
// if we're running live, do some checks
|
||||
if (!winwindow_has_focus() && m_machine && !debug_cpu_is_stopped(*m_machine) && (m_machine->phase() == MACHINE_PHASE_RUNNING))
|
||||
if (!winwindow_has_focus() && m_machine && !m_machine->debugger().cpu().is_stopped() && (m_machine->phase() == MACHINE_PHASE_RUNNING))
|
||||
{
|
||||
// see if the interrupt key is pressed and break if it is
|
||||
if (seq_pressed())
|
||||
{
|
||||
HWND const focuswnd = GetFocus();
|
||||
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->halt_on_next_instruction("User-initiated break\n");
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->halt_on_next_instruction("User-initiated break\n");
|
||||
|
||||
// if we were focused on some window's edit box, reset it to default
|
||||
for (debugwin_info &info : m_window_list)
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "modules/osdmodule.h"
|
||||
|
||||
#include "debug/debugcpu.h"
|
||||
#include "debugger.h"
|
||||
|
||||
class debug_none : public osd_module, public debug_module
|
||||
{
|
||||
@ -40,7 +41,7 @@ void debug_none::init_debugger(running_machine &machine)
|
||||
|
||||
void debug_none::wait_for_debugger(device_t &device, bool firststop)
|
||||
{
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->go();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->go();
|
||||
}
|
||||
|
||||
void debug_none::debugger_update()
|
||||
|
@ -20,6 +20,7 @@
|
||||
#import "pointsviewer.h"
|
||||
#import "registersview.h"
|
||||
|
||||
#include "debugger.h"
|
||||
#include "debug/debugcon.h"
|
||||
#include "debug/debugcpu.h"
|
||||
|
||||
@ -213,12 +214,12 @@
|
||||
NSString *command = [sender stringValue];
|
||||
if ([command length] == 0)
|
||||
{
|
||||
debug_cpu_get_visible_cpu(*machine)->debug()->single_step();
|
||||
machine->debugger().cpu().get_visible_cpu()->debug()->single_step();
|
||||
[history reset];
|
||||
}
|
||||
else
|
||||
{
|
||||
debug_console_execute_command(*machine, [command UTF8String], 1);
|
||||
machine->debugger().console().execute_command([command UTF8String], 1);
|
||||
[history add:command];
|
||||
[history edit];
|
||||
}
|
||||
@ -228,7 +229,7 @@
|
||||
|
||||
- (IBAction)debugToggleBreakpoint:(id)sender {
|
||||
device_t &device = *[dasmView source]->device();
|
||||
if ([dasmView cursorVisible] && (debug_cpu_get_visible_cpu(*machine) == &device))
|
||||
if ([dasmView cursorVisible] && (machine->debugger().cpu().get_visible_cpu() == &device))
|
||||
{
|
||||
offs_t const address = [dasmView selectedAddress];
|
||||
device_debug::breakpoint *bp = [[self class] findBreakpointAtAddress:address
|
||||
@ -240,14 +241,14 @@
|
||||
command = [NSString stringWithFormat:@"bpset 0x%lX", (unsigned long)address];
|
||||
else
|
||||
command = [NSString stringWithFormat:@"bpclear 0x%X", (unsigned)bp->index()];
|
||||
debug_console_execute_command(*machine, [command UTF8String], 1);
|
||||
machine->debugger().console().execute_command([command UTF8String], 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (IBAction)debugToggleBreakpointEnable:(id)sender {
|
||||
device_t &device = *[dasmView source]->device();
|
||||
if ([dasmView cursorVisible] && (debug_cpu_get_visible_cpu(*machine) == &device))
|
||||
if ([dasmView cursorVisible] && (machine->debugger().cpu().get_visible_cpu() == &device))
|
||||
{
|
||||
device_debug::breakpoint *bp = [[self class] findBreakpointAtAddress:[dasmView selectedAddress]
|
||||
forDevice:device];
|
||||
@ -258,7 +259,7 @@
|
||||
command = [NSString stringWithFormat:@"bpdisable 0x%X", (unsigned)bp->index()];
|
||||
else
|
||||
command = [NSString stringWithFormat:@"bpenable 0x%X", (unsigned)bp->index()];
|
||||
debug_console_execute_command(*machine, [command UTF8String], 1);
|
||||
machine->debugger().console().execute_command([command UTF8String], 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -266,10 +267,10 @@
|
||||
|
||||
- (IBAction)debugRunToCursor:(id)sender {
|
||||
device_t &device = *[dasmView source]->device();
|
||||
if ([dasmView cursorVisible] && (debug_cpu_get_visible_cpu(*machine) == &device))
|
||||
if ([dasmView cursorVisible] && (machine->debugger().cpu().get_visible_cpu() == &device))
|
||||
{
|
||||
NSString *command = [NSString stringWithFormat:@"go 0x%lX", (unsigned long)[dasmView selectedAddress]];
|
||||
debug_console_execute_command(*machine, [command UTF8String], 1);
|
||||
machine->debugger().console().execute_command([command UTF8String], 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -418,7 +419,7 @@
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MAMEHideDebuggerNotification
|
||||
object:self
|
||||
userInfo:info];
|
||||
debug_cpu_get_visible_cpu(*machine)->debug()->go();
|
||||
machine->debugger().cpu().get_visible_cpu()->debug()->go();
|
||||
}
|
||||
}
|
||||
|
||||
@ -481,7 +482,7 @@
|
||||
SEL const action = [item action];
|
||||
BOOL const inContextMenu = ([item menu] == [dasmView menu]);
|
||||
BOOL const haveCursor = [dasmView cursorVisible];
|
||||
BOOL const isCurrent = (debug_cpu_get_visible_cpu(*machine) == [dasmView source]->device());
|
||||
BOOL const isCurrent = (machine->debugger().cpu().get_visible_cpu() == [dasmView source]->device());
|
||||
|
||||
device_debug::breakpoint *breakpoint = nullptr;
|
||||
if (haveCursor)
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#import "debugview.h"
|
||||
|
||||
#include "debugger.h"
|
||||
#include "debug/debugcpu.h"
|
||||
|
||||
#include "modules/lib/osdobj_common.h"
|
||||
@ -810,7 +811,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate)
|
||||
|
||||
|
||||
- (void)insertNewline:(id)sender {
|
||||
debug_cpu_get_visible_cpu(*machine)->debug()->single_step();
|
||||
machine->debugger().cpu().get_visible_cpu()->debug()->single_step();
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
#import "debugcommandhistory.h"
|
||||
#import "debugview.h"
|
||||
|
||||
#include "debugger.h"
|
||||
|
||||
//============================================================
|
||||
// NOTIFICATIONS
|
||||
@ -187,12 +188,12 @@ NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification = @"MAMEAuxiliaryD
|
||||
|
||||
- (IBAction)debugBreak:(id)sender {
|
||||
if (machine->debug_flags & DEBUG_FLAG_ENABLED)
|
||||
debug_cpu_get_visible_cpu(*machine)->debug()->halt_on_next_instruction("User-initiated break\n");
|
||||
machine->debugger().cpu().get_visible_cpu()->debug()->halt_on_next_instruction("User-initiated break\n");
|
||||
}
|
||||
|
||||
|
||||
- (IBAction)debugRun:(id)sender {
|
||||
debug_cpu_get_visible_cpu(*machine)->debug()->go();
|
||||
machine->debugger().cpu().get_visible_cpu()->debug()->go();
|
||||
}
|
||||
|
||||
|
||||
@ -201,43 +202,43 @@ NSString *const MAMEAuxiliaryDebugWindowWillCloseNotification = @"MAMEAuxiliaryD
|
||||
object:self
|
||||
userInfo:[NSDictionary dictionaryWithObject:[NSValue valueWithPointer:machine]
|
||||
forKey:@"MAMEDebugMachine"]];
|
||||
debug_cpu_get_visible_cpu(*machine)->debug()->go();
|
||||
machine->debugger().cpu().get_visible_cpu()->debug()->go();
|
||||
}
|
||||
|
||||
|
||||
- (IBAction)debugRunToNextCPU:(id)sender {
|
||||
debug_cpu_get_visible_cpu(*machine)->debug()->go_next_device();
|
||||
machine->debugger().cpu().get_visible_cpu()->debug()->go_next_device();
|
||||
}
|
||||
|
||||
|
||||
- (IBAction)debugRunToNextInterrupt:(id)sender {
|
||||
debug_cpu_get_visible_cpu(*machine)->debug()->go_interrupt();
|
||||
machine->debugger().cpu().get_visible_cpu()->debug()->go_interrupt();
|
||||
}
|
||||
|
||||
|
||||
- (IBAction)debugRunToNextVBLANK:(id)sender {
|
||||
debug_cpu_get_visible_cpu(*machine)->debug()->go_vblank();
|
||||
machine->debugger().cpu().get_visible_cpu()->debug()->go_vblank();
|
||||
}
|
||||
|
||||
|
||||
- (IBAction)debugStepInto:(id)sender {
|
||||
debug_cpu_get_visible_cpu(*machine)->debug()->single_step();
|
||||
machine->debugger().cpu().get_visible_cpu()->debug()->single_step();
|
||||
}
|
||||
|
||||
|
||||
- (IBAction)debugStepOver:(id)sender {
|
||||
debug_cpu_get_visible_cpu(*machine)->debug()->single_step_over();
|
||||
machine->debugger().cpu().get_visible_cpu()->debug()->single_step_over();
|
||||
}
|
||||
|
||||
|
||||
- (IBAction)debugStepOut:(id)sender {
|
||||
debug_cpu_get_visible_cpu(*machine)->debug()->single_step_out();
|
||||
machine->debugger().cpu().get_visible_cpu()->debug()->single_step_out();
|
||||
}
|
||||
|
||||
|
||||
- (IBAction)debugSoftReset:(id)sender {
|
||||
machine->schedule_soft_reset();
|
||||
debug_cpu_get_visible_cpu(*machine)->debug()->go();
|
||||
machine->debugger().cpu().get_visible_cpu()->debug()->go();
|
||||
}
|
||||
|
||||
|
||||
|
@ -105,7 +105,7 @@
|
||||
[actionButton release];
|
||||
|
||||
// set default state
|
||||
[dasmView selectSubviewForDevice:debug_cpu_get_visible_cpu(*machine)];
|
||||
[dasmView selectSubviewForDevice:machine->debugger().cpu().get_visible_cpu()];
|
||||
[dasmView setExpression:@"curpc"];
|
||||
[expressionField setStringValue:@"curpc"];
|
||||
[expressionField selectText:self];
|
||||
@ -178,13 +178,13 @@
|
||||
if (bp == nullptr)
|
||||
{
|
||||
UINT32 const bpnum = device.debug()->breakpoint_set(address, nullptr, nullptr);
|
||||
debug_console_printf(*machine, "Breakpoint %X set\n", bpnum);
|
||||
machine->debugger().console().printf("Breakpoint %X set\n", bpnum);
|
||||
}
|
||||
else
|
||||
{
|
||||
int const bpnum = bp->index();
|
||||
device.debug()->breakpoint_clear(bpnum);
|
||||
debug_console_printf(*machine, "Breakpoint %X cleared\n", (UINT32)bpnum);
|
||||
machine->debugger().console().printf("Breakpoint %X cleared\n", (UINT32)bpnum);
|
||||
}
|
||||
|
||||
// fail to do this and the display doesn't update
|
||||
@ -203,10 +203,9 @@
|
||||
if (bp != nullptr)
|
||||
{
|
||||
device.debug()->breakpoint_enable(bp->index(), !bp->enabled());
|
||||
debug_console_printf(*machine,
|
||||
"Breakpoint %X %s\n",
|
||||
(UINT32)bp->index(),
|
||||
bp->enabled() ? "enabled" : "disabled");
|
||||
machine->debugger().console().printf("Breakpoint %X %s\n",
|
||||
(UINT32)bp->index(),
|
||||
bp->enabled() ? "enabled" : "disabled");
|
||||
machine->debug_view().update_all();
|
||||
machine->debugger().refresh_display();
|
||||
}
|
||||
|
@ -12,6 +12,7 @@
|
||||
#import "debugview.h"
|
||||
#import "memoryview.h"
|
||||
|
||||
#include "debugger.h"
|
||||
#include "debug/debugcpu.h"
|
||||
#include "debug/dvmemory.h"
|
||||
|
||||
@ -103,7 +104,7 @@
|
||||
[actionButton release];
|
||||
|
||||
// set default state
|
||||
[memoryView selectSubviewForDevice:debug_cpu_get_visible_cpu(*machine)];
|
||||
[memoryView selectSubviewForDevice:machine->debugger().cpu().get_visible_cpu()];
|
||||
[memoryView setExpression:@"0"];
|
||||
[expressionField setStringValue:@"0"];
|
||||
[expressionField selectText:self];
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#import "registersview.h"
|
||||
|
||||
#include "debugger.h"
|
||||
#include "debug/debugcpu.h"
|
||||
#include "debug/debugvw.h"
|
||||
|
||||
@ -28,7 +29,7 @@
|
||||
|
||||
- (NSSize)maximumFrameSize {
|
||||
debug_view_xy max;
|
||||
device_t *curcpu = debug_cpu_get_visible_cpu(*machine);
|
||||
device_t *curcpu = machine->debugger().cpu().get_visible_cpu();
|
||||
const debug_view_source *source = view->source_for_device(curcpu);
|
||||
|
||||
max.x = max.y = 0;
|
||||
|
@ -158,12 +158,12 @@ void DasmWindow::toggleBreakpointAtCursor(bool changedTo)
|
||||
if (bpindex == -1)
|
||||
{
|
||||
bpindex = cpuinfo->breakpoint_set(address, nullptr, nullptr);
|
||||
debug_console_printf(*m_machine, "Breakpoint %X set\n", bpindex);
|
||||
m_machine->debugger().console().printf("Breakpoint %X set\n", bpindex);
|
||||
}
|
||||
else
|
||||
{
|
||||
cpuinfo->breakpoint_clear(bpindex);
|
||||
debug_console_printf(*m_machine, "Breakpoint %X cleared\n", bpindex);
|
||||
m_machine->debugger().console().printf("Breakpoint %X cleared\n", bpindex);
|
||||
}
|
||||
m_machine->debug_view().update_all();
|
||||
m_machine->debugger().refresh_display();
|
||||
@ -189,7 +189,7 @@ void DasmWindow::enableBreakpointAtCursor(bool changedTo)
|
||||
if (bp != nullptr)
|
||||
{
|
||||
cpuinfo->breakpoint_enable(bp->index(), !bp->enabled());
|
||||
debug_console_printf(*m_machine, "Breakpoint %X %s\n", (UINT32)bp->index(), bp->enabled() ? "enabled" : "disabled");
|
||||
m_machine->debugger().console().printf("Breakpoint %X %s\n", (UINT32)bp->index(), bp->enabled() ? "enabled" : "disabled");
|
||||
m_machine->debug_view().update_all();
|
||||
m_machine->debugger().refresh_display();
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ bool MainWindow::eventFilter(QObject* obj, QEvent* event)
|
||||
void MainWindow::toggleBreakpointAtCursor(bool changedTo)
|
||||
{
|
||||
debug_view_disasm *const dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view());
|
||||
if (dasmView->cursor_visible() && (debug_cpu_get_visible_cpu(*m_machine) == dasmView->source()->device()))
|
||||
if (dasmView->cursor_visible() && (m_machine->debugger().cpu().get_visible_cpu() == dasmView->source()->device()))
|
||||
{
|
||||
offs_t const address = downcast<debug_view_disasm *>(dasmView)->selected_address();
|
||||
device_debug *const cpuinfo = dasmView->source()->device()->debug();
|
||||
@ -241,7 +241,7 @@ void MainWindow::toggleBreakpointAtCursor(bool changedTo)
|
||||
{
|
||||
command = string_format("bpclear 0x%X", bpindex);
|
||||
}
|
||||
debug_console_execute_command(*m_machine, command.c_str(), 1);
|
||||
m_machine->debugger().console().execute_command(command.c_str(), true);
|
||||
}
|
||||
|
||||
refreshAll();
|
||||
@ -251,7 +251,7 @@ void MainWindow::toggleBreakpointAtCursor(bool changedTo)
|
||||
void MainWindow::enableBreakpointAtCursor(bool changedTo)
|
||||
{
|
||||
debug_view_disasm *const dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view());
|
||||
if (dasmView->cursor_visible() && (debug_cpu_get_visible_cpu(*m_machine) == dasmView->source()->device()))
|
||||
if (dasmView->cursor_visible() && (m_machine->debugger().cpu().get_visible_cpu() == dasmView->source()->device()))
|
||||
{
|
||||
offs_t const address = dasmView->selected_address();
|
||||
device_debug *const cpuinfo = dasmView->source()->device()->debug();
|
||||
@ -265,7 +265,7 @@ void MainWindow::enableBreakpointAtCursor(bool changedTo)
|
||||
{
|
||||
INT32 const bpindex = bp->index();
|
||||
std::string command = string_format(bp->enabled() ? "bpdisable 0x%X" : "bpenable 0x%X", bpindex);
|
||||
debug_console_execute_command(*m_machine, command.c_str(), 1);
|
||||
m_machine->debugger().console().execute_command(command.c_str(), true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -276,11 +276,11 @@ void MainWindow::enableBreakpointAtCursor(bool changedTo)
|
||||
void MainWindow::runToCursor(bool changedTo)
|
||||
{
|
||||
debug_view_disasm* dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view());
|
||||
if (dasmView->cursor_visible() && (debug_cpu_get_visible_cpu(*m_machine) == dasmView->source()->device()))
|
||||
if (dasmView->cursor_visible() && (m_machine->debugger().cpu().get_visible_cpu() == dasmView->source()->device()))
|
||||
{
|
||||
offs_t address = downcast<debug_view_disasm*>(dasmView)->selected_address();
|
||||
std::string command = string_format("go 0x%X", address);
|
||||
debug_console_execute_command(*m_machine, command.c_str(), 1);
|
||||
m_machine->debugger().console().execute_command(command.c_str(), true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -315,14 +315,12 @@ void MainWindow::executeCommand(bool withClear)
|
||||
// A blank command is a "silent step"
|
||||
if (command == "")
|
||||
{
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step();
|
||||
return;
|
||||
}
|
||||
|
||||
// Send along the command
|
||||
debug_console_execute_command(*m_machine,
|
||||
command.toLocal8Bit().data(),
|
||||
true);
|
||||
m_machine->debugger().console().execute_command(command.toLocal8Bit().data(), true);
|
||||
|
||||
// Add history & set the index to be the top of the stack
|
||||
addToHistory(command);
|
||||
@ -348,7 +346,7 @@ void MainWindow::mountImage(bool changedTo)
|
||||
device_image_interface *img = iter.byindex(imageIndex);
|
||||
if (img == nullptr)
|
||||
{
|
||||
debug_console_printf(*m_machine, "Something is wrong with the mount menu.\n");
|
||||
m_machine->debugger().console().printf("Something is wrong with the mount menu.\n");
|
||||
refreshAll();
|
||||
return;
|
||||
}
|
||||
@ -361,7 +359,7 @@ void MainWindow::mountImage(bool changedTo)
|
||||
|
||||
if (img->load(filename.toUtf8().data()) != IMAGE_INIT_PASS)
|
||||
{
|
||||
debug_console_printf(*m_machine, "Image could not be mounted.\n");
|
||||
m_machine->debugger().console().printf("Image could not be mounted.\n");
|
||||
refreshAll();
|
||||
return;
|
||||
}
|
||||
@ -377,7 +375,7 @@ void MainWindow::mountImage(bool changedTo)
|
||||
const QString newTitle = baseString + QString(" : ") + QString(img->filename());
|
||||
parentMenuItem->setTitle(newTitle);
|
||||
|
||||
debug_console_printf(*m_machine, "Image %s mounted successfully.\n", filename.toUtf8().data());
|
||||
m_machine->debugger().console().printf("Image %s mounted successfully.\n", filename.toUtf8().data());
|
||||
refreshAll();
|
||||
}
|
||||
|
||||
@ -401,7 +399,7 @@ void MainWindow::unmountImage(bool changedTo)
|
||||
const QString newTitle = baseString + QString(" : ") + QString("[empty slot]");
|
||||
parentMenuItem->setTitle(newTitle);
|
||||
|
||||
debug_console_printf(*m_machine, "Image successfully unmounted.\n");
|
||||
m_machine->debugger().console().printf("Image successfully unmounted.\n");
|
||||
refreshAll();
|
||||
}
|
||||
|
||||
@ -409,7 +407,7 @@ void MainWindow::unmountImage(bool changedTo)
|
||||
void MainWindow::dasmViewUpdated()
|
||||
{
|
||||
debug_view_disasm *const dasmView = downcast<debug_view_disasm*>(m_dasmFrame->view()->view());
|
||||
bool const haveCursor = dasmView->cursor_visible() && (debug_cpu_get_visible_cpu(*m_machine) == dasmView->source()->device());
|
||||
bool const haveCursor = dasmView->cursor_visible() && (m_machine->debugger().cpu().get_visible_cpu() == dasmView->source()->device());
|
||||
bool haveBreakpoint = false;
|
||||
bool breakpointEnabled = false;
|
||||
if (haveCursor)
|
||||
|
@ -291,7 +291,7 @@ void MemoryWindow::populateComboBox()
|
||||
|
||||
void MemoryWindow::setToCurrentCpu()
|
||||
{
|
||||
device_t* curCpu = debug_cpu_get_visible_cpu(*m_machine);
|
||||
device_t* curCpu = m_machine->debugger().cpu().get_visible_cpu();
|
||||
const debug_view_source *source = m_memTable->view()->source_for_device(curCpu);
|
||||
const int listIndex = m_memTable->view()->source_list().indexof(*source);
|
||||
m_memoryComboBox->setCurrentIndex(listIndex);
|
||||
@ -346,7 +346,7 @@ void DebuggerMemView::mousePressEvent(QMouseEvent* event)
|
||||
const debug_view_memory_source* source = downcast<const debug_view_memory_source*>(memView->source());
|
||||
address_space* addressSpace = source->space();
|
||||
const int nativeDataWidth = addressSpace->data_width() / 8;
|
||||
const UINT64 memValue = debug_read_memory(*addressSpace,
|
||||
const UINT64 memValue = source->device()->machine().debugger().cpu().read_memory(*addressSpace,
|
||||
addressSpace->address_to_byte(address),
|
||||
nativeDataWidth,
|
||||
true);
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include "breakpointswindow.h"
|
||||
#include "deviceswindow.h"
|
||||
|
||||
#include "debug/debugcpu.h"
|
||||
|
||||
bool WindowQt::s_refreshAll = false;
|
||||
bool WindowQt::s_hideAll = false;
|
||||
|
||||
@ -176,49 +178,49 @@ void WindowQt::debugActOpenDevices()
|
||||
|
||||
void WindowQt::debugActRun()
|
||||
{
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->go();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->go();
|
||||
}
|
||||
|
||||
void WindowQt::debugActRunAndHide()
|
||||
{
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->go();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->go();
|
||||
hideAll();
|
||||
}
|
||||
|
||||
void WindowQt::debugActRunToNextCpu()
|
||||
{
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->go_next_device();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->go_next_device();
|
||||
}
|
||||
|
||||
void WindowQt::debugActRunNextInt()
|
||||
{
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->go_interrupt();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->go_interrupt();
|
||||
}
|
||||
|
||||
void WindowQt::debugActRunNextVBlank()
|
||||
{
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->go_vblank();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->go_vblank();
|
||||
}
|
||||
|
||||
void WindowQt::debugActStepInto()
|
||||
{
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step();
|
||||
}
|
||||
|
||||
void WindowQt::debugActStepOver()
|
||||
{
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step_over();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step_over();
|
||||
}
|
||||
|
||||
void WindowQt::debugActStepOut()
|
||||
{
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step_out();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step_out();
|
||||
}
|
||||
|
||||
void WindowQt::debugActSoftReset()
|
||||
{
|
||||
m_machine->schedule_soft_reset();
|
||||
debug_cpu_get_visible_cpu(*m_machine)->debug()->single_step();
|
||||
m_machine->debugger().cpu().get_visible_cpu()->debug()->single_step();
|
||||
}
|
||||
|
||||
void WindowQt::debugActHardReset()
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "debugviewinfo.h"
|
||||
#include "uimetrics.h"
|
||||
|
||||
#include "debugger.h"
|
||||
#include "debug/debugcon.h"
|
||||
#include "debug/debugcpu.h"
|
||||
#include "imagedev/cassette.h"
|
||||
@ -77,7 +78,7 @@ consolewin_info::consolewin_info(debugger_windows_interface &debugger) :
|
||||
}
|
||||
|
||||
// recompute the children
|
||||
set_cpu(*debug_cpu_get_visible_cpu(machine()));
|
||||
set_cpu(*machine().debugger().cpu().get_visible_cpu());
|
||||
|
||||
// mark the edit box as the default focus and set it
|
||||
editwin_info::set_default_focus();
|
||||
@ -298,9 +299,9 @@ bool consolewin_info::handle_command(WPARAM wparam, LPARAM lparam)
|
||||
void consolewin_info::process_string(char const *string)
|
||||
{
|
||||
if (string[0] == 0) // an empty string is a single step
|
||||
debug_cpu_get_visible_cpu(machine())->debug()->single_step();
|
||||
machine().debugger().cpu().get_visible_cpu()->debug()->single_step();
|
||||
else // otherwise, just process the command
|
||||
debug_console_execute_command(machine(), string, 1);
|
||||
machine().debugger().console().execute_command(string, true);
|
||||
|
||||
// clear the edit text box
|
||||
set_editwnd_text("");
|
||||
|
@ -206,7 +206,7 @@ bool debugview_info::source_is_visible_cpu() const
|
||||
if (m_view != nullptr)
|
||||
{
|
||||
const debug_view_source *const source = m_view->source();
|
||||
return (source != nullptr) && (debug_cpu_get_visible_cpu(machine()) == source->device());
|
||||
return (source != nullptr) && (machine().debugger().cpu().get_visible_cpu() == source->device());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -244,7 +244,7 @@ bool debugview_info::set_source_for_device(device_t &device)
|
||||
|
||||
bool debugview_info::set_source_for_visible_cpu()
|
||||
{
|
||||
device_t *const curcpu = debug_cpu_get_visible_cpu(machine());
|
||||
device_t *const curcpu = machine().debugger().cpu().get_visible_cpu();
|
||||
if (curcpu != nullptr)
|
||||
return set_source_for_device(*curcpu);
|
||||
else
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "debugviewinfo.h"
|
||||
|
||||
#include "debugger.h"
|
||||
#include "debug/debugcpu.h"
|
||||
#include "window.h"
|
||||
#include "winutf8.h"
|
||||
@ -296,31 +297,31 @@ bool debugwin_info::handle_command(WPARAM wparam, LPARAM lparam)
|
||||
case ID_RUN_AND_HIDE:
|
||||
debugger().hide_all();
|
||||
case ID_RUN:
|
||||
debug_cpu_get_visible_cpu(machine())->debug()->go();
|
||||
machine().debugger().cpu().get_visible_cpu()->debug()->go();
|
||||
return true;
|
||||
|
||||
case ID_NEXT_CPU:
|
||||
debug_cpu_get_visible_cpu(machine())->debug()->go_next_device();
|
||||
machine().debugger().cpu().get_visible_cpu()->debug()->go_next_device();
|
||||
return true;
|
||||
|
||||
case ID_RUN_VBLANK:
|
||||
debug_cpu_get_visible_cpu(machine())->debug()->go_vblank();
|
||||
machine().debugger().cpu().get_visible_cpu()->debug()->go_vblank();
|
||||
return true;
|
||||
|
||||
case ID_RUN_IRQ:
|
||||
debug_cpu_get_visible_cpu(machine())->debug()->go_interrupt();
|
||||
machine().debugger().cpu().get_visible_cpu()->debug()->go_interrupt();
|
||||
return true;
|
||||
|
||||
case ID_STEP:
|
||||
debug_cpu_get_visible_cpu(machine())->debug()->single_step();
|
||||
machine().debugger().cpu().get_visible_cpu()->debug()->single_step();
|
||||
return true;
|
||||
|
||||
case ID_STEP_OVER:
|
||||
debug_cpu_get_visible_cpu(machine())->debug()->single_step_over();
|
||||
machine().debugger().cpu().get_visible_cpu()->debug()->single_step_over();
|
||||
return true;
|
||||
|
||||
case ID_STEP_OUT:
|
||||
debug_cpu_get_visible_cpu(machine())->debug()->single_step_out();
|
||||
machine().debugger().cpu().get_visible_cpu()->debug()->single_step_out();
|
||||
return true;
|
||||
|
||||
case ID_HARD_RESET:
|
||||
@ -329,7 +330,7 @@ bool debugwin_info::handle_command(WPARAM wparam, LPARAM lparam)
|
||||
|
||||
case ID_SOFT_RESET:
|
||||
machine().schedule_soft_reset();
|
||||
debug_cpu_get_visible_cpu(machine())->debug()->go();
|
||||
machine().debugger().cpu().get_visible_cpu()->debug()->go();
|
||||
return true;
|
||||
|
||||
case ID_EXIT:
|
||||
@ -488,7 +489,7 @@ LRESULT debugwin_info::window_proc(UINT message, WPARAM wparam, LPARAM lparam)
|
||||
if (m_is_main_console)
|
||||
{
|
||||
debugger().hide_all();
|
||||
debug_cpu_get_visible_cpu(machine())->debug()->go();
|
||||
machine().debugger().cpu().get_visible_cpu()->debug()->go();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -183,12 +183,12 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam)
|
||||
if (bpindex == -1)
|
||||
{
|
||||
bpindex = debug->breakpoint_set(address, nullptr, nullptr);
|
||||
debug_console_printf(machine(), "Breakpoint %X set\n", bpindex);
|
||||
machine().debugger().console().printf("Breakpoint %X set\n", bpindex);
|
||||
}
|
||||
else
|
||||
{
|
||||
debug->breakpoint_clear(bpindex);
|
||||
debug_console_printf(machine(), "Breakpoint %X cleared\n", bpindex);
|
||||
machine().debugger().console().printf("Breakpoint %X cleared\n", bpindex);
|
||||
}
|
||||
machine().debug_view().update_all();
|
||||
machine().debugger().refresh_display();
|
||||
@ -200,7 +200,7 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam)
|
||||
command = string_format("bpset 0x%X", address);
|
||||
else
|
||||
command = string_format("bpclear 0x%X", bpindex);
|
||||
debug_console_execute_command(machine(), command.c_str(), 1);
|
||||
machine().debugger().console().execute_command(command.c_str(), true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -222,7 +222,7 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam)
|
||||
if (!is_main_console())
|
||||
{
|
||||
debug->breakpoint_enable(bp->index(), !bp->enabled());
|
||||
debug_console_printf(machine(), "Breakpoint %X %s\n", (UINT32)bp->index(), bp->enabled() ? "enabled" : "disabled");
|
||||
machine().debugger().console().printf("Breakpoint %X %s\n", (UINT32)bp->index(), bp->enabled() ? "enabled" : "disabled");
|
||||
machine().debug_view().update_all();
|
||||
machine().debugger().refresh_display();
|
||||
}
|
||||
@ -230,7 +230,7 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
std::string command;
|
||||
command = string_format(bp->enabled() ? "bpdisable 0x%X" : "bpenable 0x%X", (UINT32)bp->index());
|
||||
debug_console_execute_command(machine(), command.c_str(), 1);
|
||||
machine().debugger().console().execute_command(command.c_str(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -244,7 +244,7 @@ bool disasmbasewin_info::handle_command(WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
std::string command;
|
||||
command = string_format("go 0x%X", address);
|
||||
debug_console_execute_command(machine(), command.c_str(), 1);
|
||||
machine().debugger().console().execute_command(command.c_str(), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -150,6 +150,7 @@ private:
|
||||
virtual void osd_exit() override;
|
||||
|
||||
void extract_video_config();
|
||||
void output_oslog(const char *buffer);
|
||||
|
||||
sdl_options &m_options;
|
||||
};
|
||||
|
@ -8,6 +8,8 @@
|
||||
//
|
||||
//============================================================
|
||||
|
||||
// only for oslog callback
|
||||
#include <functional>
|
||||
|
||||
#ifdef SDLMAME_UNIX
|
||||
#if (!defined(SDLMAME_MACOSX)) && (!defined(SDLMAME_EMSCRIPTEN)) && (!defined(SDLMAME_ANDROID))
|
||||
@ -224,19 +226,6 @@ int main(int argc, char *argv[])
|
||||
exit(res);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//============================================================
|
||||
// output_oslog
|
||||
//============================================================
|
||||
|
||||
static void output_oslog(const running_machine &machine, const char *buffer)
|
||||
{
|
||||
fputs(buffer, stderr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//============================================================
|
||||
// constructor
|
||||
//============================================================
|
||||
@ -390,11 +379,21 @@ void sdl_osd_interface::video_register()
|
||||
//video_options_add("auto", nullptr); // making d3d video default one
|
||||
}
|
||||
|
||||
|
||||
//============================================================
|
||||
// output_oslog
|
||||
//============================================================
|
||||
|
||||
void sdl_osd_interface::output_oslog(const char *buffer)
|
||||
{
|
||||
fputs(buffer, stderr);
|
||||
}
|
||||
|
||||
|
||||
//============================================================
|
||||
// init
|
||||
//============================================================
|
||||
|
||||
|
||||
void sdl_osd_interface::init(running_machine &machine)
|
||||
{
|
||||
// call our parent
|
||||
@ -491,7 +490,10 @@ void sdl_osd_interface::init(running_machine &machine)
|
||||
osd_common_t::init_subsystems();
|
||||
|
||||
if (options().oslog())
|
||||
machine.add_logerror_callback(output_oslog);
|
||||
{
|
||||
using namespace std::placeholders;
|
||||
machine.add_logerror_callback(std::bind(&sdl_osd_interface::output_oslog, this, _1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -6,6 +6,9 @@
|
||||
//
|
||||
//============================================================
|
||||
|
||||
// only for oslog callback
|
||||
#include <functional>
|
||||
|
||||
// standard windows headers
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
@ -418,7 +421,7 @@ windows_options::windows_options()
|
||||
// output_oslog
|
||||
//============================================================
|
||||
|
||||
static void output_oslog(const running_machine &machine, const char *buffer)
|
||||
void windows_osd_interface::output_oslog(const char *buffer)
|
||||
{
|
||||
if (IsDebuggerPresent())
|
||||
win_output_debug_string_utf8(buffer);
|
||||
@ -523,7 +526,10 @@ void windows_osd_interface::init(running_machine &machine)
|
||||
|
||||
// hook up the debugger log
|
||||
if (options.oslog())
|
||||
machine.add_logerror_callback(output_oslog);
|
||||
{
|
||||
using namespace std::placeholders;
|
||||
machine.add_logerror_callback(std::bind(&windows_osd_interface::output_oslog, this, _1));
|
||||
}
|
||||
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
// crank up the multimedia timer resolution to its max
|
||||
|
@ -303,6 +303,7 @@ protected:
|
||||
|
||||
private:
|
||||
virtual void osd_exit() override;
|
||||
void output_oslog(const char *buffer);
|
||||
|
||||
windows_options & m_options;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user