mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-27 04:01:36 +01:00
run: generalize with main(), start porting trace-boot and qemu-trace2txt
This commit is contained in:
21
rungdb
21
rungdb
@@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import copy
|
||||
import os
|
||||
import shlex
|
||||
import sys
|
||||
@@ -19,19 +18,19 @@ defaults = {
|
||||
}
|
||||
|
||||
def main(args, extra_args=None):
|
||||
"""
|
||||
'''
|
||||
:param args: argparse parse_argument() output. Must contain all the common options,
|
||||
but does not need GDB specific ones.
|
||||
:type args: argparse.Namespace
|
||||
|
||||
:param extra_args: extra arguments to be added to args
|
||||
:type extra_args: Dict[str,Any]
|
||||
"""
|
||||
|
||||
:return: GDB exit status
|
||||
:rtype: int
|
||||
'''
|
||||
global defaults
|
||||
if extra_args is None:
|
||||
extra_args = {}
|
||||
args = copy.copy(args)
|
||||
args.__dict__ = dict(list(defaults.items()) + list(args.__dict__.items()) + list(extra_args.items()))
|
||||
args = common.resolve_args(defaults, args, extra_args)
|
||||
after = shlex.split(args.after)
|
||||
before = shlex.split(args.before)
|
||||
if args.no_lxsymbols:
|
||||
@@ -82,7 +81,7 @@ def main(args, extra_args=None):
|
||||
return common.run_cmd(cmd, cmd_file=os.path.join(common.run_dir, 'rungdb.sh'), cwd=common.linux_variant_dir)
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = common.get_argparse(argparse_args={'description':'Connect with GDB to an emulator to debug Linux itself'})
|
||||
parser = common.get_argparse(argparse_args={'description': 'Connect with GDB to an emulator to debug Linux itself'})
|
||||
parser.add_argument(
|
||||
'-A', '--after', default=defaults['after'],
|
||||
help='Pass extra arguments to GDB, to be appended after all other arguments'
|
||||
@@ -92,14 +91,14 @@ if __name__ == '__main__':
|
||||
help='Pass extra arguments to GDB to be prepended before any of the arguments passed by this script'
|
||||
)
|
||||
parser.add_argument(
|
||||
'-C', '--no-continue', default=False, action='store_true',
|
||||
'-C', '--no-continue', default=defaults['no_continue'], action='store_true',
|
||||
help="Don't run continue after connecting"
|
||||
)
|
||||
parser.add_argument(
|
||||
'-k', '--kgdb', default=False, action='store_true'
|
||||
'-k', '--kgdb', default=defaults['kgdb'], action='store_true'
|
||||
)
|
||||
parser.add_argument(
|
||||
'-X', '--no-lxsymbols', default=False, action='store_true'
|
||||
'-X', '--no-lxsymbols', default=defaults['no_lxsymbols'], action='store_true'
|
||||
)
|
||||
parser.add_argument(
|
||||
'break_at', nargs='?',
|
||||
|
||||
Reference in New Issue
Block a user