(self)
| 328 | self.frame_no += 1 |
| 329 | |
| 330 | def process_stdin(self): |
| 331 | self.frame_no = 0 |
| 332 | |
| 333 | if sys.version_info[0] == 2: |
| 334 | sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) |
| 335 | else: |
| 336 | # Unbuffered output is not supported in Python 3 |
| 337 | sys.stdout = os.fdopen(sys.stdout.fileno(), 'w') |
| 338 | |
| 339 | while True: |
| 340 | line = sys.stdin.readline() |
| 341 | if not line: break |
| 342 | self.current_line = line.rstrip() |
| 343 | #0 0x7f6e35cf2e45 (/blah/foo.so+0x11fe45) |
| 344 | stack_trace_line_format = ( |
| 345 | r'^( *#([0-9]+) *)(0x[0-9a-f]+) *\((.*)\+(0x[0-9a-f]+)\)') |
| 346 | match = re.match(stack_trace_line_format, line) |
| 347 | if not match: |
| 348 | print(self.current_line) |
| 349 | continue |
| 350 | if DEBUG: |
| 351 | print(line) |
| 352 | _, frameno_str, addr, binary, offset = match.groups() |
| 353 | if frameno_str == '0': |
| 354 | # Assume that frame #0 is the first frame of new stack trace. |
| 355 | self.frame_no = 0 |
| 356 | original_binary = binary |
| 357 | if self.binary_name_filter: |
| 358 | binary = self.binary_name_filter(binary) |
| 359 | symbolized_line = self.symbolize_address(addr, binary, offset) |
| 360 | if not symbolized_line: |
| 361 | if original_binary != binary: |
| 362 | symbolized_line = self.symbolize_address(addr, binary, offset) |
| 363 | self.print_symbolized_lines(symbolized_line) |
| 364 | |
| 365 | |
| 366 | if __name__ == '__main__': |
no test coverage detected