Skip to content

Commit

Permalink
__commands__ --> gef.session.commands
Browse files Browse the repository at this point in the history
  • Loading branch information
hugsy committed Jan 7, 2022
1 parent 809c735 commit eb7312b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions gef.py
Expand Up @@ -137,7 +137,6 @@ def update_gef(argv):
sys.exit(0)

gef = None
__commands__ = []
__functions__ = []
__aliases__ = []
__watches__ = {}
Expand Down Expand Up @@ -4403,9 +4402,9 @@ def pane_title(): return "example:pane"

def register_external_command(obj):
"""Registering function for new GEF (sub-)command to GDB."""
global __commands__, gef
global gef
cls = obj.__class__
__commands__.append(cls)
gef.session.commands.append(cls)
gef.gdb.load(initial=False)
gef.gdb.doc.add_command_to_doc((cls._cmdline_, cls, None))
gef.gdb.doc.refresh()
Expand All @@ -4414,16 +4413,16 @@ def register_external_command(obj):

def register_command(cls):
"""Decorator for registering new GEF (sub-)command to GDB."""
global __commands__
__commands__.append(cls)
global gef
gef.session.commands.append(cls)
return cls


def register_priority_command(cls):
"""Decorator for registering new command with priority, meaning that it must
loaded before the other generic commands."""
global __commands__
__commands__.insert(0, cls)
global gef
gef.session.commands.insert(0, cls)
return cls


Expand Down Expand Up @@ -10556,7 +10555,7 @@ def add_context_pane(self, pane_name, display_pane_function, pane_title_function
def load(self, initial=False):
"""Load all the commands and functions defined by GEF into GDB."""
nb_missing = 0
self.commands = [(x._cmdline_, x) for x in __commands__]
self.commands = [(x._cmdline_, x) for x in gef.session.commands]

# load all of the functions
for function_class_name in __functions__:
Expand Down Expand Up @@ -11384,6 +11383,7 @@ def __init__(self):
self.reset_caches()
self.remote = None
self.qemu_mode = False
self.commands = []
return

def reset_caches(self):
Expand Down

0 comments on commit eb7312b

Please sign in to comment.