emu/debug/debugcpu.cpp,sinclair/spectrum.cpp: Guarded pointer accessors

This commit is contained in:
Andrei Holub 2026-02-18 13:45:17 -05:00 committed by Andrei I. Holub
parent 18e3c764df
commit c71bbb1c10
2 changed files with 7 additions and 2 deletions

View File

@ -575,7 +575,7 @@ device_debug::device_debug(device_t &device)
} }
// Use own table for CPU and the global for others // Use own table for CPU and the global for others
symbol_table *symtable = m_symtable != nullptr ? m_symtable.get() : &device.machine().debugger().cpu().global_symtable(); symbol_table *symtable = &this->symtable();
// add all registers into it // add all registers into it
for (const auto &entry : m_state->state_entries()) for (const auto &entry : m_state->state_entries())
@ -623,6 +623,11 @@ device_debug::~device_debug()
exceptionpoint_clear_all(); exceptionpoint_clear_all();
} }
symbol_table &device_debug::symtable()
{
return m_symtable != nullptr ? *m_symtable : m_device.machine().debugger().cpu().global_symtable();
}
void device_debug::write_tracking(address_space &space, offs_t address, u64 data) void device_debug::write_tracking(address_space &space, offs_t address, u64 data)
{ {
dasm_memory_access const newAccess(space.spacenum(), address, data, m_state->pcbase()); dasm_memory_access const newAccess(space.spacenum(), address, data, m_state->pcbase());

View File

@ -41,7 +41,7 @@ public:
~device_debug(); ~device_debug();
// getters // getters
symbol_table &symtable() { return *m_symtable; } symbol_table &symtable();
// commonly-used pass-throughs // commonly-used pass-throughs
int logaddrchars() const { return (m_memory != nullptr && m_memory->has_space(AS_PROGRAM)) ? m_memory->space(AS_PROGRAM).logaddrchars() : 8; } int logaddrchars() const { return (m_memory != nullptr && m_memory->has_space(AS_PROGRAM)) ? m_memory->space(AS_PROGRAM).logaddrchars() : 8; }