Override GDB run commands with the context from GEF. Simple wrapper for GDB run command to use arguments set from `gef set args`.
| 9837 | |
| 9838 | |
| 9839 | class GefRunCommand(gdb.Command): |
| 9840 | """Override GDB run commands with the context from GEF. |
| 9841 | Simple wrapper for GDB run command to use arguments set from `gef set args`.""" |
| 9842 | _cmdline_ = "gef run" |
| 9843 | _syntax_ = f"{_cmdline_} [GDB_RUN_ARGUMENTS]" |
| 9844 | |
| 9845 | def __init__(self) -> None: |
| 9846 | super().__init__(self._cmdline_, gdb.COMMAND_SUPPORT, gdb.COMPLETE_FILENAME, False) |
| 9847 | return |
| 9848 | |
| 9849 | def invoke(self, args: Any, from_tty: bool) -> None: |
| 9850 | self.dont_repeat() |
| 9851 | if is_alive(): |
| 9852 | gdb.execute("continue") |
| 9853 | return |
| 9854 | |
| 9855 | argv = args.split() |
| 9856 | gdb.execute(f"gef set args {' '.join(argv)}") |
| 9857 | gdb.execute("run") |
| 9858 | return |
| 9859 | |
| 9860 | |
| 9861 | class GefAlias(gdb.Command): |