mirror of
https://github.com/holub/mame
synced 2025-07-17 23:39:46 +03:00
Make debugger view startup more efficient - it's still not going to be practical with 200k save items, but it's better than before
This commit is contained in:
parent
a829064e83
commit
080d711ac5
@ -31,8 +31,8 @@
|
||||
// debug_view_source - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
debug_view_source::debug_view_source(const char *name, device_t *device)
|
||||
: m_name(name),
|
||||
debug_view_source::debug_view_source(std::string &&name, device_t *device)
|
||||
: m_name(std::move(name)),
|
||||
m_device(device)
|
||||
{
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ class debug_view_source
|
||||
|
||||
public:
|
||||
// construction/destruction
|
||||
debug_view_source(const char *name, device_t *device = nullptr);
|
||||
debug_view_source(std::string &&name, device_t *device = nullptr);
|
||||
virtual ~debug_view_source();
|
||||
|
||||
// getters
|
||||
|
@ -123,9 +123,10 @@ void debug_view_breakpoints::enumerate_sources()
|
||||
// iterate over devices with disassembly interfaces
|
||||
for (device_disasm_interface &dasm : disasm_interface_iterator(machine().root_device()))
|
||||
{
|
||||
std::string name;
|
||||
name = string_format("%s '%s'", dasm.device().name(), dasm.device().tag());
|
||||
m_source_list.emplace_back(std::make_unique<debug_view_source>(name.c_str(), &dasm.device()));
|
||||
m_source_list.emplace_back(
|
||||
std::make_unique<debug_view_source>(
|
||||
util::string_format("%s '%s'", dasm.device().name(), dasm.device().tag()),
|
||||
&dasm.device()));
|
||||
}
|
||||
|
||||
// reset the source to a known good entry
|
||||
|
@ -22,8 +22,8 @@
|
||||
// debug_view_disasm_source - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
debug_view_disasm_source::debug_view_disasm_source(const char *name, device_t &device)
|
||||
: debug_view_source(name, &device),
|
||||
debug_view_disasm_source::debug_view_disasm_source(std::string &&name, device_t &device)
|
||||
: debug_view_source(std::move(name), &device),
|
||||
m_space(device.memory().space(AS_PROGRAM)),
|
||||
m_decrypted_space(device.memory().has_space(AS_OPCODES) ? device.memory().space(AS_OPCODES) : device.memory().space(AS_PROGRAM))
|
||||
{
|
||||
@ -89,12 +89,15 @@ void debug_view_disasm::enumerate_sources()
|
||||
m_source_list.clear();
|
||||
|
||||
// iterate over devices with disassembly interfaces
|
||||
std::string name;
|
||||
for(device_disasm_interface &dasm : disasm_interface_iterator(machine().root_device()))
|
||||
for (device_disasm_interface &dasm : disasm_interface_iterator(machine().root_device()))
|
||||
{
|
||||
name = string_format("%s '%s'", dasm.device().name(), dasm.device().tag());
|
||||
if(dasm.device().memory().space_config(AS_PROGRAM)!=nullptr)
|
||||
m_source_list.emplace_back(std::make_unique<debug_view_disasm_source>(name.c_str(), dasm.device()));
|
||||
if (dasm.device().memory().space_config(AS_PROGRAM))
|
||||
{
|
||||
m_source_list.emplace_back(
|
||||
std::make_unique<debug_view_disasm_source>(
|
||||
util::string_format("%s '%s'", dasm.device().name(), dasm.device().tag()),
|
||||
dasm.device()));
|
||||
}
|
||||
}
|
||||
|
||||
// reset the source to a known good entry
|
||||
|
@ -45,7 +45,7 @@ class debug_view_disasm_source : public debug_view_source
|
||||
|
||||
public:
|
||||
// construction/destruction
|
||||
debug_view_disasm_source(const char *name, device_t &device);
|
||||
debug_view_disasm_source(std::string &&name, device_t &device);
|
||||
|
||||
// getters
|
||||
address_space &space() const { return m_space; }
|
||||
|
@ -49,39 +49,39 @@ const debug_view_memory::memory_view_pos debug_view_memory::s_memory_pos_table[1
|
||||
// debug_view_memory_source - constructors
|
||||
//-------------------------------------------------
|
||||
|
||||
debug_view_memory_source::debug_view_memory_source(const char *name, address_space &space)
|
||||
: debug_view_source(name, &space.device()),
|
||||
m_space(&space),
|
||||
m_memintf(dynamic_cast<device_memory_interface *>(&space.device())),
|
||||
m_base(nullptr),
|
||||
m_length(0),
|
||||
m_offsetxor(0),
|
||||
m_endianness(space.endianness()),
|
||||
m_prefsize(space.data_width() / 8)
|
||||
debug_view_memory_source::debug_view_memory_source(std::string &&name, address_space &space)
|
||||
: debug_view_source(std::move(name), &space.device())
|
||||
, m_space(&space)
|
||||
, m_memintf(dynamic_cast<device_memory_interface *>(&space.device()))
|
||||
, m_base(nullptr)
|
||||
, m_length(0)
|
||||
, m_offsetxor(0)
|
||||
, m_endianness(space.endianness())
|
||||
, m_prefsize(space.data_width() / 8)
|
||||
{
|
||||
}
|
||||
|
||||
debug_view_memory_source::debug_view_memory_source(const char *name, memory_region ®ion)
|
||||
: debug_view_source(name),
|
||||
m_space(nullptr),
|
||||
m_memintf(nullptr),
|
||||
m_base(region.base()),
|
||||
m_length(region.bytes()),
|
||||
m_offsetxor(ENDIAN_VALUE_NE_NNE(region.endianness(), 0, region.bytewidth() - 1)),
|
||||
m_endianness(region.endianness()),
|
||||
m_prefsize(std::min<u8>(region.bytewidth(), 8))
|
||||
debug_view_memory_source::debug_view_memory_source(std::string &&name, memory_region ®ion)
|
||||
: debug_view_source(std::move(name))
|
||||
, m_space(nullptr)
|
||||
, m_memintf(nullptr)
|
||||
, m_base(region.base())
|
||||
, m_length(region.bytes())
|
||||
, m_offsetxor(ENDIAN_VALUE_NE_NNE(region.endianness(), 0, region.bytewidth() - 1))
|
||||
, m_endianness(region.endianness())
|
||||
, m_prefsize(std::min<u8>(region.bytewidth(), 8))
|
||||
{
|
||||
}
|
||||
|
||||
debug_view_memory_source::debug_view_memory_source(const char *name, void *base, int element_size, int num_elements)
|
||||
: debug_view_source(name),
|
||||
m_space(nullptr),
|
||||
m_memintf(nullptr),
|
||||
m_base(base),
|
||||
m_length(element_size * num_elements),
|
||||
m_offsetxor(0),
|
||||
m_endianness(ENDIANNESS_NATIVE),
|
||||
m_prefsize(std::min(element_size, 8))
|
||||
debug_view_memory_source::debug_view_memory_source(std::string &&name, void *base, int element_size, int num_elements)
|
||||
: debug_view_source(std::move(name))
|
||||
, m_space(nullptr)
|
||||
, m_memintf(nullptr)
|
||||
, m_base(base)
|
||||
, m_length(element_size * num_elements)
|
||||
, m_offsetxor(0)
|
||||
, m_endianness(ENDIANNESS_NATIVE)
|
||||
, m_prefsize(std::min(element_size, 8))
|
||||
{
|
||||
}
|
||||
|
||||
@ -136,45 +136,51 @@ void debug_view_memory::enumerate_sources()
|
||||
{
|
||||
// start with an empty list
|
||||
m_source_list.clear();
|
||||
std::string name;
|
||||
m_source_list.reserve(machine().save().registration_count());
|
||||
|
||||
// first add all the devices' address spaces
|
||||
for (device_memory_interface &memintf : memory_interface_iterator(machine().root_device()))
|
||||
{
|
||||
for (int spacenum = 0; spacenum < memintf.max_space_count(); ++spacenum)
|
||||
{
|
||||
if (memintf.has_space(spacenum))
|
||||
{
|
||||
address_space &space = memintf.space(spacenum);
|
||||
name = string_format("%s '%s' %s space memory", memintf.device().name(), memintf.device().tag(), space.name());
|
||||
m_source_list.emplace_back(std::make_unique<debug_view_memory_source>(name.c_str(), space));
|
||||
address_space &space(memintf.space(spacenum));
|
||||
m_source_list.emplace_back(
|
||||
std::make_unique<debug_view_memory_source>(
|
||||
util::string_format("%s '%s' %s space memory", memintf.device().name(), memintf.device().tag(), space.name()),
|
||||
space));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// then add all the memory regions
|
||||
for (auto ®ion : machine().memory().regions())
|
||||
{
|
||||
name = string_format("Region '%s'", region.second->name());
|
||||
m_source_list.emplace_back(std::make_unique<debug_view_memory_source>(name.c_str(), *region.second.get()));
|
||||
m_source_list.emplace_back(
|
||||
std::make_unique<debug_view_memory_source>(
|
||||
util::string_format("Region '%s'", region.second->name()),
|
||||
*region.second.get()));
|
||||
}
|
||||
|
||||
// finally add all global array symbols in alphabetical order
|
||||
std::vector<std::tuple<std::string, void *, u32, u32> > itemnames;
|
||||
itemnames.reserve(machine().save().registration_count());
|
||||
|
||||
// finally add all global array symbols in ASCII order
|
||||
std::string name;
|
||||
std::size_t const firstsave = m_source_list.size();
|
||||
for (int itemnum = 0; itemnum < machine().save().registration_count(); itemnum++)
|
||||
{
|
||||
u32 valsize, valcount;
|
||||
void *base;
|
||||
std::string name_string(machine().save().indexed_item(itemnum, base, valsize, valcount));
|
||||
name = machine().save().indexed_item(itemnum, base, valsize, valcount);
|
||||
|
||||
// add pretty much anything that's not a timer (we may wish to cull other items later)
|
||||
// also, don't trim the front of the name, it's important to know which VIA6522 we're looking at, e.g.
|
||||
if (strncmp(name_string.c_str(), "timer/", 6))
|
||||
itemnames.emplace_back(std::move(name_string), base, valsize, valcount);
|
||||
if (strncmp(name.c_str(), "timer/", 6))
|
||||
m_source_list.emplace_back(std::make_unique<debug_view_memory_source>(std::move(name), base, valsize, valcount));
|
||||
}
|
||||
|
||||
std::sort(itemnames.begin(), itemnames.end(), [] (auto const &x, auto const &y) { return std::get<0>(x) < std::get<0>(y); });
|
||||
|
||||
for (auto const &item : itemnames)
|
||||
m_source_list.emplace_back(std::make_unique<debug_view_memory_source>(std::get<0>(item).c_str(), std::get<1>(item), std::get<2>(item), std::get<3>(item)));
|
||||
std::sort(
|
||||
std::next(m_source_list.begin(), firstsave),
|
||||
m_source_list.end(),
|
||||
[] (auto const &x, auto const &y) { return 0 > std::strcmp(x->name(), y->name()); });
|
||||
|
||||
// reset the source to a known good entry
|
||||
if (!m_source_list.empty())
|
||||
|
@ -28,9 +28,9 @@ class debug_view_memory_source : public debug_view_source
|
||||
friend class debug_view_memory;
|
||||
|
||||
public:
|
||||
debug_view_memory_source(const char *name, address_space &space);
|
||||
debug_view_memory_source(const char *name, memory_region ®ion);
|
||||
debug_view_memory_source(const char *name, void *base, int element_size, int num_elements);
|
||||
debug_view_memory_source(std::string &&name, address_space &space);
|
||||
debug_view_memory_source(std::string &&name, memory_region ®ion);
|
||||
debug_view_memory_source(std::string &&name, void *base, int element_size, int num_elements);
|
||||
|
||||
address_space *space() const { return m_space; }
|
||||
|
||||
|
@ -31,8 +31,8 @@ const int debug_view_state::REG_FRAME;
|
||||
// debug_view_state_source - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
debug_view_state_source::debug_view_state_source(const char *name, device_t &device)
|
||||
: debug_view_source(name, &device)
|
||||
debug_view_state_source::debug_view_state_source(std::string &&name, device_t &device)
|
||||
: debug_view_source(std::move(name), &device)
|
||||
, m_stateintf(dynamic_cast<device_state_interface *>(&device))
|
||||
, m_execintf(dynamic_cast<device_execute_interface *>(&device))
|
||||
{
|
||||
@ -81,11 +81,12 @@ void debug_view_state::enumerate_sources()
|
||||
m_source_list.clear();
|
||||
|
||||
// iterate over devices that have state interfaces
|
||||
std::string name;
|
||||
for (device_state_interface &state : state_interface_iterator(machine().root_device()))
|
||||
{
|
||||
name = string_format("%s '%s'", state.device().name(), state.device().tag());
|
||||
m_source_list.emplace_back(std::make_unique<debug_view_state_source>(name.c_str(), state.device()));
|
||||
m_source_list.emplace_back(
|
||||
std::make_unique<debug_view_state_source>(
|
||||
util::string_format("%s '%s'", state.device().name(), state.device().tag()),
|
||||
state.device()));
|
||||
}
|
||||
|
||||
// reset the source to a known good entry
|
||||
|
@ -27,7 +27,7 @@ class debug_view_state_source : public debug_view_source
|
||||
|
||||
public:
|
||||
// construction/destruction
|
||||
debug_view_state_source(const char *name, device_t &device);
|
||||
debug_view_state_source(std::string &&name, device_t &device);
|
||||
|
||||
private:
|
||||
// internal state
|
||||
|
@ -136,13 +136,14 @@ void debug_view_watchpoints::enumerate_sources()
|
||||
{
|
||||
// start with an empty list
|
||||
m_source_list.clear();
|
||||
std::string name;
|
||||
|
||||
// iterate over devices with disassembly interfaces
|
||||
for (device_disasm_interface &dasm : disasm_interface_iterator(machine().root_device()))
|
||||
{
|
||||
name = string_format("%s '%s'", dasm.device().name(), dasm.device().tag());
|
||||
m_source_list.emplace_back(std::make_unique<debug_view_source>(name.c_str(), &dasm.device()));
|
||||
m_source_list.emplace_back(
|
||||
std::make_unique<debug_view_source>(
|
||||
util::string_format("%s '%s'", dasm.device().name(), dasm.device().tag()),
|
||||
&dasm.device()));
|
||||
}
|
||||
|
||||
// reset the source to a known good entry
|
||||
|
Loading…
Reference in New Issue
Block a user