TCL: how to step + log reg PC?

Page 2/2
1 |

By hit9918

Prophet (2533)

hit9918's picture

17-11-2016, 23:18

now I got this problem

        proc dbsn { count } {
                debug step
                incr count -1
                if {$count > 0 } { after realtime 0 "dbsn $count" } else { after realtime 0 "puts [disasm]" }
                return
	}
	namespace export dbsn

getting an error
I thought with another after the disasm might be in sync

By hit9918

Prophet (2533)

hit9918's picture

17-11-2016, 23:25

ok I needed another bracket. but display is still one instruction behind.

By Manuel

Ascended (12811)

Manuel's picture

18-11-2016, 22:43

What display is behind exactly? can you give an example what you expected and what is happening instead?

By hit9918

Prophet (2533)

hit9918's picture

20-11-2016, 04:33

        proc dbsn { count } {
                debug step
                incr count -1
                if {$count > 0 } { after realtime 0 "dbsn $count" } 
#else { after realtime 0 "[puts [disasm]]" }
                if {$count == 0 } { puts [disasm] }
                return
	}
	namespace export dbsn

then use it with

debug break
reset
dbsn 4
disasm

the script disasm is a step behind

By Manuel

Ascended (12811)

Manuel's picture

20-11-2016, 12:28

Remember that we introduced the 'after realtime 0' construction to allow openMSX to execute emulation for the 'debug step' command. So that command is only executed after this proc ends.

I solved it quickly in this version:

        proc dbsn { count } {
                debug step
                incr count -1
                if {$count > 0 } { after realtime 0 "dbsn $count" }
#else { after realtime 0 "[puts [disasm]]" }
                if {$count == 0 } { after realtime 0 "puts \[disasm\]" }
                return
	}
	namespace export dbsn

Note the escaping of the []. That's because I do not want it to have it executed when I make the 'after realtime 0' command, but when the argument of 'after realtime 0' is executed.

By hit9918

Prophet (2533)

hit9918's picture

20-11-2016, 22:56

ah. the debug step is like just sending a signal.
then after the last "debug step" one needs another "after 0" to give the other thread a timeslice to update the variables.

By Manuel

Ascended (12811)

Manuel's picture

20-11-2016, 23:00

Yes. I'd describe it like: "when a Tcl script is running, no emulation is running". So make sure that the Tcl scripts stop running to let emulation run.

Page 2/2
1 |
My MSX profile