Version 5 of Critcl debugging with gdb

Updated 2004-12-22 10:34:22

2004-12-22 (FP)

A way to debug 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

 critcl::cproc bar {...

2- Launch the debugger gdb (or ddd)

 shell$ ddd tclkit

3- Run the program in order to construct and compile C fucntions

 gdb> run path_to_critcl/critcl foo.tcl

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

 gdb> break tcl_bar

5- Rerun the program

 gdb> run