Segfaults on FreeBSD

Marius Schamschula lists at schamschula.com
Thu Jun 24 23:58:56 UTC 2021


Rainer,

Thanks for the hints!

Here’s what I get:

(gdb)  break mktemp.c:99
Breakpoint 1 at 0x801290036: file mktemp.c, line 99.
(gdb) r
Starting program: /opt/local/libexec/macports/bin/tclsh8.5
% /opt/local/bin/portindex
[Attaching after LWP 114537 of process 29657 fork to child LWP 106805 of process 29675]
[New inferior 2 (process 29675)]
process 29675 is executing new program: /opt/local/libexec/macports/bin/tclsh8.5
Reading symbols from /opt/local/libexec/macports/bin/tclsh8.5...
Reading symbols from /opt/local/libexec/macports/lib/libtcl8.5.so...
Reading symbols from /opt/local/libexec/macports/lib/macports1.0/MacPorts.so...
Reading symbols from /opt/local/libexec/macports/lib/pextlib1.0/Pextlib.so...
Reading symbols from /opt/local/libexec/macports/lib/registry2.0/registry.so...
Reading symbols from /opt/local/libexec/macports/lib/tclx8.4/libtclx8.4.so...
Reading symbols from /opt/local/libexec/macports/lib/machista1.0/machista.so...
Creating port index in /opt/local/var/macports/sources/github.com/macports/macports-ports
[Switching to LWP 106805 of process 29675]

Thread 2.1 hit Breakpoint 1, MktempCmd (clientData=<optimized out>, interp=0x800a52550, objc=<optimized out>, objv=<optimized out>) at mktemp.c:99
99		tcl_result = Tcl_NewStringObj(sp, -1);
(gdb) p sp
$1 = 0xa51b60 <error: Cannot access memory at address 0xa51b60>
(gdb) p template
$2 = 0x800a51b60 "/tmp/mports.portindex.jSKMYigM"

Marius
__
Marius Schamschula
On Jun 24, 2021, 3:24 PM -0500, Rainer Müller <raimue at macports.org>, wrote:
> On 24/06/2021 03.30, Marius Schamschula wrote:
> > I’m a gdb noob, particularly as it relates to Tcl scripts.
>
> Of course you could also achieve the same checks by adding some printf
> statements to the C source. :-)
>
> > 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
>
> By default, gdb will only debug the parent process across a fork. You
> can change this with the following commands before running the program:
>
> set follow-fork-mode child
> set detach-on-fork off
>
> This way gdb will stay attached to all processes that are forked and
> also to the parent. You can view them with 'info inferior' and switch
> between them with 'inferior <n>'.
>
> Rainer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20210624/87178c45/attachment.htm>


More information about the macports-dev mailing list