TCL: how to step + log reg PC?

Hi guys, here's a OpenMSX-TCL-newbie question. From the OpenMSX interactive console I'd like to get a succession of values of the Z80 register PC, so I type something like this (example1):

for {variable i 0} { $i<4 } { incr i } { step_in; message [reg pc]; }

but it doesn't work as expected. The CPU actually steps, but something in the OpenMSX machinery seems to "cache" the initial PC value until the for statement is completed, so the result on standard output is:

info: 3437
info: 3437
info: 3437
info: 3437

Counterexample: it works as expected/desired if I type four times the command

step_in; message [reg pc];

standard output shows

info: 2975
info: 2978
info: 2980
info: 3441

Any clue about what's wrong in example1, or how could I obtain the desired output? Thanks everyone, kindest regards.

PS: I'm aware of the command "reg_log" and tried to use it, but values only update at every VDP frame, not at every CPU step.

Manuel's answer is correct. I just wanted to add that openMSX has built-in functionality for CPU (PC) tracing. See the cputrace setting. This will print (a lot) of output on stdout, so you probably want to start openMSX from the commandline and redirect stdout to a file.

Aha! Thanks guys, both the solutions are valuable resources, I'll play with them tonight. Some explanation is probably due: I'm a complete rookie at TCL and have no MSX big plan in mind , so please don't hold your breath for "this year's OpenMSX killer-app plugin"...