pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp/src/ui ChangeLog automake.mk terminal/Chan...


From: John Darrington
Subject: [Pspp-cvs] pspp/src/ui ChangeLog automake.mk terminal/Chan...
Date: Thu, 16 Nov 2006 12:47:22 +0000

CVSROOT:        /sources/pspp
Module name:    pspp
Changes by:     John Darrington <jmd>   06/11/16 12:47:22

Modified files:
        src/ui         : ChangeLog automake.mk 
        src/ui/terminal: ChangeLog main.c 
Added files:
        src/ui         : debugger.c debugger.h 

Log message:
        Apply patch #5561. Connect debugger on error. 

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/ChangeLog?cvsroot=pspp&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/automake.mk?cvsroot=pspp&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/debugger.c?cvsroot=pspp&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/debugger.h?cvsroot=pspp&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/terminal/ChangeLog?cvsroot=pspp&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/terminal/main.c?cvsroot=pspp&r1=1.21&r2=1.22

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/pspp/pspp/src/ui/ChangeLog,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- ChangeLog   17 Jul 2006 10:45:43 -0000      1.2
+++ ChangeLog   16 Nov 2006 12:47:22 -0000      1.3
@@ -1,3 +1,7 @@
+Thu Nov 16 20:44:58 WST 2006 John Darrington <address@hidden>
+
+       * debugger.c debugger.h New files.
+
 Mon Jul 17 18:22:18 WST 2006 John Darrington <address@hidden>
 
        * flexifile.c flexifile.h: New files. Implementations of casefiles.

Index: automake.mk
===================================================================
RCS file: /sources/pspp/pspp/src/ui/automake.mk,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- automake.mk 17 Jul 2006 10:45:43 -0000      1.1
+++ automake.mk 16 Nov 2006 12:47:22 -0000      1.2
@@ -9,5 +9,7 @@
 noinst_LIBRARIES += src/ui/libuicommon.a
 
 src_ui_libuicommon_a_SOURCES = \
+       src/ui/debugger.c \
+       src/ui/debugger.h \
        src/ui/flexifile.c \
        src/ui/flexifile.h

Index: terminal/ChangeLog
===================================================================
RCS file: /sources/pspp/pspp/src/ui/terminal/ChangeLog,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- terminal/ChangeLog  7 Nov 2006 12:59:59 -0000       1.15
+++ terminal/ChangeLog  16 Nov 2006 12:47:22 -0000      1.16
@@ -1,3 +1,7 @@
+Thu Nov 16 20:46:35 WST 2006 John Darrington <address@hidden>
+
+       * main.c: Connect debugger on errors.
+
 Tue Nov  7 20:54:32 WST 2006 John Darrington <address@hidden>
 
        * command-line.c msg-ui.c msg-ui.h main.c: Added an -e

Index: terminal/main.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/terminal/main.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- terminal/main.c     14 Nov 2006 11:47:17 -0000      1.21
+++ terminal/main.c     16 Nov 2006 12:47:22 -0000      1.22
@@ -22,6 +22,7 @@
 #include <signal.h>
 #include <stdio.h>
 
+#include <ui/debugger.h>
 #include "command-line.h"
 #include "msg-ui.h"
 #include "progname.h"
@@ -153,6 +154,9 @@
 void 
 bug_handler(int sig)
 {
+#if DEBUGGING
+  connect_debugger ();
+#endif
   switch (sig) 
     {
     case SIGABRT:

Index: debugger.c
===================================================================
RCS file: debugger.c
diff -N debugger.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ debugger.c  16 Nov 2006 12:47:22 -0000      1.1
@@ -0,0 +1,67 @@
+/* PSPP - computes sample statistics.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   Written by John Darrington <address@hidden>
+
+   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 2 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, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA. */
+
+#include <config.h>
+
+#include <errno.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/wait.h>
+
+
+#include "debugger.h"
+
+/* Fork, start gdb and connect to the parent process. 
+   If that happens successfully, then this function does not return,
+   but exits with EXIT_FAILURE. Otherwise it returns.
+ */
+   
+void
+connect_debugger (void)
+{
+  char pidstr[20];
+  pid_t pid;
+
+  snprintf (pidstr, 20, "%d", getpid ());
+  pid = fork ();
+  if ( pid  == -1 ) 
+    {
+      perror ("Cannot fork");
+      return ;
+    }
+  if ( pid == 0 ) 
+    {
+      /* child */
+      execlp ("gdb", "gdb", "-p", pidstr, NULL);
+      perror ("Cannot exec debugger");
+      exit (EXIT_FAILURE);
+    }
+  else
+    {
+      int status;
+      wait (&status);
+      if ( EXIT_SUCCESS != WEXITSTATUS (status) ) 
+       return ;
+    }
+  
+  exit (EXIT_FAILURE);
+}
+

Index: debugger.h
===================================================================
RCS file: debugger.h
diff -N debugger.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ debugger.h  16 Nov 2006 12:47:22 -0000      1.1
@@ -0,0 +1,29 @@
+/* PSPP - computes sample statistics.
+   Copyright (C) 2006 Free Software Foundation, Inc.
+   Written by John Darrington <address@hidden>
+
+   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 2 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, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA. */
+
+#ifndef DEBUGGER_H
+#define DEBUGGER_H
+
+
+/* Fork, start gdb and connect to the parent process. 
+   Exit with EXIT_FAILURE.
+ */
+void connect_debugger (void) ;
+
+#endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]