summaryrefslogtreecommitdiffstats
path: root/compiler-rt
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2012-07-31 13:51:26 +0000
committerAlexander Potapenko <glider@google.com>2012-07-31 13:51:26 +0000
commit8aae9557d649f6ccd5702353d41231578e5a5ece (patch)
tree331f67fa0551c27545bdc9f52aac2d38ec1ae9bc /compiler-rt
parent500e99639d91b8196741df2e0b98ff99499506b5 (diff)
downloadbcm5719-llvm-8aae9557d649f6ccd5702353d41231578e5a5ece.tar.gz
bcm5719-llvm-8aae9557d649f6ccd5702353d41231578e5a5ece.zip
Factor out the main() function.
llvm-svn: 161046
Diffstat (limited to 'compiler-rt')
-rwxr-xr-xcompiler-rt/lib/asan/scripts/asan_symbolize.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/compiler-rt/lib/asan/scripts/asan_symbolize.py b/compiler-rt/lib/asan/scripts/asan_symbolize.py
index e4897d0c764..346dba12224 100755
--- a/compiler-rt/lib/asan/scripts/asan_symbolize.py
+++ b/compiler-rt/lib/asan/scripts/asan_symbolize.py
@@ -17,6 +17,7 @@ pipes = {}
filetypes = {}
DEBUG=False
+
def fix_filename(file_name):
for path_to_cut in sys.argv[1:]:
file_name = re.sub(".*" + path_to_cut, "", file_name)
@@ -116,12 +117,18 @@ def symbolize_atos(line):
else:
print line.rstrip()
-system = os.uname()[0]
-if system in ['Linux', 'Darwin']:
- for line in sys.stdin:
- if system == 'Linux':
- symbolize_addr2line(line)
- elif system == 'Darwin':
- symbolize_atos(line)
-else:
- print 'Unknown system: ', system
+
+def main():
+ system = os.uname()[0]
+ if system in ['Linux', 'Darwin']:
+ for line in sys.stdin:
+ if system == 'Linux':
+ symbolize_addr2line(line)
+ elif system == 'Darwin':
+ symbolize_atos(line)
+ else:
+ print 'Unknown system: ', system
+
+
+if __name__ == '__main__':
+ main()
OpenPOWER on IntegriCloud