OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 #===- lib/asan/scripts/asan_symbolize.py -----------------------------------===# | 2 #===- lib/asan/scripts/asan_symbolize.py -----------------------------------===# |
3 # | 3 # |
4 # The LLVM Compiler Infrastructure | 4 # The LLVM Compiler Infrastructure |
5 # | 5 # |
6 # This file is distributed under the University of Illinois Open Source | 6 # This file is distributed under the University of Illinois Open Source |
7 # License. See LICENSE.TXT for details. | 7 # License. See LICENSE.TXT for details. |
8 # | 8 # |
9 #===------------------------------------------------------------------------===# | 9 #===------------------------------------------------------------------------===# |
10 import bisect | 10 import bisect |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 def print_symbolized_lines(self, symbolized_lines): | 321 def print_symbolized_lines(self, symbolized_lines): |
322 if not symbolized_lines: | 322 if not symbolized_lines: |
323 print self.current_line | 323 print self.current_line |
324 else: | 324 else: |
325 for symbolized_frame in symbolized_lines: | 325 for symbolized_frame in symbolized_lines: |
326 print ' #' + str(self.frame_no) + ' ' + symbolized_frame.rstrip() | 326 print ' #' + str(self.frame_no) + ' ' + symbolized_frame.rstrip() |
327 self.frame_no += 1 | 327 self.frame_no += 1 |
328 | 328 |
329 def process_stdin(self): | 329 def process_stdin(self): |
330 self.frame_no = 0 | 330 self.frame_no = 0 |
331 for line in sys.stdin: | 331 while True: |
| 332 line = sys.stdin.readline() |
| 333 if not line: |
| 334 break |
332 self.current_line = line.rstrip() | 335 self.current_line = line.rstrip() |
333 #0 0x7f6e35cf2e45 (/blah/foo.so+0x11fe45) | 336 #0 0x7f6e35cf2e45 (/blah/foo.so+0x11fe45) |
334 stack_trace_line_format = ( | 337 stack_trace_line_format = ( |
335 '^( *#([0-9]+) *)(0x[0-9a-f]+) *\((.*)\+(0x[0-9a-f]+)\)') | 338 '^( *#([0-9]+) *)(0x[0-9a-f]+) *\((.*)\+(0x[0-9a-f]+)\)') |
336 match = re.match(stack_trace_line_format, line) | 339 match = re.match(stack_trace_line_format, line) |
337 if not match: | 340 if not match: |
338 print self.current_line | 341 print self.current_line |
339 continue | 342 continue |
340 if DEBUG: | 343 if DEBUG: |
341 print line | 344 print line |
(...skipping 11 matching lines...) Expand all Loading... |
353 self.print_symbolized_lines(symbolized_line) | 356 self.print_symbolized_lines(symbolized_line) |
354 | 357 |
355 | 358 |
356 if __name__ == '__main__': | 359 if __name__ == '__main__': |
357 opts, args = getopt.getopt(sys.argv[1:], "d", ["demangle"]) | 360 opts, args = getopt.getopt(sys.argv[1:], "d", ["demangle"]) |
358 for o, a in opts: | 361 for o, a in opts: |
359 if o in ("-d", "--demangle"): | 362 if o in ("-d", "--demangle"): |
360 demangle = True; | 363 demangle = True; |
361 loop = SymbolizationLoop() | 364 loop = SymbolizationLoop() |
362 loop.process_stdin() | 365 loop.process_stdin() |
OLD | NEW |