run: generalize with main(), start porting trace-boot and qemu-trace2txt

This commit is contained in:
Ciro Santilli
2018-09-04 09:22:46 +01:00
parent 09cb390904
commit 1ff6a95ab3
10 changed files with 547 additions and 453 deletions

View File

@@ -1,14 +1,27 @@
#!/usr/bin/env bash
. "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/common"
while getopts "${common_getopts_flags}" OPT; do
case "$OPT" in
?)
common_getopts_case "$OPT"
;;
esac
done
common_setup
./qemu/scripts/simpletrace.py \
"${common_build_dir}/host-qemu-custom/trace-events-all" \
"${common_qemu_run_dir}/trace.bin" \
> "${common_trace_txt_file}"
#!/usr/bin/env python3
import os
import subprocess
import sys
import common
def main():
cmd = [
os.path.join(common.qemu_src_dir, 'scripts/simpletrace.py'),
os.path.join(common.qemu_build_dir, 'trace-events-all'),
os.path.join(common.qemu_trace_file),
]
return common.run_cmd(
cmd,
cmd_file=os.path.join(common.run_dir, 'qemu-trace2txt'),
out_file=common.qemu_trace_txt_file,
show_stdout=False,
)
if __name__ == '__main__':
parser = common.get_argparse(argparse_args={
'description': 'Convert a QEMU `-trace exec_tb` to text form.'
})
args = common.setup(parser)
sys.exit(main())