Files
linux-kernel-module-cheat/run-gdbserver
Ciro Santilli 六四事件 法轮功 1768421dbd args -> kwargs
2018-12-08 00:00:01 +00:00

29 lines
810 B
Python
Executable File

#!/usr/bin/env python3
import os
import subprocess
import sys
import common
parser = common.get_argparse(argparse_args={
'description':'Connect to gdbserver running on the guest.'
})
parser.add_argument(
'executable',
help='Path to the executable to be debugged relative to the Buildroot build directory.'
)
parser.add_argument(
'break_at', default='main', nargs='?'
)
args = common.setup(parser)
sys.exit(subprocess.Popen([
common.get_toolchain_tool('gdb'),
'-q',
'-ex', 'set sysroot {}'.format(common.buildroot_staging_dir),
'-ex', 'target remote localhost:{}'.format(common.qemu_hostfwd_generic_port),
'-ex', 'tbreak {}'.format(kwargs['break_at']),
'-ex', 'continue',
os.path.join(common.buildroot_build_build_dir, common.resolve_userland(kwargs['executable'])),
]).wait())