diff --git a/Makefile b/Makefile index dabe44b..e5a1a62 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,13 @@ # This is passed to pkg-config to determine which python to use. It # has to match your gdb. -all: gdb-gui.py gui/fix_signals.so +all: gdb-gui.py @: gdb-gui.py: gdb-gui.py.in sed -e "s,HERE,`pwd`," < gdb-gui.py.in > gdb-gui.py -gui/fix_signals.so: gui/fix-signals.c - pyver=`gdb -nx -batch -ex 'python print(sys.version_info.major)'`; \ - gcc -shared -fPIC -g -o gui/fix_signals.so gui/fix-signals.c `pkg-config --cflags python$$pyver` `pkg-config --libs python$$pyver` - clean: - -rm gdb-gui.py gui/fix_signals.so + -rm gdb-gui.py hack-gdbinit: all if test -f $$HOME/.gdbinit && `grep -q gdb-gui $$HOME/.gdbinit`; then \ diff --git a/gui/fix-signals.c b/gui/fix-signals.c deleted file mode 100644 index c962524..0000000 --- a/gui/fix-signals.c +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright (C) 2013, 2015 Tom Tromey - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include -#include - -static struct sigaction saved_action; - -static PyObject * -save_sigchld (PyObject *self, PyObject *args) -{ - sigset_t set; - - sigaction (SIGCHLD, NULL, &saved_action); - - sigemptyset (&set); - sigaddset (&set, SIGCHLD); - pthread_sigmask (SIG_BLOCK, &set, NULL); - - Py_RETURN_NONE; -} - -static PyObject * -restore_sigchld (PyObject *self, PyObject *args) -{ - sigset_t set; - - sigemptyset (&set); - sigaddset (&set, SIGCHLD); - pthread_sigmask (SIG_UNBLOCK, &set, NULL); - - sigaction (SIGCHLD, &saved_action, NULL); - Py_RETURN_NONE; -} - -static PyMethodDef methods[] = -{ - { "save", save_sigchld, METH_NOARGS, "Save SIGCHLD handler." }, - { "restore", restore_sigchld, METH_NOARGS, "Restores SIGCHLD handler." }, - { NULL, NULL, 0, NULL } -}; - -#if PY_MAJOR_VERSION >= 3 - -static struct PyModuleDef module = -{ - PyModuleDef_HEAD_INIT, - "fix_signals", - NULL, - -1, - methods, - NULL, - NULL, - NULL, - NULL -}; - -PyMODINIT_FUNC -PyInit_fix_signals (void) -{ - PyModule_Create (&module); -} - -#else - -PyMODINIT_FUNC -initfix_signals (void) -{ - Py_InitModule ("fix_signals", methods); -} - -#endif diff --git a/gui/startup.py b/gui/startup.py index e57e389..8974664 100644 --- a/gui/startup.py +++ b/gui/startup.py @@ -20,9 +20,6 @@ import os import os.path import gui -from . import fix_signals -fix_signals.save() - import gi gi.require_version('Gtk', '3.0') @@ -40,7 +37,7 @@ def send_to_gtk(func): # The payload is arbitrary. os.write(write_pipe, bytes(1)) -class _GtkThread(threading.Thread): +class _GtkThread(gdb.Thread): def handle_queue(self, source, condition): global _event_queue os.read(source, 1) @@ -71,7 +68,6 @@ def start_gtk(): _t = _GtkThread() _t.setDaemon(True) _t.start() - fix_signals.restore() def create_builder(filename): builder = Gtk.Builder()