We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
ipi doesn't work with multiline inputs
TL;DR:
<img width="550" alt="image" src="https://user-images.githubusercontent.com/10009354/193942063-af410d4d-3cdd-4bcb-a102-9bb87d101656.png">

```
pwndbg> ipi

In [1]: from ctypes import *

In [2]: class A(LittleEndianStructure):
   ...:     a = LittleEndianStructure
   ...:
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-2-814bd2a1d7ec> in <module>
----> 1 class A(LittleEndianStructure):
      2     a = LittleEndianStructure
      3

<ipython-input-2-814bd2a1d7ec> in A()
      1 class A(LittleEndianStructure):
----> 2     a = LittleEndianStructure
      3

NameError: name 'LittleEndianStructure' is not defined

In [3]: ctypes
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-3-8c9cdb26e3f3> in <module>
----> 1 ctypes

NameError: name 'ctypes' is not defined

In [4]: LittleEndianStructure
Out[4]: _ctypes.Structure

In [5]: def foo():
   ...:     return LittleEndianStructure
   ...:

In [6]: foo()
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-6-c19b6d9633cf> in <module>
----> 1 foo()

<ipython-input-5-0b19aa36e370> in foo()
      1 def foo():
----> 2     return LittleEndianStructure
      3

NameError: name 'LittleEndianStructure' is not defined

In [7]:
```

--- 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/ipython_interactive.py`
Content:
```
1 """
2 Command to start an interactive IPython prompt.
3 """
4 import sys
5 from contextlib import contextmanager
6 
7 import gdb
8 
9 import pwndbg.color.message as M
10 import pwndbg.commands
11 import pwndbg.lib.stdio
12 
13 
14 @contextmanager
15 def switch_to_ipython_env():
16     """We need to change stdout/stderr to the default ones, otherwise we can't use tab or autocomplete"""
17     # Save GDB's excepthook
18     saved_excepthook = sys.excepthook
19     # Switch to default stdout/stderr
20     with pwndbg.lib.stdio.stdio:
21         yield
22     # Restore Python's default ps1, ps2, and excepthook for GDB's `pi` command
23     sys.ps1 = ">>> "
24     sys.ps2 = "... "
25     sys.excepthook = saved_excepthook
26 
27 
28 @pwndbg.commands.ArgparsedCommand("Start an interactive IPython prompt.")
29 def ipi():
30     with switch_to_ipython_env():
31         # Use `gdb.execute` to embed IPython into GDB's variable scope
32         try:
33             gdb.execute("pi import IPython")
34         except gdb.error:
35             print(
36                 M.warn(
37                     "Cannot import IPython.\n"
38                     "You need to install IPython if you want to use this command.\n"
39                     "Maybe you can try `pip install ipython` first."
40                 )
41             )
42             return
43         code4ipython = """import jedi
44 import pwn
45 jedi.Interpreter._allow_descriptor_getattr_default = False
46 IPython.embed(colors='neutral',banner1='',confirm_exit=False,simple_prompt=False)
47 """
48         gdb.execute(f"py\n{code4ipython}")
49
```
--- 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/ipython_interactive.py b/pwndbg/commands/ipython_interactive.py
--- a/pwndbg/commands/ipython_interactive.py
+++ b/pwndbg/commands/ipython_interactive.py
@@ -43,6 +43,6 @@
         code4ipython = """import jedi
 import pwn
 jedi.Interpreter._allow_descriptor_getattr_default = False
-IPython.embed(colors='neutral',banner1='',confirm_exit=False,simple_prompt=False)
+IPython.embed(colors='neutral',banner1='',confirm_exit=False,simple_prompt=False, user_ns=globals())
 """
         gdb.execute(f"py\n{code4ipython}")

{"golden_diff": "diff --git a/pwndbg/commands/ipython_interactive.py b/pwndbg/commands/ipython_interactive.py\n--- a/pwndbg/commands/ipython_interactive.py\n+++ b/pwndbg/commands/ipython_interactive.py\n@@ -43,6 +43,6 @@\n         code4ipython = \"\"\"import jedi\n import pwn\n jedi.Interpreter._allow_descriptor_getattr_default = False\n-IPython.embed(colors='neutral',banner1='',confirm_exit=False,simple_prompt=False)\n+IPython.embed(colors='neutral',banner1='',confirm_exit=False,simple_prompt=False, user_ns=globals())\n \"\"\"\n         gdb.execute(f\"py\\n{code4ipython}\")\n", "issue": "ipi doesn't work with multiline inputs\nTL;DR:\r\n<img width=\"550\" alt=\"image\" src=\"https://user-images.githubusercontent.com/10009354/193942063-af410d4d-3cdd-4bcb-a102-9bb87d101656.png\">\r\n\r\n```\r\npwndbg> ipi\r\n\r\nIn [1]: from ctypes import *\r\n\r\nIn [2]: class A(LittleEndianStructure):\r\n   ...:     a = LittleEndianStructure\r\n   ...:\r\n---------------------------------------------------------------------------\r\nNameError                                 Traceback (most recent call last)\r\n<ipython-input-2-814bd2a1d7ec> in <module>\r\n----> 1 class A(LittleEndianStructure):\r\n      2     a = LittleEndianStructure\r\n      3\r\n\r\n<ipython-input-2-814bd2a1d7ec> in A()\r\n      1 class A(LittleEndianStructure):\r\n----> 2     a = LittleEndianStructure\r\n      3\r\n\r\nNameError: name 'LittleEndianStructure' is not defined\r\n\r\nIn [3]: ctypes\r\n---------------------------------------------------------------------------\r\nNameError                                 Traceback (most recent call last)\r\n<ipython-input-3-8c9cdb26e3f3> in <module>\r\n----> 1 ctypes\r\n\r\nNameError: name 'ctypes' is not defined\r\n\r\nIn [4]: LittleEndianStructure\r\nOut[4]: _ctypes.Structure\r\n\r\nIn [5]: def foo():\r\n   ...:     return LittleEndianStructure\r\n   ...:\r\n\r\nIn [6]: foo()\r\n---------------------------------------------------------------------------\r\nNameError                                 Traceback (most recent call last)\r\n<ipython-input-6-c19b6d9633cf> in <module>\r\n----> 1 foo()\r\n\r\n<ipython-input-5-0b19aa36e370> in foo()\r\n      1 def foo():\r\n----> 2     return LittleEndianStructure\r\n      3\r\n\r\nNameError: name 'LittleEndianStructure' is not defined\r\n\r\nIn [7]:\r\n```\n", "before_files": [{"content": "\"\"\"\nCommand to start an interactive IPython prompt.\n\"\"\"\nimport sys\nfrom contextlib import contextmanager\n\nimport gdb\n\nimport pwndbg.color.message as M\nimport pwndbg.commands\nimport pwndbg.lib.stdio\n\n\n@contextmanager\ndef switch_to_ipython_env():\n    \"\"\"We need to change stdout/stderr to the default ones, otherwise we can't use tab or autocomplete\"\"\"\n    # Save GDB's excepthook\n    saved_excepthook = sys.excepthook\n    # Switch to default stdout/stderr\n    with pwndbg.lib.stdio.stdio:\n        yield\n    # Restore Python's default ps1, ps2, and excepthook for GDB's `pi` command\n    sys.ps1 = \">>> \"\n    sys.ps2 = \"... \"\n    sys.excepthook = saved_excepthook\n\n\n@pwndbg.commands.ArgparsedCommand(\"Start an interactive IPython prompt.\")\ndef ipi():\n    with switch_to_ipython_env():\n        # Use `gdb.execute` to embed IPython into GDB's variable scope\n        try:\n            gdb.execute(\"pi import IPython\")\n        except gdb.error:\n            print(\n                M.warn(\n                    \"Cannot import IPython.\\n\"\n                    \"You need to install IPython if you want to use this command.\\n\"\n                    \"Maybe you can try `pip install ipython` first.\"\n                )\n            )\n            return\n        code4ipython = \"\"\"import jedi\nimport pwn\njedi.Interpreter._allow_descriptor_getattr_default = False\nIPython.embed(colors='neutral',banner1='',confirm_exit=False,simple_prompt=False)\n\"\"\"\n        gdb.execute(f\"py\\n{code4ipython}\")\n", "path": "pwndbg/commands/ipython_interactive.py"}], "after_files": [{"content": "\"\"\"\nCommand to start an interactive IPython prompt.\n\"\"\"\nimport sys\nfrom contextlib import contextmanager\n\nimport gdb\n\nimport pwndbg.color.message as M\nimport pwndbg.commands\nimport pwndbg.lib.stdio\n\n\n@contextmanager\ndef switch_to_ipython_env():\n    \"\"\"We need to change stdout/stderr to the default ones, otherwise we can't use tab or autocomplete\"\"\"\n    # Save GDB's excepthook\n    saved_excepthook = sys.excepthook\n    # Switch to default stdout/stderr\n    with pwndbg.lib.stdio.stdio:\n        yield\n    # Restore Python's default ps1, ps2, and excepthook for GDB's `pi` command\n    sys.ps1 = \">>> \"\n    sys.ps2 = \"... \"\n    sys.excepthook = saved_excepthook\n\n\n@pwndbg.commands.ArgparsedCommand(\"Start an interactive IPython prompt.\")\ndef ipi():\n    with switch_to_ipython_env():\n        # Use `gdb.execute` to embed IPython into GDB's variable scope\n        try:\n            gdb.execute(\"pi import IPython\")\n        except gdb.error:\n            print(\n                M.warn(\n                    \"Cannot import IPython.\\n\"\n                    \"You need to install IPython if you want to use this command.\\n\"\n                    \"Maybe you can try `pip install ipython` first.\"\n                )\n            )\n            return\n        code4ipython = \"\"\"import jedi\nimport pwn\njedi.Interpreter._allow_descriptor_getattr_default = False\nIPython.embed(colors='neutral',banner1='',confirm_exit=False,simple_prompt=False, user_ns=globals())\n\"\"\"\n        gdb.execute(f\"py\\n{code4ipython}\")\n", "path": "pwndbg/commands/ipython_interactive.py"}]}