Segfaults on FreeBSD

Rainer Müller raimue at macports.org
Thu Jun 24 20:24:25 UTC 2021


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


More information about the macports-dev mailing list