Bug 23678

Summary: gdb won't exit if attached process disappears
Product: Base System Reporter: andy <andy>
Component: gnuAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description andy 2000-12-20 04:30:01 UTC
If gdb is attached to a process and that process subsequently exits
prior to gdb detaching then gdb fails to detach, issues an error
message and won't exit.  You have to kill gdb to quit.

Here's a sample of gdb's output at such a time,
(gdb) Quit
(gdb) The program is running.  Quit anyway (and detach it)? (y or n) y
Detaching from program: /home/andy/tmp/tstp, process 25834, thread 1
ptrace: No such process.
(gdb)

Fix: 

Seems likely to be a simple test of errno at the appropriate point.
How-To-Repeat: Attach to process in gdb. Have process exit. Then try to quit gdb.
Comment 1 Kip Macy 2002-01-07 20:28:56 UTC
Can you give an example of a program for which this
happens? When I try attaching to a running gdb (on 
4.5-PRERELEASE) and then exit out of the target gdb
it just says:
Program exited normally.
(gdb) quit


__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/
Comment 2 andy.newman 2002-01-07 23:06:11 UTC
Re-testing this shows the problem to have gone.   Updates over the 
months since
lodging seem to have fixed things.
Comment 3 Sheldon Hearn freebsd_committer freebsd_triage 2002-01-08 17:07:12 UTC
State Changed
From-To: open->feedback

Kip Macy has asked for more details, having failed to reproduce 
the problem locally.
Comment 4 Sheldon Hearn freebsd_committer freebsd_triage 2002-01-11 11:52:11 UTC
State Changed
From-To: feedback->closed

The originator reports that the problem has been resolved.