ThirdParty: build instructions for Ubuntu 12.04 32 bit: fixing typo
[openfoam-extend-OpenFOAM-1.6-ext.git] / bin / addr2line4Mac.py
blob7a97c1505c1dd779bbe9e1add78df2f8e81a5451
1 #! /usr/bin/python
3 import sys
4 filename=sys.argv[1]
5 address=sys.argv[2]
6 import re
8 import subprocess
10 p = subprocess.Popen("gdb -batch -x /dev/stdin",
11 shell=True,
12 bufsize=0,
13 stdin=subprocess.PIPE,
14 stdout=subprocess.PIPE,
15 close_fds=True)
17 (child_stdin, child_stdout) = (p.stdin, p.stdout)
18 child_stdin.write("set sharedlibrary preload-libraries no\n")
19 child_stdin.write("file "+filename+"\n")
20 child_stdin.write("info line *"+address+"\n")
21 result=child_stdout.readline()
23 answer="??:0"
25 match=re.compile('Line (.+) of "(.+)" starts at').match(result)
26 if match:
27 answer=match.group(2)+":"+match.group(1)
28 print answer,
30 sys.exit(255)