This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFA] Patch to correct problem with 'detach' on Tru64


We have found that the patch below fixes a problem on the Tru64 target
(OSF5.1).  The sequence of commands

     (gdb) attach <pid>
     (gdb) break foo
     (gdb) cont
     ... Breakpoint hit
     (gdb) detach

continues the inferior, only to have it crash immediately with a SIGTRAP 
signal.  The fix appears to be to clear the current signal (currently, the
comment says "clear the signal", but the code clears the pending FAULT. 

By the way, in looking at the code, I was left with a few questions about
this command on all targets:

a) Why is the optional argument to detach (a signal) undocumented?
b) Was it, after all, intended that the current signal be left unchanged
   when the argument to detach is "0" or defaulted?

P. Hilfinger
ACT, Inc.

2002-06-05  Paul N. Hilfinger  <hilfingr@otisco.mckusick.com>

	* procfs.c (do_detach): Clear current signal, not just fault.  Corrects
	problem with breakpoint trap signal leaking to detached process on
	Tru64.

Index: gdb/procfs.c
===================================================================
RCS file: /cvs/src/src/gdb/procfs.c,v
retrieving revision 1.37
diff -u -p -r1.37 procfs.c
--- gdb/procfs.c	14 Feb 2002 01:57:36 -0000	1.37
+++ gdb/procfs.c	5 Jun 2002 08:04:13 -0000
@@ -3623,6 +3623,9 @@ do_detach (int signo)
 	if (!proc_clear_current_fault (pi))
 	  proc_warn (pi, "do_detach, clear_current_fault", __LINE__);
 
+	if (signo == 0 && !proc_clear_current_signal (pi))
+	  proc_warn (pi, "do_detach, clear_current_signal", __LINE__);
+
 	if (!proc_set_run_on_last_close (pi))
 	  proc_warn (pi, "do_detach, set_rlc", __LINE__);
       }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]