From a8ab774aec55fc200859a1c3b9202080093d1d30 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 15 Feb 2011 15:15:51 -0500 Subject: Cope with backtraces where the thread says "Thread 0xb78516c0 (LWP 17355)", rather than just a decimal --- backtrace.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'backtrace.py') diff --git a/backtrace.py b/backtrace.py index 8d33577..57e907e 100644 --- a/backtrace.py +++ b/backtrace.py @@ -17,9 +17,9 @@ class Thread(object): ''' Class representing a thread within a backtrace ''' - def __init__(self, index, pid): + def __init__(self, index, extra): self.index = index - self.pid = pid + self.extra = extra self.frames = {} self.framelist = [] @@ -27,27 +27,26 @@ class Backtrace(object): ''' Class representing a parsed backtrace ''' - def __init__(self, string): + def __init__(self, string, debug=False): ''' Parse the given string (from gdb) ''' - debug = False self._string = string - if debug: - print string + #if debug: + # print string self._crash_site = None self._thread = None self._threads = {} self._frame = None for line in string.splitlines(): if debug: - print repr(line) - m = re.match('^Thread ([0-9]+) \(Thread ([0-9]+)\):$', line) + print 'GOT LINE: %r' % line + m = re.match('^Thread ([0-9]+) \(Thread (.*)\):$', line) if m: if debug: print 'THREAD START:', m.groups() self._thread = Thread(int(m.group(1)), - int(m.group(2))) + m.group(2)) self._threads[self._thread.index] = self._thread self._frame = None continue @@ -67,6 +66,8 @@ class Backtrace(object): m.group(4)) if self._thread is None: + if debug: + print 'GOT CRASH SITE' self._crash_site = f self._frame = None continue -- cgit