OpenMSX debugger: We have high level block commands like "showmem"/"cpu regs". Do raw (not beautified) block commands exist ?

Page 3/4
1 | 2 | | 4

By friguron

Expert (83)

friguron's picture

31-05-2019, 01:44

turbor wrote:

Your future tool can also launch openmsx with an extra '-script' commandline to read the script from the same directory as your tool. It doesn't need to be integrated into openmsx for that.
Or you can load your tcl script into openmsx using any of the pipe or stdio methods that you would be using anyway to communicate with openMSX...

That's a VERY interesting approach, really. It is really much simpler than wanting to add a new command inside the debugger (which otoh, is only a whim of mine). Injecting it right after booting, should be more than enough.

Thanks for these tips.

By friguron

Expert (83)

friguron's picture

31-05-2019, 01:49

Manuel wrote:

What the openMSX debugger does is what turbor also suggests at the end: it defines a command (that it sends to openMSX) to format the data in a safe way. See https://github.com/openMSX/debugger/blob/master/src/Debugger...
When reading a block, it prepends that command to encode the data: https://github.com/openMSX/debugger/blob/master/src/OpenMSXConnection.cpp#L35

a "debug read_block memory 0 100" from the console (and from my already connected socket) returned binary raw garbage... I couldn't detect any encoding or data safety from it... Maybe there's a different way to get a block of bytes from openmsx memory formatted like this "ff 23 a0 be cd 0a 00 00 c9 cd 10 20 40 10" ? (with current debug commands and scripts?) I haven't found any as of now.

By Manuel

Ascended (15744)

Manuel's picture

31-05-2019, 10:16

I tried to explain just that... See the bin2hex proc that the debugger defines and uses in the code I mentioned.

By friguron

Expert (83)

friguron's picture

31-05-2019, 11:19

BTW, as far as I understand, turbor said something in terms of "after you connect via socket you can inject additional scripts via said socket"... Is it possible? I understand we can upload scripts via command line, at launch time, but my tool won't be the one in charge of invoking openmsx, as openmsx should be already launched by someone else.

So, after reading the manual, I can't find any entry where it says after you're connected with the socket you can inject additonal scripts onto its engine... Is it really possible to do it? (That would be the ideal final solution for me, no need to change anything inside openmsx, all code will be inside my tool)

By NYYRIKKI

Enlighted (5382)

NYYRIKKI's picture

31-05-2019, 12:21

AFAIK it does not really matter if the code is in file (in scripts folder or imported with "source"-command) , you manually type it on console or push it trough socket. The result should be same.

If you want "single line solution", maybe this works well enough for you?

binary scan [debug read_block memory 0 100] H* hex; set hex

By friguron

Expert (83)

friguron's picture

31-05-2019, 12:31

Wow, Nyyrikki solution is quite there with no need to inject anything... I'd love to have some kind of byte separator of some kind, but i can as well separate the ascii bytes really quickly inside my tool.
i.e:

fe 31 20 3e 43 53 12 32 >>>>>> fe31203e43531232

But again, not knowing enough tcl and not having experience in everyday openmsx debugger commands usage, doesn't let me build these easy solutions you give me. I think Nyyrikki solution is 95% near what I wanted Smile Thanks a lot.

By Manuel

Ascended (15744)

Manuel's picture

31-05-2019, 12:33

If you look at the code of the debugger you can see that it defines the command after connecting. Just send it valid TCL code...

By NYYRIKKI

Enlighted (5382)

NYYRIKKI's picture

31-05-2019, 12:38

Don't worry, I also seriously suck at TCL... How ever:

binary scan [debug read_block memory 0 100] H* hex; regsub -all -- {..} $hex {& }

By friguron

Expert (83)

friguron's picture

31-05-2019, 12:46

@Nyyrikki: NO, you don't Smile The Tcl you're typing have some parts that look as obfuscated perl to me...

OTOH the second version of your script works amazingly, that final iteration is the one making openmsx return what I originally wanted with no need to inject anything via socket.

It's a real luck you're so bad at TCL. I can't imagine what would have happened if you were an eminence Smile

After many useful ideas related to openmsx debugger and its tcl internal engine I think we can safely say:
END. OF. THE. THREAD. Thanks everyone.

By NYYRIKKI

Enlighted (5382)

NYYRIKKI's picture

31-05-2019, 12:55

I'm just yet another copy/paste coder here. Smile

Page 3/4
1 | 2 | | 4