Page 1 of 1

Bochs / Peter - Bochs: how to save/resume state

Posted: Thu Mar 03, 2011 4:32 am
by stranger
Hi, How can I (can I?) save/resume simulation state in Bochs? I have read this, but referenced button/gui isn't available to me during early phase of simulation (while BIOS runs), Bochs output window doesn't even respond to [x] close button. Is there some equivalent command that can be run from debugger command line to suspend/save simulation state? Thanks.

Re: Bochs / Peter - Bochs: how to save/resume state

Posted: Thu Mar 03, 2011 7:20 am
by bewing
Have you tried typing "save" into the textmode debugger? It should work, I think.

Re: Bochs / Peter - Bochs: how to save/resume state

Posted: Thu Mar 03, 2011 7:28 am
by stranger
Yes:

Code: Select all

<bochs:1> save
:1: syntax error at 'save'
I have even tried 'record file.txt' to record console input, but resulting file is empty.

Re: Bochs / Peter - Bochs: how to save/resume state

Posted: Thu Mar 03, 2011 2:08 pm
by stlw
There is no 'save' option from the debugger, only 'restore' ...
Instead of 'save' you could use show "." - this will print you whole CPU. or show "cs" will print you only CS segment fields.
When you can for example 'restore' CS segment data with a data in same format as was printed by 'show'.

But this is voodoo that is not planned to be used as you think to do. I have no idea why can't you see "Suspend" button.
I am sure you just not looking into correct place.
Here it is, near Power, Reset and other buttons, available right after first instruction.

Stanislav

P.S> How I forgot about 'save' ? Will be added in SVN soon :)

Re: Bochs / Peter - Bochs: how to save/resume state

Posted: Thu Mar 03, 2011 2:12 pm
by stlw
Second thought: when you are in debugger promt GUI buttons may not work (never tried, but sound logical to me).

Can suggest only one stupint workaround. use setpmem to modify your current instruction and write JMP$ into it.
When restore simulation with 'c' and press Suspend.

Stanislav

Re: Bochs / Peter - Bochs: how to save/resume state

Posted: Fri Mar 04, 2011 6:26 am
by stranger
Thanks Stanislav. I'v always set breakpoint early, thus never runned bochs long enough to notice that gui depends on run state. Your solution works for me, just need to jump out of romimage space, because as I learned, its write protection works even against setpmem.

Unfortunately, I have troubles "running bochs" for longer periods of time from Peter Bochs frontend. Simulation suddenly stops at random instruction (of course, in case of jmp loop always on the same), so I need to click suspend really fast.
This is what I get from java on terminal:

Code: Select all

java.lang.ArrayIndexOutOfBoundsException: 1
        at peter.Application.updateRegister(Application.java:2168)
        at peter.Application.access$20(Application.java:2000)
        at peter.Application$20.run(Application.java:1203)
java.lang.NumberFormatException: For input string: ""
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
        at java.lang.Long.parseLong(Long.java:431)
        at peter.CommonLib.hex2decimal(CommonLib.java:551)
        at peter.Application.updateHistoryTable(Application.java:1477)
        at peter.Application.access$28(Application.java:1456)
        at peter.Application$20.run(Application.java:1252)

Re: Bochs / Peter - Bochs: how to save/resume state

Posted: Fri Mar 04, 2011 10:26 am
by stlw
No idea about peter-bochs. I could only suggest to use integrated GUI debugger.

Stanislav

Re: Bochs / Peter - Bochs: how to save/resume state

Posted: Sat Apr 30, 2011 11:39 am
by cmk128
Dear stranger
Please tell me what peter-bochs version and bochs version you are using? Are you using the latest one http://code.google.com/p/peter-bochs/downloads/list ?
thanks

Re: Bochs / Peter - Bochs: how to save/resume state

Posted: Sat Apr 30, 2011 11:44 am
by cmk128
Dear stranger , I double checked peter-bochs source code, the exception is try-catch already, it should drag peter-bochs to death. Please give me your bochs version so that I can trace.
thanks