Bläddra i källkod

Fix KeyboardInterrupt exception filtering.
Add exception information and not just the stack trace.
Make the url easier to change at runtime.

Review URL: http://codereview.chromium.org/2109001

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@47179 0039d316-1c4b-4281-b951-d872f2087c98

maruel@chromium.org 15 år sedan
förälder
incheckning
7aeac3ee34
1 ändrade filer med 11 tillägg och 4 borttagningar
  1. 11 4
      breakpad.py

+ 11 - 4
breakpad.py

@@ -13,14 +13,19 @@ import traceback
 import socket
 import sys
 
+# Configure these values.
+DEFAULT_URL = 'http://chromium-status.appspot.com/breakpad'
 
-def SendStack(stack, url='http://chromium-status.appspot.com/breakpad'):
+def SendStack(last_tb, stack, url=None):
+  if not url:
+    url = DEFAULT_URL
   print 'Sending crash report ...'
   try:
     params = {
         'args': sys.argv,
         'stack': stack,
         'user': getpass.getuser(),
+        'exception': last_tb,
     }
     request = urllib.urlopen(url, urllib.urlencode(params))
     print request.read()
@@ -30,9 +35,11 @@ def SendStack(stack, url='http://chromium-status.appspot.com/breakpad'):
 
 
 def CheckForException():
-  last_tb = getattr(sys, 'last_traceback', None)
-  if last_tb and sys.last_type is not KeyboardInterrupt:
-    SendStack(''.join(traceback.format_tb(last_tb)))
+  last_value = getattr(sys, 'last_value', None)
+  if last_value and not isinstance(last_value, KeyboardInterrupt):
+    last_tb = getattr(sys, 'last_traceback', None)
+    if last_tb:
+      SendStack(repr(last_value), ''.join(traceback.format_tb(last_tb)))
 
 
 if (not 'test' in sys.modules['__main__'].__file__ and