Previous Thread
Next Thread
Print Thread
MAME debugger question #115501 07/13/19 04:06 PM
Joined: Feb 2008
Posts: 106
J
JonasP Offline OP
Senior Member
OP Offline
Senior Member
J
Joined: Feb 2008
Posts: 106
Hope this is the right place for a quick question on debugger functioning. I'm trying (in vain) to set a watchpoint for a memory region that is not part of the cpu memory map. In my case, I'm debugging the Sega master system. In memory view, you'll find a list of variables, e.g. VDP/:sms_vdp/0/m_reg for the VDPs different registers. But how do I access this memory space in the debugger?

Thank you!
/J

Re: MAME debugger question [Re: JonasP] #115502 07/13/19 05:47 PM
Joined: Dec 2015
Posts: 106
A
AJR Online Content
Senior Member
Online Content
Senior Member
A
Joined: Dec 2015
Posts: 106
There's basically no way to do this with MAME right now, and I've reported it as an issue on Github. The memory system can install the necessary hooks on any address space, but the debugger's half of the watchpoint interface, which stops the CPU when the access occurs, is a complete mess that I recently tried and failed to fix.

One obvious hassle with implementing watchpoints is: in a multi-CPU system, which CPU do you stop on? This problem gets especially tricky when you consider how common it is for systems to have address spaces that two CPUs share equally, or a CPU that can yield its bus to a DMA controller which also gets time-sliced by MAME's scheduler. MAME's current implementation gets this question wrong often enough as it is.

In any case, there's not going to be a way to set watchpoints on member variables. The debugger's memory view has access to these only as a side benefit of MAME's save state system, and forcing devices to go through another code layer to access these would be completely inefficient. The best you can do is to set watchpoints on the offsets they are accessed at, and/or modify the code to call machine().debug_break() when the accesses happen.

Last edited by AJR; 07/13/19 06:31 PM.
Re: MAME debugger question [Re: JonasP] #115505 07/14/19 02:58 PM
Joined: Feb 2008
Posts: 106
J
JonasP Offline OP
Senior Member
OP Offline
Senior Member
J
Joined: Feb 2008
Posts: 106
Thanks for the explanation!


Who's Online Now
4 registered members (algrun, Dorando, 2 invisible), 33 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
ShoutChat Box
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics8,719
Posts114,609
Members4,873
Most Online510
Aug 26th, 2019
Powered by UBB.threads™ PHP Forum Software 7.7.3