From owner-freebsd-bugs Thu Jan 4 1: 0: 6 2001 From owner-freebsd-bugs@FreeBSD.ORG Thu Jan 4 01:00:02 2001 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id F00BD37B402 for ; Thu, 4 Jan 2001 01:00:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f04901r65639; Thu, 4 Jan 2001 01:00:01 -0800 (PST) (envelope-from gnats) Resent-Date: Thu, 4 Jan 2001 01:00:01 -0800 (PST) Resent-Message-Id: <200101040900.f04901r65639@freefall.freebsd.org> Resent-From: gnats-admin@FreeBSD.org (GNATS Management) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: gnats-admin@FreeBSD.org, mheffner@vt.edu Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 8754637B400 for ; Thu, 4 Jan 2001 00:50:45 -0800 (PST) Received: (from nobody@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f048ojJ64795; Thu, 4 Jan 2001 00:50:45 -0800 (PST) (envelope-from nobody) Message-Id: <200101040850.f048ojJ64795@freefall.freebsd.org> Date: Thu, 4 Jan 2001 00:50:45 -0800 (PST) From: mheffner@vt.edu Sender: nobody@FreeBSD.org To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: bin/24066: gdb can't detach from programs linked with libc_r Resent-Sender: gnats@FreeBSD.org Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 24066 >Category: bin >Synopsis: gdb can't detach from programs linked with libc_r >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Jan 04 01:00:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Mike Heffner >Release: 5-current >Organization: >Environment: 5.0-CURRENT #0: Tue Jan 2 19:45:37 EST 2001 i386 >Description: Gdb can't detach from a program that's linked with libc_r. It gives the message "ptrace: No such process". The same program linked with libc can be attached/detached fine. The only way to quit gdb is to kill it. By sprinkling the code with printf()s it looks like variable `inferior_pid' (which is passed to ptrace() when detaching) is getting changed. For example, it'll go from say 41694 -> 172766. I tracked it down to a location in gnu/usr.bin/binutils/gdb/freebsd-uthread.c line 429: inferior_pid = find_active_thread (); Unfortunately, after that point it's over my head so I can't really figure out where it's going wrong. >How-To-Repeat: Compile the following program: main(){ printf("pid: %d\n", getpid()); while(1) sleep(1); } twice with: gcc -o test1 test.c gcc -o test2 test.c -pthread and try attaching/detaching from it, the first one will succeed, the second won't. >Fix: Don't know. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message