Version 0 of Critcl debugging with gdb

Updated 2004-12-21 22:34:58

2004-12-21 (FP)

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

1- Insert the lines in the script

 critcl::config force 1    ;# optional, force recompilation
 critcl::config keepsrc 1  ;# keep sources
 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


   '''PROBLEM''' : [Critcl] inserts directives {#line 1 "foo.tcl/bar"} and gdb is in trouble,

saying "No source file named bar". The C source filename should be "~/.critcl/.../v033_....c" instead of "bar".

Temporary Solution: hack critcl

1- Unwrap critcl

 shell$ cd path_to_critcl
 shell$ sdx unwrap critcl

2- Modify the source "critcl.vfs/lib/critcl/critcl.vfs", commenting the directives

 "#line 1 ..."

as

 "/* #line 1 ...*/"

3- Wrap critcl

 shell$ sdx wrap critcl