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