Version 4 of Critcl debugging with gdb

Updated 2004-12-22 10:25:49

2004-12-22 (FP)

A way to debug the C functions of a Critcl script foo.tcl:

1- Insert these lines in the script foo.tcl

 package require critcl 0.34 ;# NEEDS > 0.33 #
 critcl::config force 1      ;# optional, force recompilation
 critcl::config keepsrc 1    ;# keep sources in cache
 critcl::config lines 0      ;# code references cached C sources, not tcl source
 critcl::cheaders -g         ;# keep symbols inside library

2- Launch the debugger gdb (or ddd)

 shell$ ddd tclkit

3- Run the program in order to compile

 gdb> run path_to_critcl/critcl foo.tcl

4- Insert breakpoint. Note that "critcl::cproc bar ..." generates C functions tcl_bar and c_bar

 gdb> break tcl_bar

5- Rerun the program

 gdb> run