Issue #4 resolved

Does not symbolicate threads that occur before the crashed thread

Dave Dribin
created an issue

Only the addresses between the "Thread XX Crashed:" line and the "Thread State" line are symbolicated. If thread 2 crashed, then threads 0 and 1 are not symbolicated.

Comments (3)

  1. Dave Dribin reporter

    I have a potential fix for that works on one of my crash logs. Instead of:

    	elif line_stripped.startswith('Thread ') and line_stripped.endswith(' Crashed:'):
    		is_in_backtrace = True
    		backtrace_lines.append(line)
    

    A regular expression would be more flexible:

    	elif re.match('Thread \d+( Crashed)?:', line_stripped):
    		is_in_backtrace = True
    		backtrace_lines.append(line)
    

    If that sounds good, I'll commit it.

  2. Peter Hosey repo owner
    • changed milestone to 1.0.2

    I prefer using pre-compiled expression objects, especially when loops are involved. You'd use re.compile near the top of the function (probably in a new paragraph between the global variables and the local state variables), and assign the returned object to a variable such as thread_trace_start_exp. Then, the conditional statement becomes elif thread_trace_start_exp.match(line_stripped).

    Also, the expression should use ^ and $. (The `match` method will imply ^, of course, but you know what the Zen of Python says about explicit vs. implicit. ☺)

    Other than these minor details, that sounds like the correct fix.

  3. Log in to comment