diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-07-11 14:46:57 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-07-12 13:53:06 -0700 |
commit | 91e38285dc27e5dbac3291258342835fc3e90eab (patch) | |
tree | 9cb31e19c6eaff7dd7560bd77ea9371cf39f6d8c /scripts/clean_c_api_trace.py | |
parent | 6bb2deb73d48e3d0a773bc6018fb02aa8e36e48d (diff) | |
download | binaryen-91e38285dc27e5dbac3291258342835fc3e90eab.tar.gz binaryen-91e38285dc27e5dbac3291258342835fc3e90eab.tar.bz2 binaryen-91e38285dc27e5dbac3291258342835fc3e90eab.zip |
add a tracing option to the c api, which logs out a runnable program from c api calls
Diffstat (limited to 'scripts/clean_c_api_trace.py')
-rwxr-xr-x | scripts/clean_c_api_trace.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/scripts/clean_c_api_trace.py b/scripts/clean_c_api_trace.py new file mode 100755 index 000000000..efe8baa43 --- /dev/null +++ b/scripts/clean_c_api_trace.py @@ -0,0 +1,23 @@ +#! /usr/bin/env python + +''' +Cleans up output from the C api, makes a runnable C file +''' + +import sys + +trace = open(sys.argv[1]).read() + +start = trace.find('// beginning a Binaryen API trace') +if start >= 0: + trace = trace[start:] + + while 1: + start = trace.find('\n(') + if start < 0: + break + end = trace.find('\n)', start + 1) + assert end > 0 + trace = trace[:start] + trace[end + 2:] + + print trace |