|
From: Phillip B. <phi...@um...> - 2025-10-24 00:10:34
|
Thanks Kevin, I am pretty familiar with gdb and debugging Tcl in a Linux environment. The gdb-lldb guide will be useful, but that isn’t where I am hung up. I am hung up on these two questions: What configure and build options will give me source level debugging on a MacOS tclsh build? Where is the debug version of tclsh after I do that build? Do I need to do anything special to avoid MacOS security (I.e. signing things)? Phil On Thu, Oct 23, 2025 at 4:22 PM Kevin Walzer <kw...@co...> wrote: > Debugging a Tcl extension written in C using gdb > <https://wiki.tcl-lang.org/page/Debugging+a+Tcl+extension+written+in+C+using+gdb?R=0> > wiki.tcl-lang.org > <https://wiki.tcl-lang.org/page/Debugging+a+Tcl+extension+written+in+C+using+gdb?R=0> > [image: favicon.ico] > <https://wiki.tcl-lang.org/page/Debugging+a+Tcl+extension+written+in+C+using+gdb?R=0> > <https://wiki.tcl-lang.org/page/Debugging+a+Tcl+extension+written+in+C+using+gdb?R=0> > > This is a guide to using gdb with Tcl. > > GDB and LLDB Command Examples > <https://developer.apple.com/library/archive/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-command-examples.html> > developer.apple.com > <https://developer.apple.com/library/archive/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-command-examples.html> > [image: apple-touch-icon-precomposed.png] > <https://developer.apple.com/library/archive/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-command-examples.html> > <https://developer.apple.com/library/archive/documentation/IDEs/Conceptual/gdb_to_lldb_transition_guide/document/lldb-command-examples.html> > > This is a gdb-lldb translation guide. > > On Oct 23, 2025, at 6:43 PM, Phillip Brooks <phi...@um...> wrote: > > > > Can anyone point me toward a guide to running lldb on a built Tcl > executable on MacOS 26 Arm64? I found: > > https://wiki.tcl-lang.org/page/Tcl+on+MacOS > > on the wiki, but it seems more interested in wish than in Tcl, and also in > exercising the full MacOS App mechanism and running Wish.app. There isn't > much there about running the debugger and even less about tclsh. I have > successfully built tclsh, and can invoke it under lldb, set breakpoints, > run etc. but I seem unable to get a debug version of the file that I am > trying to look at (tclParse.c). I can see source code around the call to > Tcl_Main, but not at lower levels of the stack. When I stop, say in > Tcl_ParseVarName, I just see assembly code. > > Can you describe how to build, invoke lldb, set a breakpoint at > Tcl_ParseVarName and then have the debugger show source code for > Tcl_ParseVarName? > > Here is a detailed runthrough of what I last tried: > > I used the make command: > > $ CONFIGURE_ARGS="--enable-symbols" make -f GNUmakefile > > inside of the macosx directory, then ran lldb: > > $ lldb ../../build/tcl/Development//usr/local/bin/Development/tclsh > > I ran that tclsh in another shell window and I used the attach <pid> > command to attach to my running tclsh (I want to be able to type into Tcl > and debug from another window at the same time), though I get the same > result when I just use the run command from inside lldb. > > Typed "b Tcl_ParseVarName" and successfully set the breakpoint. > > Typed continue, but when it stops in Tcl_ParseVarName, I see only assembly > code, no source. If I type list, I see source code, but it is only for the > call to Tcl_Main. I can't go down the stack without diving into assembly > code. I am thinking that I have only partial debug code for some reason, > but I don't know enough about how the MacOS build works to know what is > where and how it got there. It seems that things are built a couple times > by default. > > I am running on MacOS 26 - newly installed, and have never tried running a > debugger on MacOS before (my previous experience is all on Linux). I am > also trying to build something close to the tip of Tcl 9.1 - i.e. the main > branch. I am a complete newbie concerning things like codesigning etc. > > Phil > > _______________________________________________ > Tcl-mac mailing list > tc...@li... > https://lists.sourceforge.net/lists/listinfo/tcl-mac > > |