extras-buildsys/utils plague-debug-get-traceback.py,1.1,1.2

Daniel Williams (dcbw) fedora-extras-commits at redhat.com
Tue Nov 29 06:41:59 UTC 2005


Author: dcbw

Update of /cvs/fedora/extras-buildsys/utils
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv28008/utils

Added Files:
	plague-debug-get-traceback.py 
Log Message:
2005-11-29  Dan Williams  <dcbw at redhat.com>

    * Add a traceback server that listens on a Unix socket
        and writes backtraces for all threads to it.  Disabled
        by default.




Index: plague-debug-get-traceback.py
===================================================================
RCS file: plague-debug-get-traceback.py
diff -N plague-debug-get-traceback.py
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ plague-debug-get-traceback.py	29 Nov 2005 06:41:57 -0000	1.2
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+# 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 Library 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2005 Dan Williams <dcbw at redhat.com> and Red Hat, Inc.
+
+import socket
+import sys, os
+
+
+if len(sys.argv) < 2:
+    print "Need the address to grab traceback from."
+    os._exit(1)
+
+addr = sys.argv[1] 
+s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+s.connect(addr)
+s.settimeout(2.0)
+
+tb = ''
+while True:
+    try:
+        text = s.recv(1000)
+        if len(text) == 0:
+            break
+        tb = tb + text
+    except socket.error, e:
+        if e[0] == 11:  # Resource temporarily unavailable
+            continue
+        break
+
+print tb
+
+s.close()




More information about the fedora-extras-commits mailing list