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

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
stranger
Posts: 17
Joined: Thu Mar 03, 2011 4:05 am

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

Post 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.
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

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

Post by bewing »

Have you tried typing "save" into the textmode debugger? It should work, I think.
stranger
Posts: 17
Joined: Thu Mar 03, 2011 4:05 am

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

Post 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.
stlw
Member
Member
Posts: 357
Joined: Fri Apr 04, 2008 6:43 am
Contact:

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

Post 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 :)
stlw
Member
Member
Posts: 357
Joined: Fri Apr 04, 2008 6:43 am
Contact:

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

Post 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
stranger
Posts: 17
Joined: Thu Mar 03, 2011 4:05 am

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

Post 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)
stlw
Member
Member
Posts: 357
Joined: Fri Apr 04, 2008 6:43 am
Contact:

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

Post by stlw »

No idea about peter-bochs. I could only suggest to use integrated GUI debugger.

Stanislav
cmk128
Posts: 4
Joined: Sat Jun 16, 2007 12:01 am
Location: Hong Kong
Contact:

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

Post 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
cmk128
Posts: 4
Joined: Sat Jun 16, 2007 12:01 am
Location: Hong Kong
Contact:

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

Post 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
Post Reply