문제

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