all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: nickrob@snap.net.nz (Nick Roberts)
To: Hannu Koivisto <azure@iki.fi>
Cc: 4437@emacsbugs.donarmstrong.com, emacs-pretest-bug@gnu.org
Subject: bug#4437: 23.1.50; Quitting gdb leaves a process behind
Date: Tue, 22 Sep 2009 17:36:05 +1200 (NZST)	[thread overview]
Message-ID: <20090922053605.782A1C167@totara> (raw)
In-Reply-To: <83zl8se82t.fsf@kalahari.s2.org>

 > > If you want to run the same, but possibly newly compiled executable it's
 > > generally best not to quit GDB.  GDB will automatically load the new code
 > > and it has the advantage of keeping shell history, breakpoints etc.  You
 > > may need to change the line numbers on some breakpoints if the surrounding
 > > code has changed. 
 > 
 > Did you mean to give this advice as a workaround for the leakage
 > problem?  

No.  I mean there's generally no need to type 'quit' in the GUD buffer.
I've reverted an inadvertant change, so any recent problems (last few
days) should disappear.  It's still not ideal and you can find further
problems if you look for them

 >           Sure.  I can even restart Emacs, I have no problem living
 > with the problem till it gets fixed.

It should now be enough to kill the GUD buffer.

 > As a general comment to this history stuff, it wouldn't be a bad
 > feature if Emacs could provide history and breakpoint persistence
 > over gud/gdb sessions.

I think it might be hard to implement.  GDB has it's own history on the
command line using:

set history save on

Now Emacs uses GDB/MI, commands from the GUD buffer don't go into that
history so Emacs would need to emulate GDB's behaviour.

 > For what it's worth, I now know how to reproduce this one.  All I
 > need to do in addition to what I did to reproduce the leakage
 > problem is to set a temporary breakpoint to main function and "run"
 > to it before invoking quit.

I think this is related to the change I made to process.c below. This allows
the I/O buffer to work when the inferior is restarted but means that
status_notify isn't called from wait_reading_process_output because this call
is conditioned on select which returns a positive value (presumably because the
pty's file descriptor hasn't been cleared).  Reverting it means processes aren't
left lying around but that leaves the original problem.

I mention this in case someone who knows process.c better than me can see a
way around it.

-- 
Nick                                           http://www.inet.net.nz/~nickrob


Index: process.c
===================================================================
RCS file: /sources/emacs/emacs/src/process.c,v
retrieving revision 1.594
retrieving revision 1.595
diff -c -p -r1.594 -r1.595
*** process.c	27 Aug 2009 11:12:54 -0000	1.594
--- process.c	30 Aug 2009 04:54:34 -0000	1.595
*************** wait_reading_process_output (time_limit,
*** 5150,5160 ****
  		 It can't hurt.  */
  	      else if (nread == -1 && errno == EIO)
  		{
! 		  /* Clear the descriptor now, so we only raise the signal once.  */
! 		  FD_CLR (channel, &input_wait_mask);
! 		  FD_CLR (channel, &non_keyboard_wait_mask);
  
! 		  kill (getpid (), SIGCHLD);
  		}
  #endif /* HAVE_PTYS */
  	      /* If we can detect process termination, don't consider the process
--- 5150,5165 ----
  		 It can't hurt.  */
  	      else if (nread == -1 && errno == EIO)
  		{
! 		  /* Clear the descriptor now, so we only raise the
! 		     signal once.  Don't do this is `process' is only
! 		     a pty.  */
! 		  if (XPROCESS (proc)->pid != -2)
! 		    {
! 		      FD_CLR (channel, &input_wait_mask);
! 		      FD_CLR (channel, &non_keyboard_wait_mask);
  
! 		      kill (getpid (), SIGCHLD);
! 		    }
  		}
  #endif /* HAVE_PTYS */
  	      /* If we can detect process termination, don't consider the process






  reply	other threads:[~2009-09-22  5:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-14 20:54 bug#4437: 23.1.50; Quitting gdb leaves a process behind Hannu Koivisto
2009-09-16  2:00 ` Nick Roberts
2009-09-18 12:44   ` Hannu Koivisto
2009-09-22  5:36     ` Nick Roberts [this message]
2012-04-20  6:40 ` Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090922053605.782A1C167@totara \
    --to=nickrob@snap.net.nz \
    --cc=4437@emacsbugs.donarmstrong.com \
    --cc=azure@iki.fi \
    --cc=emacs-pretest-bug@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.