summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/debugger.h
Commit message (Collapse)AuthorAgeFilesLines
* emu: correct some file headers (nw) hap2020-06-191-0/+1
|
* Reshuffle some stuff: Vas Crabb2018-03-281-20/+0
| | | | | | * Move around the debugger hooks to get a small but measurable performance increase * Remove emucore from external tools * Improve performance of DSP16 interpreter a little by generating six variants of execution loop
* general cleanup: Vas Crabb2017-05-231-9/+5
| | | | | | | | | | | * move rarely-used output and pty interfaces out of emu.h * consolidate and de-duplicate forward declarations, also remove some obsolete ones * clean up more #include guard macros * scope down a few more things (nw) Everyone, please keep forward declarations for src/emu in src/emu/emufwd.h - this will make it far easier to keep them in sync with declarations than having them scattered through all the other files.
* remove #include addition due to smf's better fix therealmogminer@gmail.com2016-06-081-2/+0
|
* Fix build on MSVC thanks to Rene, also fix debug_break crashes therealmogminer@gmail.com2016-06-081-2/+4
|
* Major refactoring of debugger core [Ryan Holtz] therealmogminer@gmail.com2016-06-081-101/+26
| | | | | | | | * 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
* put debug_view back in machine due to issues with QT (nw) Miodrag Milanovic2016-01-121-3/+0
|
* created debugger_manager, now this one owns debug_view_manager (nw) Miodrag Milanovic2016-01-121-8/+25
|
* macro removal INLINE -> static inline (nw) Miodrag Milanovic2015-12-121-7/+7
|
* Added some for Nathan and some more for Nicola (nw) Miodrag Milanovic2015-05-111-6/+2
|
* Added dummy license headers for EMU section (nw) Miodrag Milanovic2015-05-071-0/+2
|
* and a final batch of passing attotime as const reference (nw) Oliver Stöneberg2014-07-041-1/+1
|
* exclude a few more codebits with FASTDEBUG=1 (nw) Oliver Stöneberg2013-08-251-0/+2
|
* Cleanups and version bumpmame0148 Miodrag Milanovic2013-01-111-1/+1
|
* BIG update. Aaron Giles2011-03-291-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove redundant machine items from address_space and device_t. Neither machine nor m_machine are directly accessible anymore. Instead a new getter machine() is available which returns a machine reference. So: space->machine->xxx ==> space->machine().xxx device->machine->yyy ==> device->machine().yyy Globally changed all running_machine pointers to running_machine references. Any function/method that takes a running_machine takes it as a required parameter (1 or 2 exceptions). Being consistent here gets rid of a lot of odd &machine or *machine, but it does mean a very large bulk change across the project. Structs which have a running_machine * now have that variable renamed to m_machine, and now have a shiny new machine() method that works like the space and device methods above. Since most of these are things that should eventually be devices anyway, consider this a step in that direction. 98% of the update was done with regex searches. The changes are architected such that the compiler will catch the remaining errors: // find things that use an embedded machine directly and replace // with a machine() getter call S: ->machine-> R: ->machine\(\)\. // do the same if via a reference S: \.machine-> R: \.machine\(\)\. // convert function parameters to running_machine & S: running_machine \*machine([^;]) R: running_machine \&machine\1 // replace machine-> with machine. S: machine-> R: machine\. // replace &machine() with machine() S: \&([()->a-z0-9_]+machine\(\)) R: \1 // sanity check: look for this used as a cast (running_machine &) // and change to this: *(running_machine *)
* Moved debugging structure away from CPUs only and attached to all Aaron Giles2010-07-061-6/+6
| | | | | | | | | | | | | | | | devices. Debugger now creates one for each device. C++-ified most debugger operations to hang off the debugging class, and updated most callers. This still needs a little cleanup, but it fixes most issues introduced when the CPUs were moved to their own devices. Got rid of cpu_count, cpu_first, cpu_next, etc. as they were badly broken. Also removed cpu_is_executing, cpu_is_suspended, cpu_get_local_time, and cpu_abort_timeslice. Some minor name changes: state_value() -> state() state_set_value() -> set_state()
* WARNING: There are likely to be regressions in both functionality and Aaron Giles2010-06-081-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | performance as a result of this change. Do not panic; report issues to the list in the short term and I will look into them. There are probably also some details I forgot to mention. Please ask questions if anything is not clear. NOTE: This is a major internal change to the way devices are handled in MAME. There is a small impact on drivers, but the bulk of the changes are to the devices themselves. Full documentation on the new device handling is in progress at http://mamedev.org/devwiki/index.php/MAME_Device_Basics Defined two new casting helpers: [Aaron Giles] downcast<type>(value) should be used for safe and efficient downcasting from a base class to a derived class. It wraps static_cast<> by adding an assert that a matching dynamic_cast<> returns the same result in debug builds. crosscast<type>(value) should be used for safe casting from one type to another in multiple inheritance scenarios. It compiles to a dynamic_cast<> plus an assert on the result. Since it does not optimize down to static_cast<>, you should prefer downcast<> over crosscast<> when you can. Redefined running_device to be a proper C++ class (now called device_t). Same for device_config (still called device_config). All devices and device_configs must now be derived from these base classes. This means each device type now has a pair of its own unique classes that describe the device. Drivers are encouraged to use the specific device types instead of the generic running_device or device_t classes. Drivers that have a state class defined in their header file are encouraged to use initializers off the constructor to locate devices. [Aaron Giles] Removed the following fields from the device and device configuration classes as they never were necessary or provided any use: device class, device family, source file, version, credits. [Aaron Giles] Added templatized variant of machine->device() which performs a downcast as part of the device fetch. Thus machine->device<timer_device>("timer") will locate a device named "timer", downcast it to a timer_device, and assert if the downcast fails. [Aaron Giles] Removed most publically accessible members of running_device/device_t in favor of inline accessor functions. The only remaining public member is machine. Thus all references to device->type are now device->type(), etc. [Aaron Giles] Created a number of device interface classes which are designed to be mix- ins for the device classes, providing specific extended functionality and information. There are standard interface classes for sound, execution, state, nvram, memory, and disassembly. Devices can opt into 0 or more of these classes. [Aaron Giles] Converted the classic CPU device to a standard device that uses the execution, state, memory, and disassembly interfaces. Used this new class (cpu_device) to implement the existing CPU device interface. In the future it will be possible to convert each CPU core to its own device type, but for now they are still all CPU devices with a cpu_type() that specifies exactly which kind of CPU. [Aaron Giles] Created a new header devlegcy.h which wraps the old device interface using some special template classes. To use these with an existing device, simply remove from the device header the DEVICE_GET_INFO() declaration and the #define mapping the ALL_CAPS name to the DEVICE_GET_INFO. In their place #include "devlegcy.h" and use the DECLARE_LEGACY_DEVICE() macro. In addition, there is a DECLARE_LEGACY_SOUND_DEVICE() macro for wrapping existing sound devices into new-style devices, and a DECLARE_LEGACY_NVRAM_DEVICE() for wrapping NVRAM devices. Also moved the token and inline_config members to the legacy device class, as these are not used in modern devices. [Aaron Giles] Converted the standard base devices (VIDEO_SCREEN, SPEAKER, and TIMER) from legacy devices to the new C++ style. Also renamed VIDEO_SCREEN to simply SCREEN. The various global functions that were previously used to access information or modify the state of these devices are now replaced by methods on the device classes. Specifically: video_screen_configure() == screen->configure() video_screen_set_visarea() == screen->set_visible_area() video_screen_update_partial() == screen->update_partial() video_screen_update_now() == screen->update_now() video_screen_get_vpos() == screen->vpos() video_screen_get_hpos() == screen->hpos() video_screen_get_vblank() == screen->vblank() video_screen_get_hblank() == screen->hblank() video_screen_get_width() == screen->width() video_screen_get_height() == screen->height() video_screen_get_visible_area() == screen->visible_area() video_screen_get_time_until_pos() == screen->time_until_pos() video_screen_get_time_until_vblank_start() == screen->time_until_vblank_start() video_screen_get_time_until_vblank_end() == screen->time_until_vblank_end() video_screen_get_time_until_update() == screen->time_until_update() video_screen_get_scan_period() == screen->scan_period() video_screen_get_frame_period() == screen->frame_period() video_screen_get_frame_number() == screen->frame_number() timer_device_adjust_oneshot() == timer->adjust() timer_device_adjust_periodic() == timer->adjust() timer_device_reset() == timer->reset() timer_device_enable() == timer->enable() timer_device_enabled() == timer->enabled() timer_device_get_param() == timer->param() timer_device_set_param() == timer->set_param() timer_device_get_ptr() == timer->get_ptr() timer_device_set_ptr() == timer->set_ptr() timer_device_timeelapsed() == timer->time_elapsed() timer_device_timeleft() == timer->time_left() timer_device_starttime() == timer->start_time() timer_device_firetime() == timer->fire_time() Updated all drivers that use the above functions to fetch the specific device type (timer_device or screen_device) and call the appropriate method. [Aaron Giles] Changed machine->primary_screen and the 'screen' parameter to VIDEO_UPDATE to specifically pass in a screen_device object. [Aaron Giles] Defined a new custom interface for the Z80 daisy chain. This interface behaves like the standard interfaces, and can be added to any device that implements the Z80 daisy chain behavior. Converted all existing Z80 daisy chain devices to new-style devices that inherit this interface. [Aaron Giles] Changed the way CPU state tables are built up. Previously, these were data structures defined by a CPU core which described all the registers and how to output them. This functionality is now part of the state interface and is implemented via the device_state_entry class. Updated all CPU cores which were using the old data structure to use the new form. The syntax is currently awkward, but will be cleaner for CPUs that are native new devices. [Aaron Giles] Converted the okim6295 and eeprom devices to the new model. These were necessary because they both require multiple interfaces to operate and it didn't make sense to create legacy device templates for these single cases. (okim6295 needs the sound interface and the memory interface, while eeprom requires both the nvram and memory interfaces). [Aaron Giles] Changed parameters in a few callback functions from pointers to references in situations where they are guaranteed to never be NULL. [Aaron Giles] Removed MDRV_CPU_FLAGS() which was only used for disabling a CPU. Changed it to MDRV_DEVICE_DISABLE() instead. Updated drivers. [Aaron Giles] Reorganized the token parsing for machine configurations. The core parsing code knows how to create/replace/remove devices, but all device token parsing is now handled in the device_config class, which in turn will make use of any interface classes or device-specific token handling for custom token processing. [Aaron Giles] Moved many validity checks out of validity.c and into the device interface classes. For example, address space validation is now part of the memory interface class. [Aaron Giles] Consolidated address space parameters (bus width, endianness, etc.) into a single address_space_config class. Updated all code that queried for address space parameters to use the new mechanism. [Aaron Giles]
* Correct a long-standing design flaw: device configuration state Aaron Giles2010-01-181-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | is now separate from runtime device state. I have larger plans for devices, so there is some temporary scaffolding to hold everything together, but this first step does separate things out. There is a new class 'running_device' which represents the state of a live device. A list of these running_devices sits in machine->devicelist and is created when a running_machine is instantiated. To access the configuration state, use device->baseconfig() which returns a reference to the configuration. The list of running_devices in machine->devicelist has a 1:1 correspondance with the list of device configurations in machine->config->devicelist, and most navigation options work equally on either (scanning by class, type, etc.) For the most part, drivers will now deal with running_device objects instead of const device_config objects. In fact, in order to do this patch, I did the following global search & replace: const device_config -> running_device device->static_config -> device->baseconfig().static_config device->inline_config -> device->baseconfig().inline_config and then fixed up the compiler errors that fell out. Some specifics: Removed device_get_info_* functions and replaced them with methods called get_config_*. Added methods for get_runtime_* to access runtime state from the running_device. DEVICE_GET_INFO callbacks are only passed a device_config *. This means they have no access to the token or runtime state at all. For most cases this is fine. Added new DEVICE_GET_RUNTIME_INFO callback that is passed the running_device for accessing data that is live at runtime. In the future this will go away to make room for a cleaner mechanism. Cleaned up the handoff of memory regions from the memory subsystem to the devices.
* First round of an attempted cleanup of header files in the system. Aaron Giles2010-01-101-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Created new central header "emu.h"; this should be included by pretty much any driver or device as the first include. This file in turn includes pretty much everything a driver or device will need, minus any other devices it references. Note that emu.h should *never* be included by another header file. - Updated all files in the core (src/emu) to use emu.h. - Removed a ton of redundant and poorly-tracked header includes from within other header files. - Temporarily changed driver.h to map to emu.h until we update files outside of the core. Added class wrapper around tagmap so it can be directly included and accessed within objects that need it. Updated all users to embed tagmap objects and changed them to call through the class. Added nicer functions for finding devices, ports, and regions in a machine: machine->device("tag") -- return the named device, or NULL machine->port("tag") -- return the named port, or NULL machine->region("tag"[, &length[, &flags]]) -- return the named region and optionally its length and flags Made the device tag an astring. This required touching a lot of code that printed the device to explicitly fetch the C-string from it. (Thank you gcc for flagging that issue!)
* Moved some of the CPU cores over to use get_safe_token like other devices. Aaron Giles2009-03-121-0/+1
| | | | Also cleaned them so they compile.
* This update is the below two patches, plus the remaining changes Aaron Giles2008-12-191-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | necessary to remove 12 of the final 14 references to the global Machine. The remaining 2 are in fatalerror() and logerror(), which are both local to mame.c, so Machine is now fully static. -- From: Atari Ace [mailto:atari_ace@verizon.net] Sent: Thursday, December 18, 2008 5:47 PM To: submit@mamedev.org Cc: atariace@hotmail.com Subject: [patch] Make Machine static followup Hi mamedev, This incremental patch to my last patch undoes the change that caches the ppu2c0x videorom. I changed the code back to how it behaved originally, using an existing machine on the chip struct to eliminate the one troublesome Machine reference. ~aa -- From: Atari Ace [mailto:atari_ace@verizon.net] Sent: Thursday, December 18, 2008 2:54 PM To: submit@mamedev.org Cc: atariace@hotmail.com Subject: [patch] Make Machine static! Hi mamedev, This large patch completes the removal of the use of Machine throughout MAME. It does so primarily by adding machine, device or space to various apis and modifying the callers, but for some remaining cases it adds a new api, mame_get_running_machine(), which will be called instead. There are only 14 uses of this api currently, and that number should drop over time. There are a few changes of note: 1. 6821pia.c. I attached machine to the 'device' structure. I'm working on converting this to a proper device, but that change isn't ready. 2. fddebug.c. I added a proper header so that the apis won't get accidentally converted to static again. 3. scsi.c. I added a machine to SCSIInstance. 4. system16.c. I modified sys16_patch_code to take an array of patches. 4. custom.h. I added the owning sound device to the reset/stop routines as well as the token. Note that passing only the device would require exposing the internals of custom_sound, as the token passed is not the device token, but the token returned from the CUSTOM_START routine. Better ideas here are welcome. 4. ppc2c0x.c. To avoid changing more interfaces, the init routine saves the videorom location rather than looks it up each time. I tried to choose what I felt was the natural parameter for an api, rather than always pass machine, but in some cases I used machine to limit the number of additional changes. Some additional cleanup here is probably warranted, I'll look into that later once I'm recovered from this two-week project. ~aa
* Further debugger cleanup. Symbol tables now have a global ref Aaron Giles2008-11-221-1/+1
| | | | | as well as a per-symbol ref. Debugcpu is now clear of active CPU references and global Machine references.
* Debugger interfaces cleanup. Still more to do but this compiles and Aaron Giles2008-11-211-15/+15
| | | | | | | works. Added callback parameters to the expression engine. Improved CPU parsing so you can use a CPU tag or index in most commands that take one. Switched to passing CPU and address space objects around where appropriate. Lots of other minor tweaks.
* Another big one. Aaron Giles2008-11-201-1/+36
| | | | | | | | | | | | | | | | | | | | Moved memory global state into a struct hanging off of the machine. Updated almost all memory APIs to take an address_space * where appropriate, and updated all callers. Changed memory internals to use address spaces where appropriate. Changed accessors to point to the memory_* functions instead of the address space-specific functions. Improved internal handling of watchpoints. Added cputag_* functions: cputag_reset(), cputag_get_index(), cputag_get_address_space(). These just expand via macros to an initial fetch of the CPU via cputag_get_cpu() followed by the standard CPU call. Added debugger_interrupt_hook() and debugger_exception_hook() calls which intelligently look at the debugger flags before calling. Did minimal cleanup of debugger, mainly moving CPU-specific data to hang off of the CPU classdata for more direct access.
* Major cpuintrf changes: Aaron Giles2008-11-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | * added a set of cpu_* calls which accept a CPU device object; these are now the preferred means of manipulating a CPU * removed the cpunum_* calls; added an array of cpu[] to the running_machine object; converted all existing cpunum_* calls to cpu_* calls, pulling the CPU device object from the new array in the running_machine * removed the activecpu_* calls; added an activecpu member to the running_machine object; converted all existing activecpu_* calls to cpu_* calls, pulling the active CPU device object from the running_machine * changed cpuintrf_push_context() to cpu_push_context(), taking a CPU object pointer; changed cpuintrf_pop_context() to cpu_pop_context(); eventually these will go away * many other similar changes moving toward a model where all CPU references are done by the CPU object and not by index
* 02280: any set with multiple CPUs: Disassembler freezes when doing a Run on ↵ Aaron Giles2008-09-221-1/+1
| | | | any CPU other than CPU 0
* From Oliver Stoeneberg [oliverst@online.de] Aaron Giles2008-09-041-1/+0
| | | | | | | | | | | | | | | | | | | | | | | This contains three different patches: 20080829.patch Introducing the running_machine* parameter in a few more places. Next step would be to make the execute_* function aware of it, if that's OK. Also used the machine parameter in memory.c were it's available. 20080829_1.patch The already discussed and probably being rejected removal of dreprecat.h from debugger.h. I think this is a low-risk patch (we had worse cleanups) and it lowers the risk of new code using deprecated function beign introduced in MAME/MESS, because there is no invisible inclusion of deprecat.h anymore (I think one driver - kofball.c - got it with deprecated code). 20080829_2.patch The last Machine -> machine conversion I had sitting in my local tree. I know the proper way is to turn them into devices, but I still haven't looked into that.
* Minor cleanup from last checkin. Aaron Giles2008-07-171-1/+1
|
* Robustified key behavior when the debugger is visible. Should now Aaron Giles2008-07-171-1/+1
| | | | | | | | | | | properly ignore the "break into debugger" keypress and not allow related characters to filter through. Removed some hacks related to making that work in the past. Changed osd_wait_for_debugger() to take a machine parameter and a "firsttime" parameter, which is set to 1 the first time the function is called after a break. The Windows debugger uses this to ensure that the debugger has focus when you break into it.
* Cleanups/version bump.mame0125u7 Aaron Giles2008-06-261-7/+7
|
* Removed DEBUGGER flag from makefile and ENABLE_DEBUGGER Aaron Giles2008-06-261-40/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | macro from the source code. All MAME builds now include the debugger, and it is enabled/disabled exclusively by the runtime command-line/ini settings. This is a minor speed hit for now, but will be further optimized going forward. Changed the 'd' suffix in the makefile to apply to DEBUG builds (versus DEBUGGER builds as it did before). Changed machine->debug_mode to machine->debug_flags. These flags now indicate several things, such as whether debugging is enabled, whether CPU cores should call the debugger on each instruction, and whether there are live watchpoints on each address space. Redesigned a significant portion of debugcpu.c around the concept of maintaining these flags globally and a similar, more complete set of flags internally for each CPU. All previous functionality should work as designed but should be more robust and faster to work with. Added new debugger hooks for starting/stopping CPU execution. This allows the debugger to decide whether or not a given CPU needs to call the debugger on each instruction during the coming timeslice. Added new debugger hook for reporting exceptions. Proper exception breakpoints are not yet implemented. Added new module debugger.c which is where global debugger functions live.
* From: Atari Ace [mailto:atari_ace@verizon.net] Aaron Giles2008-05-011-0/+2
| | | | | | | | | | | | | | | | | | Subject: [patch] Small deprecat.h related cleanup Hi mamedev, While doing some work on eliminating some uses of deprecat.h, I came across a few files that didn't have it that used deprecated features. A little investigation revealed they were getting it through debugger.h, typically by referencing m68000.h. Since deprecat.h is intended to document the files that need updating (otherwise it would just be included in a common header), I reworked debugger.h to not import it when the debugger is not enabled, and fixed the files that broke as a result. ~aa
* Added missing #include. Aaron Giles2008-04-021-0/+1
|
* Changed debugger-related code to be based off a new makefile define ↵ Aaron Giles2008-02-021-6/+7
| | | | | | | | | | | | | (DEBUGGER) which sets a new compile-time define (ENABLE_DEBUGGER). This means that MAME_DEBUG no longer means "enable debugger", it simply enables debugging features such as assertions and debug code in drivers. Also removed the various levels of opbase protection in memory.h and always just turned on full bounds checking. Fixed build break due to missing ampoker.lay -> ampoker2.lay renaming.
* Copyright cleanup: Aaron Giles2008-01-061-1/+1
| | | | | | - removed years from copyright notices - removed redundant (c) from copyright notices - updated "the MAME Team" to be "Nicola Salmoria and the MAME Team"
* Initial checkin of MAME 0.121.mame0121 Aaron Giles2007-12-171-0/+71