Cleanup: remove ParsedCommand and fix search help string

pull/1198/head
disconnect3d 3 years ago
parent 8453ddc680
commit d8a62f1120

@ -10,7 +10,7 @@ Feel free to update the list below!
* The dashboard/display/context we are displaying is done by `pwndbg/commands/context.py` which is invoked through GDB's prompt hook (which we defined in `pwndbg/prompt.py` as `prompt_hook_on_stop`).
* All commands should be defined in `pwndbg/commands` - most of them lie in separate files but some files contains many of them (e.g. commands corresponding to windbg debugger - in `windbg.py` or some misc commands in `misc.py`). We would also want to make all of them to use `ArgparsedCommand` (instead of `Command` or `ParsedCommand` decorators).
* All commands should be defined in `pwndbg/commands` - most of them lie in separate files but some files contains many of them (e.g. commands corresponding to windbg debugger - in `windbg.py` or some misc commands in `misc.py`). We would also want to make all of them to use `ArgparsedCommand` (instead of `Command`).
* We change a bit GDB settings - this can be seen in `pwndbg/__init__.py` - there are also imports for all pwndbg submodules

@ -150,28 +150,6 @@ class Command(gdb.Command):
pwndbg.exception.handle(self.function.__name__)
class ParsedCommand(Command):
#: Whether to return the string 'arg' if parsing fails.
sloppy = False
#: Whether to hide errors during parsing
quiet = False
def split_args(self, argument):
# sys.stdout.write(repr(argument) + '\n')
argv, _ = super(ParsedCommand, self).split_args(argument)
# sys.stdout.write(repr(argv) + '\n')
return list(filter(lambda x: x is not None, map(self.fix, argv))), {}
def fix(self, arg):
return fix(arg, self.sloppy, self.quiet)
class ParsedCommandPrefix(ParsedCommand):
def __init__(self, function, prefix=True):
super(ParsedCommand, self).__init__(function, prefix)
def fix(arg, sloppy=False, quiet=True, reraise=False):
"""Fix a single command-line argument coming from the GDB CLI.

@ -112,7 +112,8 @@ parser.add_argument(
"--save",
action="store_true",
default=None,
help="Save results for --resume. Default comes from config %r" % auto_save.name,
help="Save results for further searches with --next. Default comes from config %r"
% auto_save.name,
)
parser.add_argument(
"--no-save", action="store_false", default=None, dest="save", help="Invert --save"

Loading…
Cancel
Save