NetBSD Problem Report #59027

From www@netbsd.org  Fri Jan 24 11:46:40 2025
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 7C6171A923A
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 24 Jan 2025 11:46:40 +0000 (UTC)
Message-Id: <20250124114639.81BE81A923B@mollari.NetBSD.org>
Date: Fri, 24 Jan 2025 11:46:39 +0000 (UTC)
From: ps@softinengines.com
Reply-To: ps@softinengines.com
To: gnats-bugs@NetBSD.org
Subject: gdb not able to debug forked child
X-Send-Pr-Version: www-1.0

>Number:         59027
>Category:       toolchain
>Synopsis:       gdb not able to debug forked child
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 24 11:50:00 +0000 2025
>Originator:     Peter Skvarka
>Release:        10.1
>Organization:
Soft in Engines
>Environment:
NetBSD bsd.lan 10.1 NetBSD 10.1 (GENERIC)
>Description:
Gdb cannot step through through code in forked child's code.
Cannot stop on breakpoint in forked child code.
>How-To-Repeat:
In my case it happens in multithreaded application. Note that application fork() is called from main thread in time when other threads already exists

How to repeat:

put breakpoint on fork() call, for example:
b sourcename.cpp:LINENUM

gdb stops on fork()

then:
set follow-fork-mode child

and try to step through forked child code.
The result is:
It is possible to step only one or two lines and the gdb jumps to forked parent.

I tried also to call "set follow-fork-mode child" after gdb started and before program is run, behavior is the same.
======================================
Relating problem: gdb does not stop on breakpoint in forked child code.



>Fix:
No ideas

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.49 2026/05/14 01:52:41 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.