mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-26 03:31:36 +01:00
CliFunction
This commit is contained in:
29
trace2line
29
trace2line
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user