prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Disable search-memory-packet back only on broken GDB version
  Tl;dr: Use the workaround from https://github.com/pwndbg/pwndbg/pull/322/files only for broken gdb versions
  Disable search-memory-packet back only on broken GDB version
  Tl;dr: Use the workaround from https://github.com/pwndbg/pwndbg/pull/322/files only for broken gdb versions
  
  --- 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/__init__.py`
  Content:
  ```
  1 import signal
  2 
  3 import gdb
  4 
  5 import pwndbg.color
  6 import pwndbg.commands
  7 import pwndbg.gdblib
  8 from pwndbg.commands import load_commands
  9 from pwndbg.gdblib import load_gdblib
  10 
  11 load_commands()
  12 load_gdblib()
  13 
  14 # TODO: Convert these to gdblib modules and remove this
  15 try:
  16     import pwndbg.disasm
  17     import pwndbg.disasm.arm
  18     import pwndbg.disasm.jump
  19     import pwndbg.disasm.mips
  20     import pwndbg.disasm.ppc
  21     import pwndbg.disasm.sparc
  22     import pwndbg.disasm.x86
  23     import pwndbg.heap
  24 except ModuleNotFoundError:
  25     pass
  26 
  27 import pwndbg.exception
  28 import pwndbg.lib.version
  29 import pwndbg.ui
  30 
  31 __version__ = pwndbg.lib.version.__version__
  32 version = __version__
  33 
  34 from pwndbg.gdblib import prompt
  35 
  36 prompt.set_prompt()
  37 
  38 pre_commands = """
  39 set confirm off
  40 set verbose off
  41 set pagination off
  42 set height 0
  43 set history save on
  44 set follow-fork-mode child
  45 set backtrace past-main on
  46 set step-mode on
  47 set print pretty on
  48 set width %i
  49 handle SIGALRM nostop print nopass
  50 handle SIGBUS  stop   print nopass
  51 handle SIGPIPE nostop print nopass
  52 handle SIGSEGV stop   print nopass
  53 """.strip() % (
  54     pwndbg.ui.get_window_size()[1]
  55 )
  56 
  57 for line in pre_commands.strip().splitlines():
  58     gdb.execute(line)
  59 
  60 # This may throw an exception, see pwndbg/pwndbg#27
  61 try:
  62     gdb.execute("set disassembly-flavor intel")
  63 except gdb.error:
  64     pass
  65 
  66 # handle resize event to align width and completion
  67 signal.signal(
  68     signal.SIGWINCH,
  69     lambda signum, frame: gdb.execute("set width %i" % pwndbg.ui.get_window_size()[1]),
  70 )
  71 
  72 # Reading Comment file
  73 from pwndbg.commands import comments
  74 
  75 comments.init()
  76 
  77 from pwndbg.gdblib import config_mod
  78 
  79 config_mod.init_params()
  80
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/pwndbg/__init__.py b/pwndbg/__init__.py
  --- a/pwndbg/__init__.py
  +++ b/pwndbg/__init__.py
  @@ -54,6 +54,10 @@
       pwndbg.ui.get_window_size()[1]
   )
   
  +# See https://github.com/pwndbg/pwndbg/issues/808
  +if int(getattr(gdb, "VERSION", "0.0").split(".")[0]) <= 9:
  +    pre_commands += "\nset remote search-memory-packet off"
  +
   for line in pre_commands.strip().splitlines():
       gdb.execute(line)
  
verification_info: {"golden_diff": "diff --git a/pwndbg/__init__.py b/pwndbg/__init__.py\n--- a/pwndbg/__init__.py\n+++ b/pwndbg/__init__.py\n@@ -54,6 +54,10 @@\n     pwndbg.ui.get_window_size()[1]\n )\n \n+# See https://github.com/pwndbg/pwndbg/issues/808\n+if int(getattr(gdb, \"VERSION\", \"0.0\").split(\".\")[0]) <= 9:\n+    pre_commands += \"\\nset remote search-memory-packet off\"\n+\n for line in pre_commands.strip().splitlines():\n     gdb.execute(line)\n", "issue": "Disable search-memory-packet back only on broken GDB version\nTl;dr: Use the workaround from https://github.com/pwndbg/pwndbg/pull/322/files only for broken gdb versions\nDisable search-memory-packet back only on broken GDB version\nTl;dr: Use the workaround from https://github.com/pwndbg/pwndbg/pull/322/files only for broken gdb versions\n", "before_files": [{"content": "import signal\n\nimport gdb\n\nimport pwndbg.color\nimport pwndbg.commands\nimport pwndbg.gdblib\nfrom pwndbg.commands import load_commands\nfrom pwndbg.gdblib import load_gdblib\n\nload_commands()\nload_gdblib()\n\n# TODO: Convert these to gdblib modules and remove this\ntry:\n    import pwndbg.disasm\n    import pwndbg.disasm.arm\n    import pwndbg.disasm.jump\n    import pwndbg.disasm.mips\n    import pwndbg.disasm.ppc\n    import pwndbg.disasm.sparc\n    import pwndbg.disasm.x86\n    import pwndbg.heap\nexcept ModuleNotFoundError:\n    pass\n\nimport pwndbg.exception\nimport pwndbg.lib.version\nimport pwndbg.ui\n\n__version__ = pwndbg.lib.version.__version__\nversion = __version__\n\nfrom pwndbg.gdblib import prompt\n\nprompt.set_prompt()\n\npre_commands = \"\"\"\nset confirm off\nset verbose off\nset pagination off\nset height 0\nset history save on\nset follow-fork-mode child\nset backtrace past-main on\nset step-mode on\nset print pretty on\nset width %i\nhandle SIGALRM nostop print nopass\nhandle SIGBUS  stop   print nopass\nhandle SIGPIPE nostop print nopass\nhandle SIGSEGV stop   print nopass\n\"\"\".strip() % (\n    pwndbg.ui.get_window_size()[1]\n)\n\nfor line in pre_commands.strip().splitlines():\n    gdb.execute(line)\n\n# This may throw an exception, see pwndbg/pwndbg#27\ntry:\n    gdb.execute(\"set disassembly-flavor intel\")\nexcept gdb.error:\n    pass\n\n# handle resize event to align width and completion\nsignal.signal(\n    signal.SIGWINCH,\n    lambda signum, frame: gdb.execute(\"set width %i\" % pwndbg.ui.get_window_size()[1]),\n)\n\n# Reading Comment file\nfrom pwndbg.commands import comments\n\ncomments.init()\n\nfrom pwndbg.gdblib import config_mod\n\nconfig_mod.init_params()\n", "path": "pwndbg/__init__.py"}], "after_files": [{"content": "import signal\n\nimport gdb\n\nimport pwndbg.color\nimport pwndbg.commands\nimport pwndbg.gdblib\nfrom pwndbg.commands import load_commands\nfrom pwndbg.gdblib import load_gdblib\n\nload_commands()\nload_gdblib()\n\n# TODO: Convert these to gdblib modules and remove this\ntry:\n    import pwndbg.disasm\n    import pwndbg.disasm.arm\n    import pwndbg.disasm.jump\n    import pwndbg.disasm.mips\n    import pwndbg.disasm.ppc\n    import pwndbg.disasm.sparc\n    import pwndbg.disasm.x86\n    import pwndbg.heap\nexcept ModuleNotFoundError:\n    pass\n\nimport pwndbg.exception\nimport pwndbg.lib.version\nimport pwndbg.ui\n\n__version__ = pwndbg.lib.version.__version__\nversion = __version__\n\nfrom pwndbg.gdblib import prompt\n\nprompt.set_prompt()\n\npre_commands = \"\"\"\nset confirm off\nset verbose off\nset pagination off\nset height 0\nset history save on\nset follow-fork-mode child\nset backtrace past-main on\nset step-mode on\nset print pretty on\nset width %i\nhandle SIGALRM nostop print nopass\nhandle SIGBUS  stop   print nopass\nhandle SIGPIPE nostop print nopass\nhandle SIGSEGV stop   print nopass\n\"\"\".strip() % (\n    pwndbg.ui.get_window_size()[1]\n)\n\n# See https://github.com/pwndbg/pwndbg/issues/808\nif int(getattr(gdb, \"VERSION\", \"0.0\").split(\".\")[0]) <= 9:\n    pre_commands += \"\\nset remote search-memory-packet off\"\n\nfor line in pre_commands.strip().splitlines():\n    gdb.execute(line)\n\n# This may throw an exception, see pwndbg/pwndbg#27\ntry:\n    gdb.execute(\"set disassembly-flavor intel\")\nexcept gdb.error:\n    pass\n\n# handle resize event to align width and completion\nsignal.signal(\n    signal.SIGWINCH,\n    lambda signum, frame: gdb.execute(\"set width %i\" % pwndbg.ui.get_window_size()[1]),\n)\n\n# Reading Comment file\nfrom pwndbg.commands import comments\n\ncomments.init()\n\nfrom pwndbg.gdblib import config_mod\n\nconfig_mod.init_params()\n", "path": "pwndbg/__init__.py"}]}