When running GDB in Emacs and sending SIGTSTP via C-c C-z to another
Emacs ran under GDB, the Emacs under GDB does not appear to receive
the SIGTSTP.
Recipe:
./src/emacs -Q
M-x gdb
gdb -i=mi src/emacs
run -Q
C-c C-z
[The Emacs under GDB is not stopped.]
However, when I run GDB from the shell rather than from Emacs:
gdb src/emacs
run -Q
C-z
[The Emacs under GDB stopped.]
I noticed src/.gdbinit has line:
handle SIGTSTP nopass
So I tried with and without this to no effect.
When I run with these debug statements:
diff --git a/src/process.c b/src/process.c
index 85470b6..176de75 100644
--- a/src/process.c
+++ b/src/process.c
@@ -5753,6 +5753,9 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group,
#else
sig_char = &t.c_cc[VSUSP];
#endif
+ { struct timespec debug_ts; char debug_dateStr[20]; { clock_gettime(CLOCK_REALTIME, &debug_ts); struct tm mytm; localtime_r(&debug_ts.tv_sec, &mytm); strftime(debug_dateStr, 20, "%Y-%m-%dT%H:%M:%S", &mytm); }
+ printf( "%s.%09ld|pid:%d|tid:%ld|%s|%d| DEBUG: sig_char=%02x\n", // TODO: debugging
+ debug_dateStr, debug_ts.tv_nsec, getpid(), pthread_self(), __FILE__, __LINE__, *sig_char ); fflush(stdout); }
break;
}
@@ -5901,6 +5904,9 @@ traffic. */)
#ifndef SIGTSTP
error ("No SIGTSTP support");
#else
+ { struct timespec debug_ts; char debug_dateStr[20]; { clock_gettime(CLOCK_REALTIME, &debug_ts); struct tm mytm; localtime_r(&debug_ts.tv_sec, &mytm); strftime(debug_dateStr, 20, "%Y-%m-%dT%H:%M:%S", &mytm); }
+ printf( "%s.%09ld|pid:%d|tid:%ld|%s|%d| DEBUG: Send SIGTSTP\n", // TODO: debugging
+ debug_dateStr, debug_ts.tv_nsec, getpid(), pthread_self(), __FILE__, __LINE__ ); fflush(stdout); }
process_send_signal (process, SIGTSTP, current_group, 0);
#endif
return process;
The output during the ill recipe is:
2014-02-13T14:11:49.438466000|pid:22430|tid:47532927609088|process.c|5909| DEBUG: Send SIGTSTP
2014-02-13T14:11:49.438547000|pid:22430|tid:47532927609088|process.c|5758| DEBUG: sig_char=1a
So the signal is being sent it seems. What might be the obstruction?
I am on RHEL 5, using latest Emacs from trunk and GDB 7.1.