MCPcopy Create free account
hub / github.com/HexHive/NASS / GefCommand

Class GefCommand

tools/gef.py:9349–9530  ·  view source on GitHub ↗

GEF main command: view all new commands by typing `gef`.

Source from the content-addressed store, hash-verified

9347# GEF internal command classes
9348#
9349class GefCommand(gdb.Command):
9350 """GEF main command: view all new commands by typing `gef`."""
9351
9352 _cmdline_ = "gef"
9353 _syntax_ = f"{_cmdline_} (missing|config|save|restore|set|run)"
9354
9355 def __init__(self) -> None:
9356 super().__init__(self._cmdline_, gdb.COMMAND_SUPPORT, gdb.COMPLETE_NONE, True)
9357 gef.config["gef.follow_child"] = GefSetting(True, bool, "Automatically set GDB to follow child when forking")
9358 gef.config["gef.readline_compat"] = GefSetting(False, bool, "Workaround for readline SOH/ETX issue (SEGV)")
9359 gef.config["gef.debug"] = GefSetting(False, bool, "Enable debug mode for gef")
9360 gef.config["gef.autosave_breakpoints_file"] = GefSetting("", str, "Automatically save and restore breakpoints")
9361 gef.config["gef.extra_plugins_dir"] = GefSetting("", str, "Autoload additional GEF commands from external directory", hooks={"on_write": self.load_extra_plugins})
9362 gef.config["gef.disable_color"] = GefSetting(False, bool, "Disable all colors in GEF")
9363 gef.config["gef.tempdir"] = GefSetting(GEF_TEMP_DIR, str, "Directory to use for temporary/cache content")
9364 gef.config["gef.show_deprecation_warnings"] = GefSetting(True, bool, "Toggle the display of the `deprecated` warnings")
9365 gef.config["gef.buffer"] = GefSetting(True, bool, "Internally buffer command output until completion")
9366
9367 self.commands : Dict[str, GenericCommand] = collections.OrderedDict()
9368 self.functions : Dict[str, GenericFunction] = collections.OrderedDict()
9369 self.missing: Dict[str, Exception] = {}
9370 return
9371
9372 @property
9373 def loaded_commands(self) -> List[Tuple[str, Type[GenericCommand], Any]]:
9374 print("Obsolete loaded_commands")
9375 raise
9376
9377 @property
9378 def loaded_functions(self) -> List[Type[GenericFunction]]:
9379 print("Obsolete loaded_functions")
9380 raise
9381
9382 @property
9383 def missing_commands(self) -> Dict[str, Exception]:
9384 print("Obsolete missing_commands")
9385 raise
9386
9387 def setup(self) -> None:
9388 self.load()
9389
9390 GefHelpCommand()
9391 GefConfigCommand()
9392 GefSaveCommand()
9393 GefMissingCommand()
9394 GefSetCommand()
9395 GefRunCommand()
9396 GefInstallExtraScriptCommand()
9397
9398 # restore the settings from config file if any
9399 GefRestoreCommand()
9400 return
9401
9402 def load_extra_plugins(self) -> int:
9403 def load_plugin(fpath: pathlib.Path) -> bool:
9404 try:
9405 dbg(f"Loading '{fpath}'")
9406 gdb.execute(f"source {fpath}")

Callers 1

setupMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected