Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Jan 2001 00:50:45 -0800 (PST)
From:      mheffner@vt.edu
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/24066: gdb can't detach from programs linked with libc_r
Message-ID:  <200101040850.f048ojJ64795@freefall.freebsd.org>
Resent-Message-ID: <200101040900.f04901r65639@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200101040850.f048ojJ64795>