0
votes

I have a project written in C and Tcl and I'm trying to debug it. The main part is written in C, and GUI is written in Tcl. I'm new to Tcl. I tried to use lldb to debug it, but as soon as the C program calls

Tk_Main(TKARGS, myargv, Tcl_AppInit);

lldb does not work at all, even if some Tcl commands are written in C. How can I debug it?

1
What does "not work" mean? Can you set a breakpoint in a C-function & it will be reached?deets
Thank you, I didn't try breakpoints before and just tried to step through the code. Breakpoints work.user3323258
@deets: That should be an answer. Perhaps with a comment about events being asynchronous and the event loop running when nothing else is running making it necessary to debug using breakpoints?slebetman
But my program has a bug and when using lldb, it crashes at some assembly code. I think it might be the Tcl part. How can I debug the Tcl part?user3323258
You jump to conclusions. What does the stacktrace say? Use the "bt"commanddeets

1 Answers

1
votes

When debugging C/C++ and a scripting-language together, you can't expect LLDB to know how to source-level-debug both. It only knows about C/C++ (or more precisely, DWARF-symbols).

Thus if you expect your C-code to be faulty when being invoked from within the Script-language, you need to set a breakpoint & then operate the program to trigger the call.

When crashes appear, you should use the "bt"-command to get a clue where in the stacktrace you are, and investigate further using breakpoints.