I’m a gdb noob, particularly as it relates to Tcl scripts. When I load gdb /opt/local/libexec/macports/bin/tclsh8.5 ./tclsh8.5.core
And set my breakpoint (gdb) break mktemp.c:99 And tell gdb to run, I get a tclsh prompt. If I launch /opt/local/bin/portindex I get [Detaching after fork from child process 85805] Creating port index in /opt/local/var/macports/sources/github.com/macports/macports-ports child killed: segmentation violation Needless to say, that’s already past the breakpoint. I also tried running expect -D 1 /opt/local/bin/portindex However, expect is compiled against a different version of tcl/tk and has no idea where the MacPorts package is "can't find package macports" Marius __ Marius Schamschula On Jun 23, 2021, 1:43 PM -0500, Rainer Müller <rai...@macports.org>, wrote: > On 19/06/2021 17.58, atmail.dreamhost.com wrote: > > Every now and then I try to get MacPorts to build and run on FreeBSD. > > > > Getting it to build requires less than a handful of edits. > > > > However, when running portindex I get a Segfault with a Signal 11. > > > > Here’s what gdb says (after recompiling with debug symbols enabled)" > > > [...] > > So it is failing at this point inside the Tcl_NewStringObj(): > https://github.com/macports/macports-base/blob/v2.7.1/src/pextlib1.0/mktemp.c#L99 > > gdb already tells us that the pointer 0xa51b60 doesn't look good. But > mktemp() is never supposed to return anything else than either the > pointer given or NULL [1]. > > Could you try to break in gdb here in line 99 (after the call to mktemp) > and compare the variables sp and template? They must point to the same > memory address. > > You could even check whether there is a proper C string terminated by > '\0' in memory... but actually gdb already told us it is not, because it > cannot access memory at this address. :-/ > > Rainer > > [1] https://www.freebsd.org/cgi/man.cgi?mktemp(3)