Re: Tcl/Tk debugger



Oooops ....
I inclused the proc and just iside the proc "plot_axes" where the error
is generated, I inserted my call to breakponit passing a constant
string as follows:

for {set i 0} {$i <= $nticks} {incr i} {

set whs [string first " " $line]
set labl [string range $line 0 $whs]
set labl [string trim $labl]
set line [string range $line $whs 1000000]
set line [string trimleft $line]

if { $plot(rot_v) == 0 } {
breakpoint "plot_axes"
set verpoint [expr
$plot(vw)+$plot(vdelta)-int(($labl-$begpt)*($plot(vw)/$delta))]
} else {
set verpoint [expr
$plot(vdelta)+int(($labl-$begpt)*($plot(vw)/$delta))]
}

This time the error message reads:
'Error: syntax error in expression "$cmd eq "c""

The stack Tracxe contents is:

syntax error in expression "$cmd eq "c""
("if" test expression)
while compiling
"if {$cmd eq "c"} break"
("while" body line 5)
while compiling
"while 1 {
puts -nonewline "$args% "
flush stdout
gets stdin cmd
if {$cmd eq "c"} break
catch {uplevel 1 $cmd} ..."
(compiling body of proc "breakpoint", line 2)
invoked from within
"breakpoint "plot_axes" "
(procedure "plot_axes" line 121)
invoked from within
"plot_axes"
(procedure "plot_geo" line 12)
invoked from within
"plot_geo "
(procedure "draw_canvas" line 100)
invoked from within
"draw_canvas 0"
(procedure "pick_hist" line 30)
invoked from within
"pick_hist"
invoked from within
".hist_info_frame.butbox.button_ok invoke"
("uplevel" body line 1)
invoked from within
"uplevel #0 [list $w invoke]"
(procedure "tkButtonUp" line 7)
invoked from within
"tkButtonUp .hist_info_frame.butbox.button_ok
"
(command bound to event)




MH wrote:
In article <1149878644.976048.87550@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
maura.monville@xxxxxxxxx <maura.monville@xxxxxxxxx> wrote:

suchenwi wrote:
Cameron Laird schrieb:

You ask about the concept of a breakpoint in a language
where commands might not be evaluated until run-time. I
assure you it is possible to set a meaningful breakpoint
even in such cases.

Here is an example, allowing introspection and modification of
variables at the place where [breakpoint] is called:

proc breakpoint args {
while 1 {
puts -nonewline "$args% "
flush stdout
gets stdin cmd
if {$cmd eq "c"} break
catch {uplevel 1 $cmd} res
if {$res ne ""} {puts $res}
}
}

So I should intclude this proc in my Tcl fil and call this procedure at
the point where I wish the interpreter to stop .. am I right ?
Can you please provide an example of usage of yor procedure ?
I understand "c" is the way to exit it. But I do not know which
argments to pass to it.
It seems to start a Tcl interactive session from which I can then print
out and perhaps set some variables of interest....

Maura, at this point, you should be able to type in ANY valid Tcl commands,
such as:
puts $label
expr [$label * $plot]
etc..

c will act as "continue" in gdb.

MH

.