From owner-freebsd-current@FreeBSD.ORG Wed Feb 4 22:44:53 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2A6B316A4CE for ; Wed, 4 Feb 2004 22:44:53 -0800 (PST) Received: from pd3mo3so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net [24.71.223.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 767AF43D46 for ; Wed, 4 Feb 2004 22:44:51 -0800 (PST) (envelope-from sdyoung@vt220.org) Received: from pd5mr1so.prod.shaw.ca (pd5mr1so-qfe3.prod.shaw.ca [10.0.141.232]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.18 (built Jul 28 2003)) with ESMTP id <0HSL00936MEDXE@l-daemon> for freebsd-current@freebsd.org; Wed, 04 Feb 2004 23:37:25 -0700 (MST) Received: from pn2ml6so.prod.shaw.ca (pn2ml6so-qfe0.prod.shaw.ca [10.0.121.150]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.18 (built Jul 28 2003)) with ESMTP id <0HSL003POMEDW2@l-daemon> for freebsd-current@freebsd.org; Wed, 04 Feb 2004 23:37:25 -0700 (MST) Received: from [10.0.0.2] (h68-144-59-39.cg.shawcable.net [68.144.59.39]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.18 (built Jul 28 2003)) with ESMTP id <0HSL00K2OMECI0@l-daemon> for freebsd-current@freebsd.org; Wed, 04 Feb 2004 23:37:24 -0700 (MST) Date: Wed, 04 Feb 2004 23:37:23 -0700 From: Steve Young To: freebsd-current@freebsd.org Message-id: MIME-version: 1.0 X-Mailer: Apple Mail (2.612) Content-type: text/plain; charset=US-ASCII; format=flowed Content-transfer-encoding: 7BIT Subject: gdb cores when stepping over fork() in 5.2-CURRENT. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Feb 2004 06:44:53 -0000 Hello all, I am running 5.2-CURRENT, freshly cvsup'ed this morning. While working on a problem with syslogd (more on that later if it turns out to be real), I found that whenever a fork() call is stepped over in gdb, the child process dies with signal 5 (trace trap). I'm not very familiar with gdb or how it sets breakpoints, so it's pure speculation but I wonder if perhaps it setting another breakpoint after the fork() call which is being caught in the parent process (which is attached to gdb), but the child process has nothing to handle it and so it dies with the default behavior, core dump. Anyway, here is the very simple sample program I am using to reproduce the problem. Just set a break on main and 'n'ext through it and you will see that the child never gets to print its' message, and your syslog will note the child process dying with signal 5. Thanks, Steve. /* forktest.c */ #include int main(int argc, char **argv) { int ret; printf("fork.\n"); ret = fork(); if(ret > 0) { printf("\nParent got child pid, %d.\n", ret); exit(0); } else if(ret < 0) { perror("error"); exit(0); } printf("\nChild working too: %d\n", ret); exit(0); }