summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/debug
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2014-03-11 15:54:58 +0000
committer Aaron Giles <aaron@aarongiles.com>2014-03-11 15:54:58 +0000
commit4ea9df02a1daf1893246a01e21ffe201781f9266 (patch)
tree70dcb5feb88dcabe713fc172c30fd159ed1a0a43 /src/emu/debug
parentb05606404a780c5309d39d8ee45411292279f117 (diff)
Moved core template container classes up from emutempl.h to coretmpl.h:
[Aaron Giles] * these classes now no longer take a resource_pool; everything is managed globally -- this means that objects added to lists must be allocated with global_alloc * added new auto_pointer<> template which wraps a pointer and auto-frees it upon destruction; it also defaults to NULL so it doesn't need to be explicitly initialized * moved tagged_list template to tagmap.h Redo of the low-level memory tracking system: [Aaron Giles] * moved low-level tracking out of emu\emualloc into lib\util\corealloc so it can be shared among all components and used by core libraries * global_alloc and friends no longer use a resource pool to track allocations; turns out this was a wholly redundant system that wasted a lot of memory * removed global_resource_pool entirely * added global_free_array to delete arrays allocated with global_alloc_array * added tracking of object versus array allocation; we will now error if you use global_free on an array, or global_free_array on an object Added new utility helper const_string_pool which can be used to efficiently accumulate strings that are not intended to be modified. Used by updated makelist and software list code. [Aaron Giles] Updated png2bdc and makelist tools to not leak memory and use more modern techniques (no more MAX_DRIVERS in makelist, for example). [Aaron Giles] Deprecated auto_strdup and removed all uses by way of caller-managed astrings and the software list rewrite. [Aaron Giles] Rewrote software list management: [Aaron Giles] * removed the notion of a software_list that is separate from a software_list_device; they are one and the same now * moved several functions into device_image_interface since they really didn't belong in the core software list class * lots of simplification as a result of the above changes Additional notes (no whatsnew): Moved definition of FPTR to osdcomm.h. Some changes happened in the OSD code to fix issues, especially regarding freeing arrays. SDL folks may need to fix up some of these. The following devices still are using tokens and should be modernized (I found them because they kept their token as void * and tried to delete it, which you can't): namco_52xx_device (mame/audio/namco52.c) namco_54xx_device (mame/audio/namco54.c) namco_06xx_device (mame/machine/namco06.c) namco_50xx_device (mame/machine/namco50.c) namco_51xx_device (mame/machine/namco51.c) namco_53xx_device (mame/machine/namco53.c) voodoo_device (emu/video/voodoo.c) mos6581_device (emu/sound/mos6581.c) aica_device (emu/sound/aica.c) scsp_device (emu/sound/scsp.c) dmadac_sound_device (emu/sound/dmadac.c) s3c2440_device (emu/machine/s3c2440.c) wd1770_device (emu/machine/wd17xx.c) latch8_device (emu/machine/latch8.c) duart68681_device (emu/machine/68681.c) s3c2400_device (emu/machine/s3c2400.c) s3c2410_device (emu/machine/s3c2410.c) strataflash_device (mess/machine/strata.c) hd63450_device (mess/machine/hd63450.c) tap_990_device (mess/machine/ti99/990_tap.c) omti8621_device (mess/machine/omti8621.c) vdt911_device (mess/video/911_vdt.c) apollo_graphics_15i (mess/video/apollo.c) asr733_device (mess/video/733_asr.c)
Diffstat (limited to 'src/emu/debug')
-rw-r--r--src/emu/debug/debugvw.c124
-rw-r--r--src/emu/debug/debugvw.h42
-rw-r--r--src/emu/debug/dvbpoints.c8
-rw-r--r--src/emu/debug/dvdisasm.c6
-rw-r--r--src/emu/debug/dvmemory.c8
-rw-r--r--src/emu/debug/dvstate.c4
-rw-r--r--src/emu/debug/dvwpoints.c8
7 files changed, 38 insertions, 162 deletions
diff --git a/src/emu/debug/debugvw.c b/src/emu/debug/debugvw.c
index 6d4ff66056c..d00240cc923 100644
--- a/src/emu/debug/debugvw.c
+++ b/src/emu/debug/debugvw.c
@@ -59,115 +59,6 @@ debug_view_source::~debug_view_source()
// DEBUG VIEW SOURCE LIST
//**************************************************************************
-//-------------------------------------------------
-// debug_view_source_list - constructor
-//-------------------------------------------------
-
-debug_view_source_list::debug_view_source_list(running_machine &machine)
- : m_machine(machine),
- m_head(NULL),
- m_tail(NULL),
- m_count(0)
-{
-}
-
-
-//-------------------------------------------------
-// ~debug_view_source_list - destructor
-//-------------------------------------------------
-
-debug_view_source_list::~debug_view_source_list()
-{
- reset();
-}
-
-
-//-------------------------------------------------
-// index - return the index of a source
-//-------------------------------------------------
-
-int debug_view_source_list::index(const debug_view_source &source) const
-{
- int result = 0;
- for (debug_view_source *cursource = m_head; cursource != NULL; cursource = cursource->m_next)
- {
- if (cursource == &source)
- break;
- result++;
- }
- return result;
-}
-
-
-//-------------------------------------------------
-// by_index - return a source given an index
-//-------------------------------------------------
-
-const debug_view_source *debug_view_source_list::by_index(int index) const
-{
- if (m_head == NULL)
- return NULL;
- const debug_view_source *result;
- for (result = m_head; index > 0 && result->m_next != NULL; result = result->m_next)
- index--;
- return result;
-}
-
-
-//-------------------------------------------------
-// reset - free all the view_sources
-//-------------------------------------------------
-
-void debug_view_source_list::reset()
-{
- // free from the head
- while (m_head != NULL)
- {
- debug_view_source *source = m_head;
- m_head = source->m_next;
- auto_free(machine(), source);
- }
-
- // reset the tail pointer and index
- m_tail = NULL;
- m_count = 0;
-}
-
-
-//-------------------------------------------------
-// append - add a view_source to the end of the
-// list
-//-------------------------------------------------
-
-void debug_view_source_list::append(debug_view_source &source)
-{
- // set the next and index values
- source.m_next = NULL;
-
- // append to the end
- if (m_tail == NULL)
- m_head = m_tail = &source;
- else
- m_tail->m_next = &source;
- m_tail = &source;
- m_count++;
-}
-
-
-//-------------------------------------------------
-// match_device - find the first view that
-// matches the given device
-//-------------------------------------------------
-
-const debug_view_source *debug_view_source_list::match_device(device_t *device) const
-{
- for (debug_view_source *source = m_head; source != NULL; source = source->m_next)
- if (device == source->m_device)
- return source;
- return m_head;
-}
-
-
//**************************************************************************
// DEBUG VIEW
@@ -181,7 +72,6 @@ debug_view::debug_view(running_machine &machine, debug_view_type type, debug_vie
: m_next(NULL),
m_type(type),
m_source(NULL),
- m_source_list(machine),
m_osdupdate(osdupdate),
m_osdprivate(osdprivate),
m_visible(10,10),
@@ -342,6 +232,20 @@ void debug_view::set_source(const debug_view_source &source)
//-------------------------------------------------
+// source_for_device - find the first source that
+// matches the given device
+//-------------------------------------------------
+
+const debug_view_source *debug_view::source_for_device(device_t *device) const
+{
+ for (debug_view_source *source = m_source_list.first(); source != NULL; source = source->next())
+ if (device == source->device())
+ return source;
+ return m_source_list.first();
+}
+
+
+//-------------------------------------------------
// adjust_visible_x_for_cursor - adjust a view's
// visible X position to ensure the cursor is
// visible
diff --git a/src/emu/debug/debugvw.h b/src/emu/debug/debugvw.h
index 50f84dd6b57..70db5910448 100644
--- a/src/emu/debug/debugvw.h
+++ b/src/emu/debug/debugvw.h
@@ -113,7 +113,7 @@ class debug_view_source
{
DISABLE_COPYING(debug_view_source);
- friend class debug_view_source_list;
+ friend class simple_list<debug_view_source>;
public:
// construction/destruction
@@ -135,38 +135,6 @@ private:
};
-// a debug_view_source_list contains a list of debug_view_sources
-class debug_view_source_list
-{
- DISABLE_COPYING(debug_view_source_list);
-
-public:
- // construction/destruction
- debug_view_source_list(running_machine &machine);
- ~debug_view_source_list();
-
- // getters
- running_machine &machine() const { return m_machine; }
- const debug_view_source *head() const { return m_head; }
- int count() const { return m_count; }
- int index(const debug_view_source &source) const;
- const debug_view_source *by_index(int index) const;
-
- // operations
- void reset();
- void append(debug_view_source &view_source);
- const debug_view_source *match_device(device_t *device) const;
- int match_device_index(device_t *device) const { return index(*match_device(device)); }
-
-private:
- // internal state
- running_machine & m_machine; // reference to our machine
- debug_view_source * m_head; // head of the list
- debug_view_source * m_tail; // end of the tail
- UINT32 m_count; // number of items in the list
-};
-
-
// debug_view describes a single text-based view
class debug_view
{
@@ -190,7 +158,8 @@ public:
bool cursor_supported() { flush_updates(); return m_supports_cursor; }
bool cursor_visible() { flush_updates(); return m_cursor_visible; }
const debug_view_source *source() const { return m_source; }
- const debug_view_source_list &source_list() const { return m_source_list; }
+ const debug_view_source *first_source() { return m_source_list.first(); }
+ const simple_list<debug_view_source> &source_list() const { return m_source_list; }
// setters
void set_size(int width, int height);
@@ -199,8 +168,11 @@ public:
void set_cursor_position(debug_view_xy pos);
void set_cursor_visible(bool visible = true);
void set_source(const debug_view_source &source);
+
+ // helpers
void process_char(int character) { view_char(character); }
void process_click(int button, debug_view_xy pos) { view_click(button, pos); }
+ const debug_view_source *source_for_device(device_t *device) const;
protected:
// internal updating helpers
@@ -225,7 +197,7 @@ protected:
debug_view * m_next; // link to the next view
debug_view_type m_type; // type of view
const debug_view_source *m_source; // currently selected data source
- debug_view_source_list m_source_list; // list of available data sources
+ simple_list<debug_view_source> m_source_list; // list of available data sources
// OSD data
debug_view_osd_update_func m_osdupdate; // callback for the update
diff --git a/src/emu/debug/dvbpoints.c b/src/emu/debug/dvbpoints.c
index 904e5df0386..9b48bc96787 100644
--- a/src/emu/debug/dvbpoints.c
+++ b/src/emu/debug/dvbpoints.c
@@ -64,11 +64,11 @@ void debug_view_breakpoints::enumerate_sources()
{
astring name;
name.printf("%s '%s'", dasm->device().name(), dasm->device().tag());
- m_source_list.append(*auto_alloc(machine(), debug_view_source(name.cstr(), &dasm->device())));
+ m_source_list.append(*global_alloc(debug_view_source(name.cstr(), &dasm->device())));
}
// reset the source to a known good entry
- set_source(*m_source_list.head());
+ set_source(*m_source_list.first());
}
@@ -262,7 +262,7 @@ int debug_view_breakpoints::breakpoints(SortMode sort, device_debug::breakpoint*
// Alloc
int numBPs = 0;
bpList = NULL;
- for (const debug_view_source *source = m_source_list.head(); source != NULL; source = source->next())
+ for (const debug_view_source *source = m_source_list.first(); source != NULL; source = source->next())
{
const device_debug& debugInterface = *source->device()->debug();
for (device_debug::breakpoint *bp = debugInterface.breakpoint_first(); bp != NULL; bp = bp->next())
@@ -271,7 +271,7 @@ int debug_view_breakpoints::breakpoints(SortMode sort, device_debug::breakpoint*
bpList = new device_debug::breakpoint*[numBPs];
int bpAddIndex = 0;
- for (const debug_view_source *source = m_source_list.head(); source != NULL; source = source->next())
+ for (const debug_view_source *source = m_source_list.first(); source != NULL; source = source->next())
{
// Collect
device_debug& debugInterface = *source->device()->debug();
diff --git a/src/emu/debug/dvdisasm.c b/src/emu/debug/dvdisasm.c
index ef65d329c71..cba167a2160 100644
--- a/src/emu/debug/dvdisasm.c
+++ b/src/emu/debug/dvdisasm.c
@@ -62,7 +62,7 @@ debug_view_disasm::debug_view_disasm(running_machine &machine, debug_view_osd_up
// count the number of comments
int total_comments = 0;
- for (const debug_view_source *source = m_source_list.head(); source != NULL; source = source->next())
+ for (const debug_view_source *source = m_source_list.first(); source != NULL; source = source->next())
{
const debug_view_disasm_source &dasmsource = downcast<const debug_view_disasm_source &>(*source);
total_comments += dasmsource.m_device.debug()->comment_count();
@@ -99,11 +99,11 @@ void debug_view_disasm::enumerate_sources()
for (device_disasm_interface *dasm = iter.first(); dasm != NULL; dasm = iter.next())
{
name.printf("%s '%s'", dasm->device().name(), dasm->device().tag());
- m_source_list.append(*auto_alloc(machine(), debug_view_disasm_source(name, dasm->device())));
+ m_source_list.append(*global_alloc(debug_view_disasm_source(name, dasm->device())));
}
// reset the source to a known good entry
- set_source(*m_source_list.head());
+ set_source(*m_source_list.first());
}
diff --git a/src/emu/debug/dvmemory.c b/src/emu/debug/dvmemory.c
index 7f303c84a29..ff38b03717d 100644
--- a/src/emu/debug/dvmemory.c
+++ b/src/emu/debug/dvmemory.c
@@ -131,14 +131,14 @@ void debug_view_memory::enumerate_sources()
{
address_space &space = memintf->space(spacenum);
name.printf("%s '%s' %s space memory", memintf->device().name(), memintf->device().tag(), space.name());
- m_source_list.append(*auto_alloc(machine(), debug_view_memory_source(name, space)));
+ m_source_list.append(*global_alloc(debug_view_memory_source(name, space)));
}
// then add all the memory regions
for (memory_region *region = machine().memory().first_region(); region != NULL; region = region->next())
{
name.printf("Region '%s'", region->name());
- m_source_list.append(*auto_alloc(machine(), debug_view_memory_source(name, *region)));
+ m_source_list.append(*global_alloc(debug_view_memory_source(name, *region)));
}
// finally add all global array symbols
@@ -156,12 +156,12 @@ void debug_view_memory::enumerate_sources()
if (strncmp(itemname, "timer/", 6))
{
name.cpy(itemname);
- m_source_list.append(*auto_alloc(machine(), debug_view_memory_source(name, base, valsize, valcount)));
+ m_source_list.append(*global_alloc(debug_view_memory_source(name, base, valsize, valcount)));
}
}
// reset the source to a known good entry
- set_source(*m_source_list.head());
+ set_source(*m_source_list.first());
}
diff --git a/src/emu/debug/dvstate.c b/src/emu/debug/dvstate.c
index 452f7ef5619..a2f6c24dacc 100644
--- a/src/emu/debug/dvstate.c
+++ b/src/emu/debug/dvstate.c
@@ -79,11 +79,11 @@ void debug_view_state::enumerate_sources()
for (device_state_interface *state = iter.first(); state != NULL; state = iter.next())
{
name.printf("%s '%s'", state->device().name(), state->device().tag());
- m_source_list.append(*auto_alloc(machine(), debug_view_state_source(name, state->device())));
+ m_source_list.append(*global_alloc(debug_view_state_source(name, state->device())));
}
// reset the source to a known good entry
- set_source(*m_source_list.head());
+ set_source(*m_source_list.first());
}
diff --git a/src/emu/debug/dvwpoints.c b/src/emu/debug/dvwpoints.c
index 234080bfe14..e9ff9a8754d 100644
--- a/src/emu/debug/dvwpoints.c
+++ b/src/emu/debug/dvwpoints.c
@@ -63,11 +63,11 @@ void debug_view_watchpoints::enumerate_sources()
{
astring name;
name.printf("%s '%s'", dasm->device().name(), dasm->device().tag());
- m_source_list.append(*auto_alloc(machine(), debug_view_source(name.cstr(), &dasm->device())));
+ m_source_list.append(*global_alloc(debug_view_source(name.cstr(), &dasm->device())));
}
// reset the source to a known good entry
- set_source(*m_source_list.head());
+ set_source(*m_source_list.first());
}
@@ -299,7 +299,7 @@ int debug_view_watchpoints::watchpoints(SortMode sort, device_debug::watchpoint*
// Alloc
int numWPs = 0;
wpList = NULL;
- for (const debug_view_source *source = m_source_list.head(); source != NULL; source = source->next())
+ for (const debug_view_source *source = m_source_list.first(); source != NULL; source = source->next())
{
for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; spacenum++)
{
@@ -312,7 +312,7 @@ int debug_view_watchpoints::watchpoints(SortMode sort, device_debug::watchpoint*
wpList = new device_debug::watchpoint*[numWPs];
int wpAddIndex = 0;
- for (const debug_view_source *source = m_source_list.head(); source != NULL; source = source->next())
+ for (const debug_view_source *source = m_source_list.first(); source != NULL; source = source->next())
{
// Collect
for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; spacenum++)