سؤال

I have a code base which have C and TCL and C functions calls tcl procs repeatedly.

I want to debug the code and for it I need to know which C function is calling a particular TCL proc.

I tried this : TCL stack trace

but it gives stack trace for TCL part only. Is it possible to find out stack trace for C code also from within TCL proc?

هل كانت مفيدة؟

المحلول

What about running the code in a debugger, setting the breakpoint at Tcl_Eval() (or whatever method your C code uses to call out into Tcl) then make your program call that piece of Tcl code and then examine the stack?

You'd need the debug build of your C code (with symbols); debugging version of the Tcl runtime would also make the stack trace more comprehensible.

FWIW, I failed to find any published API for traversing the stack trace here, so presumably it does not exist. Moreover, to traverse the stack on the C side, the Tcl runtime would need something like libunwind, and AFAIK Tcl does not have anything like this built-in.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top