CliFunction

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-01-22 00:00:00 +00:00
parent 3b0a343647
commit a5ec63dc28
39 changed files with 2630 additions and 2399 deletions

View File

@@ -13,23 +13,24 @@ import subprocess
import sys
import common
from shell_helpers import LF
parser = common.get_argparse(argparse_args={
parser = self.get_argparse(argparse_args={
'description': 'Convert an execution trace containing PC values into the Linux kernel linex executed'
})
args = common.setup(parser)
args = self.setup(parser)
sys.exit(subprocess.Popen([
os.path.join(common.root_dir, 'trace2line.sh'),
'true' if common.emulator == 'gem5' else 'false',
common.trace_txt_file,
common.get_toolchain_tool('addr2line'),
common.vmlinux,
common.run_dir,
os.path.join(kwargs['root_dir'], 'trace2line.sh'),
'true' if kwargs['emulator'] == 'gem5' else 'false',
kwargs['trace_txt_file'],
self.get_toolchain_tool('addr2line'),
kwargs['vmlinux'],
kwargs['run_dir'],
]).wait())
# This was the full conversion attempt.
# if common.emulator == 'gem5':
# if kwargs['emulator'] == 'gem5':
# def get_pc(line):
# # TODO
# # stdin = sed -r 's/^.* (0x[^. ]*)[. ].*/\1/' "$common_trace_txt_file")
@@ -40,17 +41,17 @@ sys.exit(subprocess.Popen([
# with \
# subprocess.Popen(
# [
# common.get_toolchain_tool('addr2line'),
# self.get_toolchain_tool('addr2line'),
# '-e',
# common.vmlinux,
# kwargs['vmlinux'],
# '-f',
# '-p',
# ],
# stdout=subprocess.PIPE,
# stdin=subprocess.PIPE,
# ) as proc, \
# open(common.trace_txt_file, 'r') as infile, \
# open(os.path.join(common.run_dir, 'trace-lines.txt'), 'w') as outfile \
# open(kwargs['trace_txt_file'], 'r') as infile, \
# open(os.path.join(kwargs['run_dir'], 'trace-lines.txt'), 'w') as outfile \
# :
# for in_line in infile:
# proc.stdin.write(get_pc(in_line).encode())
@@ -58,5 +59,5 @@ sys.exit(subprocess.Popen([
# stdout = proc.stdout.read()
# outfile.write(stdout.decode())
# # TODO
# # sed -E "s|at ${common.linux_build_dir}/(\./\|)||"
# # sed -E "s|at ${kwargs['linux_build_dir']}/(\./\|)||"
# # uniq -c