Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose debugger functionality to Lua console #2451

Closed
T045T opened this issue Jul 8, 2017 · 3 comments
Closed

Expose debugger functionality to Lua console #2451

T045T opened this issue Jul 8, 2017 · 3 comments

Comments

@T045T
Copy link

T045T commented Jul 8, 2017

I'd like to drive the MAME debugger externally, and most of what I need is exposed to the Lua console via the emu object already: Memory and hardware introspection, stopping and resuming gameplay.

A few crucial parts are missing though: The ability to single-step, set and remove break- and watchpoints, and to get notified when hitting said points.

Is there a chance to get those, or does something fundamentally make that hard to do?

@cracyc
Copy link
Member

cracyc commented Jul 8, 2017

I've got a branch with support for break and watch points at https://github.com/cracyc/mame/tree/lua_debugpoint .

@npwoods
Copy link
Contributor

npwoods commented Jul 8, 2017

Why not try to build some sort of bridge by which all debugger commands get exposed to LUA?

Granted, there are details that would need to be worked out (commands currently write to the console, and figuring out how to make errors throw LUA exceptions would be non trivial), but that would seem like a better long term solution.

@cracyc
Copy link
Member

cracyc commented Jul 24, 2017

Okay, I went ahead and did it this way because it requires no changes outside of luaengine. There are three things be aware of here:

  1. Break or watch points can only be caught by using emu.register_periodic because it is called when a debugger break occurs.
  2. The debugger provides no feedback about which (or if any) break occurred other than the console log. In the emu.register_periodic callback you'll have to read and parse the last line to find out.
  3. The none debugger can't be used with the lua console for breakpoints because it will always immediately resume when stopped. Non-interactive scripts should be okay because emu.register_periodic is always called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants