We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Add `desc` to ArgparsedCommand; move some commmands to Argparsed~
* adds optional keyword argument -  `desc`  - to `ArgparsedCommand` so we don't have to create `argparse.ArgumentParser` if we don't want any parameters
* adds prints for cases when plt/gotplt sections doesnt have any symbols (so user will get an output out of plt/gotplt instead of nothing)
* minor code refactorings

Potentially we could merge ArgparsedCommand and Command in the future (and remove all other Command children).

Also continuation of https://github.com/pwndbg/pwndbg/issues/244

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pwndbg/commands/__init__.py`
Content:
```
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 from __future__ import absolute_import
4 from __future__ import division
5 from __future__ import print_function
6 from __future__ import unicode_literals
7 
8 import argparse
9 import functools
10 
11 import gdb
12 
13 import pwndbg.chain
14 import pwndbg.color
15 import pwndbg.enhance
16 import pwndbg.exception
17 import pwndbg.hexdump
18 import pwndbg.memory
19 import pwndbg.regs
20 import pwndbg.symbol
21 import pwndbg.ui
22 
23 commands = []
24 
25 
26 class Command(gdb.Command):
27     """Generic command wrapper"""
28     command_names = set()
29     history = {}
30 
31     def __init__(self, function, prefix=False):
32         command_name = function.__name__
33 
34         super(Command, self).__init__(command_name, gdb.COMMAND_USER, gdb.COMPLETE_EXPRESSION, prefix=prefix)
35         self.function = function
36 
37         if command_name in self.command_names:
38             raise Exception('Cannot add command %s: already exists.' % command_name)
39 
40         self.command_names.add(command_name)
41         commands.append(self)
42 
43         functools.update_wrapper(self, function)
44         self.__doc__ = function.__doc__
45 
46     def split_args(self, argument):
47         """Split a command-line string from the user into arguments.
48 
49         Returns:
50             A ``(tuple, dict)``, in the form of ``*args, **kwargs``.
51             The contents of the tuple/dict are undefined.
52         """
53         return gdb.string_to_argv(argument), {}
54 
55     def invoke(self, argument, from_tty):
56         """Invoke the command with an argument string"""
57         try:
58             args, kwargs = self.split_args(argument)
59         except SystemExit:
60             # Raised when the usage is printed by an ArgparsedCommand
61             return
62         except (TypeError, gdb.error):
63             pwndbg.exception.handle(self.function.__name__)
64             return
65 
66         try:
67             self.repeat = self.check_repeated(argument, from_tty)
68             return self(*args, **kwargs)
69         finally:
70             self.repeat = False
71 
72     def check_repeated(self, argument, from_tty):
73         """Keep a record of all commands which come from the TTY.
74 
75         Returns:
76             True if this command was executed by the user just hitting "enter".
77         """
78         # Don't care unless it's interactive use
79         if not from_tty:
80             return False
81 
82         lines = gdb.execute('show commands', from_tty=False, to_string=True)
83         lines = lines.splitlines()
84 
85         # No history
86         if not lines:
87             return False
88 
89         last_line = lines[-1]
90         number, command = last_line.split(None, 1)
91         number = int(number)
92 
93         # A new command was entered by the user
94         if number not in Command.history:
95             Command.history[number] = command
96             return False
97 
98         # Somehow the command is different than we got before?
99         if not command.endswith(argument):
100             return False
101 
102         return True
103 
104     def __call__(self, *args, **kwargs):
105         try:
106             return self.function(*args, **kwargs)
107         except TypeError as te:
108             print('%r: %s' % (self.function.__name__.strip(),
109                               self.function.__doc__.strip()))
110             pwndbg.exception.handle(self.function.__name__)
111         except Exception:
112             pwndbg.exception.handle(self.function.__name__)
113 
114 
115 class ParsedCommand(Command):
116     #: Whether to return the string 'arg' if parsing fails.
117     sloppy = False
118 
119     #: Whether to hide errors during parsing
120     quiet  = False
121 
122     def split_args(self, argument):
123         # sys.stdout.write(repr(argument) + '\n')
124         argv, _ = super(ParsedCommand, self).split_args(argument)
125         # sys.stdout.write(repr(argv) + '\n')
126         return list(filter(lambda x: x is not None, map(self.fix, argv))), {}
127 
128     def fix(self, arg):
129         return fix(arg, self.sloppy, self.quiet)
130 
131 
132 class ParsedCommandPrefix(ParsedCommand):
133     def __init__(self, function, prefix=True):
134         super(ParsedCommand, self).__init__(function, prefix)
135 
136 
137 def fix(arg, sloppy=False, quiet=True, reraise=False):
138     """Fix a single command-line argument coming from the GDB CLI.
139 
140     Arguments:
141         arg(str): Original string representation (e.g. '0', '$rax', '$rax+44')
142         sloppy(bool): If ``arg`` cannot be evaluated, return ``arg``. (default: False)
143         quiet(bool): If an error occurs, suppress it. (default: True)
144         reraise(bool): If an error occurs, raise the exception. (default: False)
145 
146     Returns:
147         Ideally ``gdb.Value`` object.  May return a ``str`` if ``sloppy==True``.
148         May return ``None`` if ``sloppy == False and reraise == False``.
149     """
150     if isinstance(arg, gdb.Value):
151         return arg
152 
153     try:
154         parsed = gdb.parse_and_eval(arg)
155         return parsed
156     except Exception:
157         pass
158 
159     try:
160         arg = pwndbg.regs.fix(arg)
161         return gdb.parse_and_eval(arg)
162     except Exception as e:
163         if not quiet:
164             print(e)
165         if reraise:
166             raise e
167         pass
168 
169     if sloppy:
170         return arg
171 
172     return None
173 
174 
175 def fix_int(*a, **kw):
176     return int(fix(*a,**kw))
177 
178 def fix_int_reraise(*a, **kw):
179     return fix(*a, reraise=True, **kw)
180 
181 
182 def OnlyWithFile(function):
183     @functools.wraps(function)
184     def _OnlyWithFile(*a, **kw):
185         if pwndbg.proc.exe:
186             return function(*a, **kw)
187         else:
188             print("%s: There is no file loaded." % function.__name__)
189 
190     return _OnlyWithFile
191 
192 
193 def OnlyWhenRunning(function):
194     @functools.wraps(function)
195     def _OnlyWhenRunning(*a, **kw):
196         if pwndbg.proc.alive:
197             return function(*a, **kw)
198         else:
199             print("%s: The program is not being run." % function.__name__)
200     return _OnlyWhenRunning
201 
202 
203 class QuietSloppyParsedCommand(ParsedCommand):
204     def __init__(self, *a, **kw):
205         super(QuietSloppyParsedCommand, self).__init__(*a, **kw)
206         self.quiet = True
207         self.sloppy = True
208 
209 
210 class _ArgparsedCommand(Command):
211     def __init__(self, parser, function, *a, **kw):
212         self.parser = parser
213         self.parser.prog = function.__name__
214         self.__doc__ = function.__doc__ = self.parser.description
215         super(_ArgparsedCommand, self).__init__(function, *a, **kw)
216 
217     def split_args(self, argument):
218         argv = gdb.string_to_argv(argument)
219         return tuple(), vars(self.parser.parse_args(argv))
220 
221 
222 class ArgparsedCommand(object):
223     """Adds documentation and offloads parsing for a Command via argparse"""
224     def __init__(self, parser_or_desc):
225         """
226         :param parser_or_desc: `argparse.ArgumentParser` instance or `str`
227         """
228         if isinstance(parser_or_desc, str):
229             self.parser = argparse.ArgumentParser(description=parser_or_desc)
230         else:
231             self.parser = parser_or_desc
232 
233         # We want to run all integer and otherwise-unspecified arguments
234         # through fix() so that GDB parses it.
235         for action in self.parser._actions:
236             if action.dest == 'help':
237                 continue
238             if action.type in (int, None):
239                 action.type = fix_int_reraise
240             if action.default is not None:
241                 action.help += ' (default: %(default)s)'
242 
243     def __call__(self, function):
244         return _ArgparsedCommand(self.parser, function)
245 
246 
247 def sloppy_gdb_parse(s):
248     """
249     This function should be used as ``argparse.ArgumentParser`` .add_argument method's `type` helper.
250     
251     This makes the type being parsed as gdb value and if that parsing fails,
252     a string is returned.
253 
254     :param s: String.
255     :return: Whatever gdb.parse_and_eval returns or string.
256     """
257     try:
258         return gdb.parse_and_eval(s)
259     except (TypeError, gdb.error):
260         return s
261
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pwndbg/commands/__init__.py b/pwndbg/commands/__init__.py
--- a/pwndbg/commands/__init__.py
+++ b/pwndbg/commands/__init__.py
@@ -9,6 +9,7 @@
 import functools
 
 import gdb
+import six
 
 import pwndbg.chain
 import pwndbg.color
@@ -225,7 +226,7 @@
         """
         :param parser_or_desc: `argparse.ArgumentParser` instance or `str`
         """
-        if isinstance(parser_or_desc, str):
+        if isinstance(parser_or_desc, six.string_types):
             self.parser = argparse.ArgumentParser(description=parser_or_desc)
         else:
             self.parser = parser_or_desc

{"golden_diff": "diff --git a/pwndbg/commands/__init__.py b/pwndbg/commands/__init__.py\n--- a/pwndbg/commands/__init__.py\n+++ b/pwndbg/commands/__init__.py\n@@ -9,6 +9,7 @@\n import functools\n \n import gdb\n+import six\n \n import pwndbg.chain\n import pwndbg.color\n@@ -225,7 +226,7 @@\n         \"\"\"\n         :param parser_or_desc: `argparse.ArgumentParser` instance or `str`\n         \"\"\"\n-        if isinstance(parser_or_desc, str):\n+        if isinstance(parser_or_desc, six.string_types):\n             self.parser = argparse.ArgumentParser(description=parser_or_desc)\n         else:\n             self.parser = parser_or_desc\n", "issue": "Add `desc` to ArgparsedCommand; move some commmands to Argparsed~\n* adds optional keyword argument -  `desc`  - to `ArgparsedCommand` so we don't have to create `argparse.ArgumentParser` if we don't want any parameters\r\n* adds prints for cases when plt/gotplt sections doesnt have any symbols (so user will get an output out of plt/gotplt instead of nothing)\r\n* minor code refactorings\r\n\r\nPotentially we could merge ArgparsedCommand and Command in the future (and remove all other Command children).\r\n\r\nAlso continuation of https://github.com/pwndbg/pwndbg/issues/244\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport argparse\nimport functools\n\nimport gdb\n\nimport pwndbg.chain\nimport pwndbg.color\nimport pwndbg.enhance\nimport pwndbg.exception\nimport pwndbg.hexdump\nimport pwndbg.memory\nimport pwndbg.regs\nimport pwndbg.symbol\nimport pwndbg.ui\n\ncommands = []\n\n\nclass Command(gdb.Command):\n    \"\"\"Generic command wrapper\"\"\"\n    command_names = set()\n    history = {}\n\n    def __init__(self, function, prefix=False):\n        command_name = function.__name__\n\n        super(Command, self).__init__(command_name, gdb.COMMAND_USER, gdb.COMPLETE_EXPRESSION, prefix=prefix)\n        self.function = function\n\n        if command_name in self.command_names:\n            raise Exception('Cannot add command %s: already exists.' % command_name)\n\n        self.command_names.add(command_name)\n        commands.append(self)\n\n        functools.update_wrapper(self, function)\n        self.__doc__ = function.__doc__\n\n    def split_args(self, argument):\n        \"\"\"Split a command-line string from the user into arguments.\n\n        Returns:\n            A ``(tuple, dict)``, in the form of ``*args, **kwargs``.\n            The contents of the tuple/dict are undefined.\n        \"\"\"\n        return gdb.string_to_argv(argument), {}\n\n    def invoke(self, argument, from_tty):\n        \"\"\"Invoke the command with an argument string\"\"\"\n        try:\n            args, kwargs = self.split_args(argument)\n        except SystemExit:\n            # Raised when the usage is printed by an ArgparsedCommand\n            return\n        except (TypeError, gdb.error):\n            pwndbg.exception.handle(self.function.__name__)\n            return\n\n        try:\n            self.repeat = self.check_repeated(argument, from_tty)\n            return self(*args, **kwargs)\n        finally:\n            self.repeat = False\n\n    def check_repeated(self, argument, from_tty):\n        \"\"\"Keep a record of all commands which come from the TTY.\n\n        Returns:\n            True if this command was executed by the user just hitting \"enter\".\n        \"\"\"\n        # Don't care unless it's interactive use\n        if not from_tty:\n            return False\n\n        lines = gdb.execute('show commands', from_tty=False, to_string=True)\n        lines = lines.splitlines()\n\n        # No history\n        if not lines:\n            return False\n\n        last_line = lines[-1]\n        number, command = last_line.split(None, 1)\n        number = int(number)\n\n        # A new command was entered by the user\n        if number not in Command.history:\n            Command.history[number] = command\n            return False\n\n        # Somehow the command is different than we got before?\n        if not command.endswith(argument):\n            return False\n\n        return True\n\n    def __call__(self, *args, **kwargs):\n        try:\n            return self.function(*args, **kwargs)\n        except TypeError as te:\n            print('%r: %s' % (self.function.__name__.strip(),\n                              self.function.__doc__.strip()))\n            pwndbg.exception.handle(self.function.__name__)\n        except Exception:\n            pwndbg.exception.handle(self.function.__name__)\n\n\nclass ParsedCommand(Command):\n    #: Whether to return the string 'arg' if parsing fails.\n    sloppy = False\n\n    #: Whether to hide errors during parsing\n    quiet  = False\n\n    def split_args(self, argument):\n        # sys.stdout.write(repr(argument) + '\\n')\n        argv, _ = super(ParsedCommand, self).split_args(argument)\n        # sys.stdout.write(repr(argv) + '\\n')\n        return list(filter(lambda x: x is not None, map(self.fix, argv))), {}\n\n    def fix(self, arg):\n        return fix(arg, self.sloppy, self.quiet)\n\n\nclass ParsedCommandPrefix(ParsedCommand):\n    def __init__(self, function, prefix=True):\n        super(ParsedCommand, self).__init__(function, prefix)\n\n\ndef fix(arg, sloppy=False, quiet=True, reraise=False):\n    \"\"\"Fix a single command-line argument coming from the GDB CLI.\n\n    Arguments:\n        arg(str): Original string representation (e.g. '0', '$rax', '$rax+44')\n        sloppy(bool): If ``arg`` cannot be evaluated, return ``arg``. (default: False)\n        quiet(bool): If an error occurs, suppress it. (default: True)\n        reraise(bool): If an error occurs, raise the exception. (default: False)\n\n    Returns:\n        Ideally ``gdb.Value`` object.  May return a ``str`` if ``sloppy==True``.\n        May return ``None`` if ``sloppy == False and reraise == False``.\n    \"\"\"\n    if isinstance(arg, gdb.Value):\n        return arg\n\n    try:\n        parsed = gdb.parse_and_eval(arg)\n        return parsed\n    except Exception:\n        pass\n\n    try:\n        arg = pwndbg.regs.fix(arg)\n        return gdb.parse_and_eval(arg)\n    except Exception as e:\n        if not quiet:\n            print(e)\n        if reraise:\n            raise e\n        pass\n\n    if sloppy:\n        return arg\n\n    return None\n\n\ndef fix_int(*a, **kw):\n    return int(fix(*a,**kw))\n\ndef fix_int_reraise(*a, **kw):\n    return fix(*a, reraise=True, **kw)\n\n\ndef OnlyWithFile(function):\n    @functools.wraps(function)\n    def _OnlyWithFile(*a, **kw):\n        if pwndbg.proc.exe:\n            return function(*a, **kw)\n        else:\n            print(\"%s: There is no file loaded.\" % function.__name__)\n\n    return _OnlyWithFile\n\n\ndef OnlyWhenRunning(function):\n    @functools.wraps(function)\n    def _OnlyWhenRunning(*a, **kw):\n        if pwndbg.proc.alive:\n            return function(*a, **kw)\n        else:\n            print(\"%s: The program is not being run.\" % function.__name__)\n    return _OnlyWhenRunning\n\n\nclass QuietSloppyParsedCommand(ParsedCommand):\n    def __init__(self, *a, **kw):\n        super(QuietSloppyParsedCommand, self).__init__(*a, **kw)\n        self.quiet = True\n        self.sloppy = True\n\n\nclass _ArgparsedCommand(Command):\n    def __init__(self, parser, function, *a, **kw):\n        self.parser = parser\n        self.parser.prog = function.__name__\n        self.__doc__ = function.__doc__ = self.parser.description\n        super(_ArgparsedCommand, self).__init__(function, *a, **kw)\n\n    def split_args(self, argument):\n        argv = gdb.string_to_argv(argument)\n        return tuple(), vars(self.parser.parse_args(argv))\n\n\nclass ArgparsedCommand(object):\n    \"\"\"Adds documentation and offloads parsing for a Command via argparse\"\"\"\n    def __init__(self, parser_or_desc):\n        \"\"\"\n        :param parser_or_desc: `argparse.ArgumentParser` instance or `str`\n        \"\"\"\n        if isinstance(parser_or_desc, str):\n            self.parser = argparse.ArgumentParser(description=parser_or_desc)\n        else:\n            self.parser = parser_or_desc\n\n        # We want to run all integer and otherwise-unspecified arguments\n        # through fix() so that GDB parses it.\n        for action in self.parser._actions:\n            if action.dest == 'help':\n                continue\n            if action.type in (int, None):\n                action.type = fix_int_reraise\n            if action.default is not None:\n                action.help += ' (default: %(default)s)'\n\n    def __call__(self, function):\n        return _ArgparsedCommand(self.parser, function)\n\n\ndef sloppy_gdb_parse(s):\n    \"\"\"\n    This function should be used as ``argparse.ArgumentParser`` .add_argument method's `type` helper.\n    \n    This makes the type being parsed as gdb value and if that parsing fails,\n    a string is returned.\n\n    :param s: String.\n    :return: Whatever gdb.parse_and_eval returns or string.\n    \"\"\"\n    try:\n        return gdb.parse_and_eval(s)\n    except (TypeError, gdb.error):\n        return s\n", "path": "pwndbg/commands/__init__.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport argparse\nimport functools\n\nimport gdb\nimport six\n\nimport pwndbg.chain\nimport pwndbg.color\nimport pwndbg.enhance\nimport pwndbg.exception\nimport pwndbg.hexdump\nimport pwndbg.memory\nimport pwndbg.regs\nimport pwndbg.symbol\nimport pwndbg.ui\n\ncommands = []\n\n\nclass Command(gdb.Command):\n    \"\"\"Generic command wrapper\"\"\"\n    command_names = set()\n    history = {}\n\n    def __init__(self, function, prefix=False):\n        command_name = function.__name__\n\n        super(Command, self).__init__(command_name, gdb.COMMAND_USER, gdb.COMPLETE_EXPRESSION, prefix=prefix)\n        self.function = function\n\n        if command_name in self.command_names:\n            raise Exception('Cannot add command %s: already exists.' % command_name)\n\n        self.command_names.add(command_name)\n        commands.append(self)\n\n        functools.update_wrapper(self, function)\n        self.__doc__ = function.__doc__\n\n    def split_args(self, argument):\n        \"\"\"Split a command-line string from the user into arguments.\n\n        Returns:\n            A ``(tuple, dict)``, in the form of ``*args, **kwargs``.\n            The contents of the tuple/dict are undefined.\n        \"\"\"\n        return gdb.string_to_argv(argument), {}\n\n    def invoke(self, argument, from_tty):\n        \"\"\"Invoke the command with an argument string\"\"\"\n        try:\n            args, kwargs = self.split_args(argument)\n        except SystemExit:\n            # Raised when the usage is printed by an ArgparsedCommand\n            return\n        except (TypeError, gdb.error):\n            pwndbg.exception.handle(self.function.__name__)\n            return\n\n        try:\n            self.repeat = self.check_repeated(argument, from_tty)\n            return self(*args, **kwargs)\n        finally:\n            self.repeat = False\n\n    def check_repeated(self, argument, from_tty):\n        \"\"\"Keep a record of all commands which come from the TTY.\n\n        Returns:\n            True if this command was executed by the user just hitting \"enter\".\n        \"\"\"\n        # Don't care unless it's interactive use\n        if not from_tty:\n            return False\n\n        lines = gdb.execute('show commands', from_tty=False, to_string=True)\n        lines = lines.splitlines()\n\n        # No history\n        if not lines:\n            return False\n\n        last_line = lines[-1]\n        number, command = last_line.split(None, 1)\n        number = int(number)\n\n        # A new command was entered by the user\n        if number not in Command.history:\n            Command.history[number] = command\n            return False\n\n        # Somehow the command is different than we got before?\n        if not command.endswith(argument):\n            return False\n\n        return True\n\n    def __call__(self, *args, **kwargs):\n        try:\n            return self.function(*args, **kwargs)\n        except TypeError as te:\n            print('%r: %s' % (self.function.__name__.strip(),\n                              self.function.__doc__.strip()))\n            pwndbg.exception.handle(self.function.__name__)\n        except Exception:\n            pwndbg.exception.handle(self.function.__name__)\n\n\nclass ParsedCommand(Command):\n    #: Whether to return the string 'arg' if parsing fails.\n    sloppy = False\n\n    #: Whether to hide errors during parsing\n    quiet  = False\n\n    def split_args(self, argument):\n        # sys.stdout.write(repr(argument) + '\\n')\n        argv, _ = super(ParsedCommand, self).split_args(argument)\n        # sys.stdout.write(repr(argv) + '\\n')\n        return list(filter(lambda x: x is not None, map(self.fix, argv))), {}\n\n    def fix(self, arg):\n        return fix(arg, self.sloppy, self.quiet)\n\n\nclass ParsedCommandPrefix(ParsedCommand):\n    def __init__(self, function, prefix=True):\n        super(ParsedCommand, self).__init__(function, prefix)\n\n\ndef fix(arg, sloppy=False, quiet=True, reraise=False):\n    \"\"\"Fix a single command-line argument coming from the GDB CLI.\n\n    Arguments:\n        arg(str): Original string representation (e.g. '0', '$rax', '$rax+44')\n        sloppy(bool): If ``arg`` cannot be evaluated, return ``arg``. (default: False)\n        quiet(bool): If an error occurs, suppress it. (default: True)\n        reraise(bool): If an error occurs, raise the exception. (default: False)\n\n    Returns:\n        Ideally ``gdb.Value`` object.  May return a ``str`` if ``sloppy==True``.\n        May return ``None`` if ``sloppy == False and reraise == False``.\n    \"\"\"\n    if isinstance(arg, gdb.Value):\n        return arg\n\n    try:\n        parsed = gdb.parse_and_eval(arg)\n        return parsed\n    except Exception:\n        pass\n\n    try:\n        arg = pwndbg.regs.fix(arg)\n        return gdb.parse_and_eval(arg)\n    except Exception as e:\n        if not quiet:\n            print(e)\n        if reraise:\n            raise e\n        pass\n\n    if sloppy:\n        return arg\n\n    return None\n\n\ndef fix_int(*a, **kw):\n    return int(fix(*a,**kw))\n\ndef fix_int_reraise(*a, **kw):\n    return fix(*a, reraise=True, **kw)\n\n\ndef OnlyWithFile(function):\n    @functools.wraps(function)\n    def _OnlyWithFile(*a, **kw):\n        if pwndbg.proc.exe:\n            return function(*a, **kw)\n        else:\n            print(\"%s: There is no file loaded.\" % function.__name__)\n\n    return _OnlyWithFile\n\n\ndef OnlyWhenRunning(function):\n    @functools.wraps(function)\n    def _OnlyWhenRunning(*a, **kw):\n        if pwndbg.proc.alive:\n            return function(*a, **kw)\n        else:\n            print(\"%s: The program is not being run.\" % function.__name__)\n    return _OnlyWhenRunning\n\n\nclass QuietSloppyParsedCommand(ParsedCommand):\n    def __init__(self, *a, **kw):\n        super(QuietSloppyParsedCommand, self).__init__(*a, **kw)\n        self.quiet = True\n        self.sloppy = True\n\n\nclass _ArgparsedCommand(Command):\n    def __init__(self, parser, function, *a, **kw):\n        self.parser = parser\n        self.parser.prog = function.__name__\n        self.__doc__ = function.__doc__ = self.parser.description\n        super(_ArgparsedCommand, self).__init__(function, *a, **kw)\n\n    def split_args(self, argument):\n        argv = gdb.string_to_argv(argument)\n        return tuple(), vars(self.parser.parse_args(argv))\n\n\nclass ArgparsedCommand(object):\n    \"\"\"Adds documentation and offloads parsing for a Command via argparse\"\"\"\n    def __init__(self, parser_or_desc):\n        \"\"\"\n        :param parser_or_desc: `argparse.ArgumentParser` instance or `str`\n        \"\"\"\n        if isinstance(parser_or_desc, six.string_types):\n            self.parser = argparse.ArgumentParser(description=parser_or_desc)\n        else:\n            self.parser = parser_or_desc\n\n        # We want to run all integer and otherwise-unspecified arguments\n        # through fix() so that GDB parses it.\n        for action in self.parser._actions:\n            if action.dest == 'help':\n                continue\n            if action.type in (int, None):\n                action.type = fix_int_reraise\n            if action.default is not None:\n                action.help += ' (default: %(default)s)'\n\n    def __call__(self, function):\n        return _ArgparsedCommand(self.parser, function)\n\n\ndef sloppy_gdb_parse(s):\n    \"\"\"\n    This function should be used as ``argparse.ArgumentParser`` .add_argument method's `type` helper.\n    \n    This makes the type being parsed as gdb value and if that parsing fails,\n    a string is returned.\n\n    :param s: String.\n    :return: Whatever gdb.parse_and_eval returns or string.\n    \"\"\"\n    try:\n        return gdb.parse_and_eval(s)\n    except (TypeError, gdb.error):\n        return s\n", "path": "pwndbg/commands/__init__.py"}]}