Skip to content

emu/debug: Extended memory commands for region and space #13767

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

holub
Copy link
Contributor

@holub holub commented Jun 2, 2025

No description provided.

@Osso13
Copy link
Member

Osso13 commented Jun 2, 2025

Please remember to update debughlp.cpp, too.

@holub
Copy link
Contributor Author

holub commented Jun 2, 2025

Sure, right after I see others have no concerns regarding this.

@ajrhacker
Copy link
Contributor

I don't think this is quite justified. There may be memory regions and memory shares with the same names.

@holub
Copy link
Contributor Author

holub commented Jun 2, 2025

I was thinking about it. It's quite immoral to expect the user to know about internal representation.
Maybe I can check if this conflict exists and request to supply an additional parameter which clarifies the type.

@holub
Copy link
Contributor Author

holub commented Jun 2, 2025

...or alternatively we can have savem which successes in case no conflicts only + samer, saves, etc

@galibert
Copy link
Member

galibert commented Jun 2, 2025

Or an alternative alternative, assuming the parser is not insane, having a savem s:whatever/r:whatever/etc where the non-prefixed DWIM when it's not ambiguous and errors otherwise.

@holub
Copy link
Contributor Author

holub commented Jun 2, 2025

Making it draft and working on @galibert 's version.

@holub holub marked this pull request as draft June 2, 2025 12:25
@cuavas
Copy link
Member

cuavas commented Jun 2, 2025

Is it really worth making the syntax more complicated to avoid an extra command? I already need to take a trip to the documentation when I want to do anything interesting with expressions (this section).

Also you’re outright removing a pair of commands which is going to break a pile of scripts, and also any ROM-patching cheats that depend on them.

On top of that, in the existing expression syntax, m is used for memory regions, not shares (e.g. monitor.mb@78 means “the byte at address 78 in the memory region with the tag monitor). If you introduce syntax in another place where m represents a memory share, that’s going to confuse people.

@holub
Copy link
Contributor Author

holub commented Jun 2, 2025

I can keep loadr and add loads. My concern is the user not expected to know what she really wants - she seeing the name in dropdown and uses the name. How do you expect her to know if it's share or region or banked?

@cuavas
Copy link
Member

cuavas commented Jun 2, 2025

If you really want to avoid adding extra commands, you could probably extend save and load to allow a region or share to be specified with a suffix similar to the ones used in expressions. (Right now they only operate on address spaces.)

For example, use the .m suffix to access a region, as we already do in expressions. So this:

save data.bin,200:monitor.m,100

Would be equivalent to this:

saver data.bin,200,100,:monitor

You’d need to choose another suffix for shares that doesn’t clash with current expression syntax (perhaps .s).

Also other things could be extended to support suffixes for region/share:

  • Expression syntax
  • fill, dump, strdump and find commands

The thing to be aware of if you do this is that then the <addr>:<spec> syntax will have two variants: one that only supports address spaces (e.g. for wpset) and one that also supports other things with suffixes.

But I think getting rid of loadr/saver or changing them in an incompatible way would be a mistake.

@cuavas
Copy link
Member

cuavas commented Jun 2, 2025

I can keep loadr and add loads. My concern is the user not expected to know what she really wants - she seeing the name in dropdown and uses the name. How do you expect her to know if it's share or region or banked?

I mean, it tells you:
image

See there it says “Region” for memory regions.

image

And it says “memory” for shares.

They already need to know what a region is to use the .m syntax in expressions.

@holub
Copy link
Contributor Author

holub commented Jun 2, 2025

So... the plan is:

  • Keep saver
  • Add savee without exposing
  • Allow to specify .m .e for save without auto-magical selection

"e" corresponds to m(e)mory in dropdown or shar(e) in internal representation.

same for load/fill/dump/...

@cuavas
Copy link
Member

cuavas commented Jun 2, 2025

If you’re extending the syntax for one of the load, save, fill, dump, etc. commands, it needs to be done for all of them. If you add a suffix for accessing a memory share, it needs to be supported in expressions as well as commands. It would be confusing otherwise.

The source argument parsing is already encapsulated for things that take the <addr>:<spec> syntax for address/space. It would be a matter of adding a variant that can yield a region or share instead of an address space. There’s already some kind of support for using regions as well as address spaces in the expression handling code.

@holub
Copy link
Contributor Author

holub commented Jun 2, 2025

Understood. I'll be working on all variants then.

Any concerns about "e" ?

@cuavas
Copy link
Member

cuavas commented Jun 2, 2025

I’m not sure. I would’ve gone for s since people using the MAME debugger are kind of assumed to have at least glanced at the MAME source. Any opinion @galibert?

@holub
Copy link
Contributor Author

holub commented Jun 2, 2025

The plan is clear and it will take some time.
You have time to pick the letter.

@holub
Copy link
Contributor Author

holub commented Jun 6, 2025

I've implemented save/load but don't really like how is the code structured. If you have any ideas how to make it better let me know while I'm implementing the rest.

@holub holub changed the title emu/debug: Replaced saver/loadr with more generic savem/loadm which handels both region and share memory emu/debug: Extended memory commands for region and space Jun 8, 2025
@holub holub marked this pull request as ready for review June 8, 2025 01:36
@holub
Copy link
Contributor Author

holub commented Jun 8, 2025

That must be it

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

Successfully merging this pull request may close these issues.

5 participants