We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
bugreport command: show more info
The bugreport command should display more information like:
* show osabi
* show architecture
* show endian

Depending on current arch -- note that those are only available if given arch is supported by current GDB, like `gdb-multiarch`:
* show arm
* show mips

Maybe also:
* show charset
* show width
* show height



--- 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/version.py`
Content:
```
1 """
2 Displays gdb, python and pwndbg versions.
3 """
4 
5 
6 import argparse
7 import os
8 import platform
9 import re
10 import sys
11 from subprocess import check_call
12 from subprocess import check_output
13 from tempfile import NamedTemporaryFile
14 from urllib.parse import quote
15 
16 import gdb
17 
18 import pwndbg
19 import pwndbg.commands
20 import pwndbg.ida
21 from pwndbg.color import message
22 from pwndbg.commands import CommandCategory
23 
24 
25 def _gdb_version():
26     try:
27         return gdb.VERSION  # GDB >= 8.1 (or earlier?)
28     except AttributeError:
29         return gdb.execute("show version", to_string=True).split("\n")[0]
30 
31 
32 def _py_version():
33     return sys.version.replace("\n", " ")
34 
35 
36 def capstone_version():
37     try:
38         import capstone
39 
40         return ".".join(map(str, capstone.cs_version()))
41     except ImportError:
42         return "not found"
43 
44 
45 def unicorn_version():
46     try:
47         import unicorn
48 
49         return unicorn.__version__
50     except ImportError:
51         return "not found"
52 
53 
54 def all_versions():
55     gdb_str = "Gdb:      %s" % _gdb_version()
56     py_str = "Python:   %s" % _py_version()
57     pwndbg_str = "Pwndbg:   %s" % pwndbg.__version__
58 
59     capstone_str = "Capstone: %s" % capstone_version()
60     unicorn_str = "Unicorn:  %s" % unicorn_version()
61 
62     all_versions = (gdb_str, py_str, pwndbg_str, capstone_str, unicorn_str)
63 
64     ida_versions = pwndbg.ida.get_ida_versions()
65 
66     if ida_versions is not None:
67         ida_version = "IDA PRO:  %s" % ida_versions["ida"]
68         ida_py_ver = "IDA Py:   %s" % ida_versions["python"]
69         ida_hr_ver = "Hexrays:  %s" % ida_versions["hexrays"]
70         all_versions += (ida_version, ida_py_ver, ida_hr_ver)
71     return all_versions
72 
73 
74 @pwndbg.commands.ArgparsedCommand(
75     "Displays GDB, Python, and pwndbg versions.", category=CommandCategory.PWNDBG
76 )
77 def version() -> None:
78     """
79     Displays GDB, Python, and pwndbg versions.
80     """
81     print("\n".join(map(message.system, all_versions())))
82 
83 
84 bugreport_parser = argparse.ArgumentParser(description="Generate a bug report.")
85 bugreport_group = bugreport_parser.add_mutually_exclusive_group()
86 bugreport_group.add_argument(
87     "--run-browser", "-b", action="store_true", help="Open browser on github/issues/new"
88 )
89 bugreport_group.add_argument(
90     "--use-gh", "-g", action="store_true", help="Create issue using Github CLI"
91 )
92 
93 
94 @pwndbg.commands.ArgparsedCommand(bugreport_parser, category=CommandCategory.PWNDBG)
95 def bugreport(run_browser=False, use_gh=False):
96     ISSUE_TEMPLATE = """
97 <!--
98 Before reporting a new issue, make sure that we do not have any duplicates already open.
99 If there is one it might be good to take part in the discussion there.
100 
101 Please make sure you have checked that the issue persists on LATEST pwndbg version.
102 
103 Below is a template for BUG REPORTS.
104 Don't include it if this is a FEATURE REQUEST.
105 -->
106 
107 
108 ### Description
109 
110 <!--
111 Briefly describe the problem you are having in a few paragraphs.
112 -->
113 
114 ### Steps to reproduce
115 
116 <!--
117 What do we have to do to reproduce the problem?
118 If this is connected to particular C/asm code or a binary,
119 please provide the binary or if possible, a smallest C code that reproduces the issue.
120 -->
121 
122 Gdb session history:
123 ```
124 {gdb_history}
125 ```
126 
127 ### My setup
128 
129 <!--
130 Show us your gdb/python/pwndbg/OS/IDA Pro version (depending on your case).
131 
132 NOTE: We are currently testing Pwndbg only on Ubuntu installations but it should work fine on other distros as well.
133 
134 This can be displayed in pwndbg through `version` command.
135 
136 If it is somehow unavailable, use:
137 * `show version` - for gdb
138 * `py import sys; print(sys.version)` - for python
139 * pwndbg version/git commit id
140 -->
141 
142 ```
143 {setup}
144 ```"""
145 
146     gdb_config = gdb.execute("show configuration", to_string=True).split("\n")
147     all_info = all_versions()
148     os_info = platform.system()
149 
150     current_setup = "Platform: %s\n" % platform.platform()
151 
152     if os_info.lower() == "linux" and os.path.isfile("/etc/os-release"):
153         with open("/etc/os-release", "r") as os_release:
154             contents = os_release.read()
155             match = re.search('PRETTY_NAME="?([^",\n]+)', contents)
156             if match:
157                 os_info = match.group(1)
158 
159     current_setup += "OS: %s\n" % os_info
160     current_setup += "\n".join(all_info)
161     current_setup += "\n" + "\n".join(gdb_config)
162 
163     # get saved history size (not including current gdb session)
164     gdb_history_file = gdb.execute("show history filename", to_string=True)
165     gdb_history_file = gdb_history_file[
166         gdb_history_file.index('"') + 1 : gdb_history_file.rindex('"')
167     ]
168     gdb_history_len = 0
169     try:
170         with open(gdb_history_file, "r") as f:
171             gdb_history_len = len(f.readlines())
172     except FileNotFoundError:
173         pass
174 
175     max_command_no = 0
176     history_commands = gdb.execute("show commands", to_string=True)
177     if history_commands:
178         history_commands = history_commands.split("\n")
179         if len(history_commands) > 1:
180             # The last element of the list is the `show commands` command we
181             # just ran, so we need to get the second to last one
182             last_command = history_commands[-2]
183             max_command_no = int(last_command.split()[0]) - 1
184 
185     show_command_size = 10  # 'show command' returns 10 commands
186     gdb_current_session_history = {}
187     current_command_no = gdb_history_len + 1
188 
189     while current_command_no <= max_command_no:
190         cmds = gdb.execute(
191             "show commands " + str(current_command_no + (show_command_size // 2) + 1),
192             to_string=True,
193         ).split("\n")[:-1]
194         for cmd in cmds:
195             cmd_no, cmd = cmd.split(maxsplit=1)
196             cmd_no = int(cmd_no)
197             if cmd_no <= gdb_history_len:
198                 continue
199             if current_command_no > max_command_no:
200                 break
201             gdb_current_session_history[cmd_no] = cmd
202             current_command_no += 1
203 
204     gdb_current_session_history = (v for (k, v) in sorted(gdb_current_session_history.items()))
205     gdb_current_session_history = "\n".join(gdb_current_session_history)
206 
207     issue_bugreport = ISSUE_TEMPLATE.format(
208         gdb_history=gdb_current_session_history, setup=current_setup
209     )
210     print(issue_bugreport)
211 
212     please_please_submit = "Please submit the bugreport generated above at "
213     github_issue_url = "https://github.com/pwndbg/pwndbg/issues/new"
214     github_issue_body = "?body=" + quote(issue_bugreport)
215 
216     if use_gh:
217         try:
218             with NamedTemporaryFile("w", delete=True) as f:
219                 f.write(issue_bugreport)
220                 f.flush()
221                 check_call([os.environ.get("EDITOR", "vi"), f.name])
222                 check_call(["gh", "issue", "create", "--body-file", f.name])
223         except Exception:
224             print(please_please_submit + github_issue_url)
225             raise
226     elif run_browser:
227         try:
228             check_output(["xdg-open", github_issue_url + github_issue_body])
229         except Exception:
230             print(please_please_submit + github_issue_url)
231     else:
232         print(please_please_submit + github_issue_url)
233
```
--- 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/version.py b/pwndbg/commands/version.py
--- a/pwndbg/commands/version.py
+++ b/pwndbg/commands/version.py
@@ -157,6 +157,40 @@
                 os_info = match.group(1)
 
     current_setup += "OS: %s\n" % os_info
+
+    # 1. showing osabi
+    osabi_info = platform.uname().version
+    current_setup += "OS ABI: %s\n" % osabi_info
+
+    # 2. showing architecture
+    arch_info = platform.machine()
+    current_setup += "Architecture: %s\n" % arch_info
+
+    # 3. showing endian
+    endian_info = sys.byteorder
+    current_setup += "Endian: %s\n" % endian_info
+
+    # 4. Depending on current arch -- note that those are only available if given arch is supported by current GDB, like gdb-multiarch
+    if arch_info in ["armv7l", "aarch64"]:
+        arm_info = gdb.execute("show arm", to_string=True)
+        current_setup += "ARM: %s\n" % arm_info
+
+    elif arch_info in ["mips", "mips64"]:
+        mips_info = gdb.execute("show mips", to_string=True)
+        current_setup += "MIPS: %s\n" % mips_info
+
+    # 7. showing charset
+    charset_info = sys.getdefaultencoding()
+    current_setup += "Charset: %s\n" % charset_info
+
+    # 8. showing width
+    width_info = os.get_terminal_size().columns
+    current_setup += "Width: %s\n" % width_info
+
+    # 9. showing height
+    height_info = os.get_terminal_size().lines
+    current_setup += "Height: %s\n" % height_info
+
     current_setup += "\n".join(all_info)
     current_setup += "\n" + "\n".join(gdb_config)

{"golden_diff": "diff --git a/pwndbg/commands/version.py b/pwndbg/commands/version.py\n--- a/pwndbg/commands/version.py\n+++ b/pwndbg/commands/version.py\n@@ -157,6 +157,40 @@\n                 os_info = match.group(1)\n \n     current_setup += \"OS: %s\\n\" % os_info\n+\n+    # 1. showing osabi\n+    osabi_info = platform.uname().version\n+    current_setup += \"OS ABI: %s\\n\" % osabi_info\n+\n+    # 2. showing architecture\n+    arch_info = platform.machine()\n+    current_setup += \"Architecture: %s\\n\" % arch_info\n+\n+    # 3. showing endian\n+    endian_info = sys.byteorder\n+    current_setup += \"Endian: %s\\n\" % endian_info\n+\n+    # 4. Depending on current arch -- note that those are only available if given arch is supported by current GDB, like gdb-multiarch\n+    if arch_info in [\"armv7l\", \"aarch64\"]:\n+        arm_info = gdb.execute(\"show arm\", to_string=True)\n+        current_setup += \"ARM: %s\\n\" % arm_info\n+\n+    elif arch_info in [\"mips\", \"mips64\"]:\n+        mips_info = gdb.execute(\"show mips\", to_string=True)\n+        current_setup += \"MIPS: %s\\n\" % mips_info\n+\n+    # 7. showing charset\n+    charset_info = sys.getdefaultencoding()\n+    current_setup += \"Charset: %s\\n\" % charset_info\n+\n+    # 8. showing width\n+    width_info = os.get_terminal_size().columns\n+    current_setup += \"Width: %s\\n\" % width_info\n+\n+    # 9. showing height\n+    height_info = os.get_terminal_size().lines\n+    current_setup += \"Height: %s\\n\" % height_info\n+\n     current_setup += \"\\n\".join(all_info)\n     current_setup += \"\\n\" + \"\\n\".join(gdb_config)\n", "issue": "bugreport command: show more info\nThe bugreport command should display more information like:\r\n* show osabi\r\n* show architecture\r\n* show endian\r\n\r\nDepending on current arch -- note that those are only available if given arch is supported by current GDB, like `gdb-multiarch`:\r\n* show arm\r\n* show mips\r\n\r\nMaybe also:\r\n* show charset\r\n* show width\r\n* show height\r\n\r\n\n", "before_files": [{"content": "\"\"\"\nDisplays gdb, python and pwndbg versions.\n\"\"\"\n\n\nimport argparse\nimport os\nimport platform\nimport re\nimport sys\nfrom subprocess import check_call\nfrom subprocess import check_output\nfrom tempfile import NamedTemporaryFile\nfrom urllib.parse import quote\n\nimport gdb\n\nimport pwndbg\nimport pwndbg.commands\nimport pwndbg.ida\nfrom pwndbg.color import message\nfrom pwndbg.commands import CommandCategory\n\n\ndef _gdb_version():\n    try:\n        return gdb.VERSION  # GDB >= 8.1 (or earlier?)\n    except AttributeError:\n        return gdb.execute(\"show version\", to_string=True).split(\"\\n\")[0]\n\n\ndef _py_version():\n    return sys.version.replace(\"\\n\", \" \")\n\n\ndef capstone_version():\n    try:\n        import capstone\n\n        return \".\".join(map(str, capstone.cs_version()))\n    except ImportError:\n        return \"not found\"\n\n\ndef unicorn_version():\n    try:\n        import unicorn\n\n        return unicorn.__version__\n    except ImportError:\n        return \"not found\"\n\n\ndef all_versions():\n    gdb_str = \"Gdb:      %s\" % _gdb_version()\n    py_str = \"Python:   %s\" % _py_version()\n    pwndbg_str = \"Pwndbg:   %s\" % pwndbg.__version__\n\n    capstone_str = \"Capstone: %s\" % capstone_version()\n    unicorn_str = \"Unicorn:  %s\" % unicorn_version()\n\n    all_versions = (gdb_str, py_str, pwndbg_str, capstone_str, unicorn_str)\n\n    ida_versions = pwndbg.ida.get_ida_versions()\n\n    if ida_versions is not None:\n        ida_version = \"IDA PRO:  %s\" % ida_versions[\"ida\"]\n        ida_py_ver = \"IDA Py:   %s\" % ida_versions[\"python\"]\n        ida_hr_ver = \"Hexrays:  %s\" % ida_versions[\"hexrays\"]\n        all_versions += (ida_version, ida_py_ver, ida_hr_ver)\n    return all_versions\n\n\n@pwndbg.commands.ArgparsedCommand(\n    \"Displays GDB, Python, and pwndbg versions.\", category=CommandCategory.PWNDBG\n)\ndef version() -> None:\n    \"\"\"\n    Displays GDB, Python, and pwndbg versions.\n    \"\"\"\n    print(\"\\n\".join(map(message.system, all_versions())))\n\n\nbugreport_parser = argparse.ArgumentParser(description=\"Generate a bug report.\")\nbugreport_group = bugreport_parser.add_mutually_exclusive_group()\nbugreport_group.add_argument(\n    \"--run-browser\", \"-b\", action=\"store_true\", help=\"Open browser on github/issues/new\"\n)\nbugreport_group.add_argument(\n    \"--use-gh\", \"-g\", action=\"store_true\", help=\"Create issue using Github CLI\"\n)\n\n\n@pwndbg.commands.ArgparsedCommand(bugreport_parser, category=CommandCategory.PWNDBG)\ndef bugreport(run_browser=False, use_gh=False):\n    ISSUE_TEMPLATE = \"\"\"\n<!--\nBefore reporting a new issue, make sure that we do not have any duplicates already open.\nIf there is one it might be good to take part in the discussion there.\n\nPlease make sure you have checked that the issue persists on LATEST pwndbg version.\n\nBelow is a template for BUG REPORTS.\nDon't include it if this is a FEATURE REQUEST.\n-->\n\n\n### Description\n\n<!--\nBriefly describe the problem you are having in a few paragraphs.\n-->\n\n### Steps to reproduce\n\n<!--\nWhat do we have to do to reproduce the problem?\nIf this is connected to particular C/asm code or a binary,\nplease provide the binary or if possible, a smallest C code that reproduces the issue.\n-->\n\nGdb session history:\n```\n{gdb_history}\n```\n\n### My setup\n\n<!--\nShow us your gdb/python/pwndbg/OS/IDA Pro version (depending on your case).\n\nNOTE: We are currently testing Pwndbg only on Ubuntu installations but it should work fine on other distros as well.\n\nThis can be displayed in pwndbg through `version` command.\n\nIf it is somehow unavailable, use:\n* `show version` - for gdb\n* `py import sys; print(sys.version)` - for python\n* pwndbg version/git commit id\n-->\n\n```\n{setup}\n```\"\"\"\n\n    gdb_config = gdb.execute(\"show configuration\", to_string=True).split(\"\\n\")\n    all_info = all_versions()\n    os_info = platform.system()\n\n    current_setup = \"Platform: %s\\n\" % platform.platform()\n\n    if os_info.lower() == \"linux\" and os.path.isfile(\"/etc/os-release\"):\n        with open(\"/etc/os-release\", \"r\") as os_release:\n            contents = os_release.read()\n            match = re.search('PRETTY_NAME=\"?([^\",\\n]+)', contents)\n            if match:\n                os_info = match.group(1)\n\n    current_setup += \"OS: %s\\n\" % os_info\n    current_setup += \"\\n\".join(all_info)\n    current_setup += \"\\n\" + \"\\n\".join(gdb_config)\n\n    # get saved history size (not including current gdb session)\n    gdb_history_file = gdb.execute(\"show history filename\", to_string=True)\n    gdb_history_file = gdb_history_file[\n        gdb_history_file.index('\"') + 1 : gdb_history_file.rindex('\"')\n    ]\n    gdb_history_len = 0\n    try:\n        with open(gdb_history_file, \"r\") as f:\n            gdb_history_len = len(f.readlines())\n    except FileNotFoundError:\n        pass\n\n    max_command_no = 0\n    history_commands = gdb.execute(\"show commands\", to_string=True)\n    if history_commands:\n        history_commands = history_commands.split(\"\\n\")\n        if len(history_commands) > 1:\n            # The last element of the list is the `show commands` command we\n            # just ran, so we need to get the second to last one\n            last_command = history_commands[-2]\n            max_command_no = int(last_command.split()[0]) - 1\n\n    show_command_size = 10  # 'show command' returns 10 commands\n    gdb_current_session_history = {}\n    current_command_no = gdb_history_len + 1\n\n    while current_command_no <= max_command_no:\n        cmds = gdb.execute(\n            \"show commands \" + str(current_command_no + (show_command_size // 2) + 1),\n            to_string=True,\n        ).split(\"\\n\")[:-1]\n        for cmd in cmds:\n            cmd_no, cmd = cmd.split(maxsplit=1)\n            cmd_no = int(cmd_no)\n            if cmd_no <= gdb_history_len:\n                continue\n            if current_command_no > max_command_no:\n                break\n            gdb_current_session_history[cmd_no] = cmd\n            current_command_no += 1\n\n    gdb_current_session_history = (v for (k, v) in sorted(gdb_current_session_history.items()))\n    gdb_current_session_history = \"\\n\".join(gdb_current_session_history)\n\n    issue_bugreport = ISSUE_TEMPLATE.format(\n        gdb_history=gdb_current_session_history, setup=current_setup\n    )\n    print(issue_bugreport)\n\n    please_please_submit = \"Please submit the bugreport generated above at \"\n    github_issue_url = \"https://github.com/pwndbg/pwndbg/issues/new\"\n    github_issue_body = \"?body=\" + quote(issue_bugreport)\n\n    if use_gh:\n        try:\n            with NamedTemporaryFile(\"w\", delete=True) as f:\n                f.write(issue_bugreport)\n                f.flush()\n                check_call([os.environ.get(\"EDITOR\", \"vi\"), f.name])\n                check_call([\"gh\", \"issue\", \"create\", \"--body-file\", f.name])\n        except Exception:\n            print(please_please_submit + github_issue_url)\n            raise\n    elif run_browser:\n        try:\n            check_output([\"xdg-open\", github_issue_url + github_issue_body])\n        except Exception:\n            print(please_please_submit + github_issue_url)\n    else:\n        print(please_please_submit + github_issue_url)\n", "path": "pwndbg/commands/version.py"}], "after_files": [{"content": "\"\"\"\nDisplays gdb, python and pwndbg versions.\n\"\"\"\n\n\nimport argparse\nimport os\nimport platform\nimport re\nimport sys\nfrom subprocess import check_call\nfrom subprocess import check_output\nfrom tempfile import NamedTemporaryFile\nfrom urllib.parse import quote\n\nimport gdb\n\nimport pwndbg\nimport pwndbg.commands\nimport pwndbg.ida\nfrom pwndbg.color import message\nfrom pwndbg.commands import CommandCategory\n\n\ndef _gdb_version():\n    try:\n        return gdb.VERSION  # GDB >= 8.1 (or earlier?)\n    except AttributeError:\n        return gdb.execute(\"show version\", to_string=True).split(\"\\n\")[0]\n\n\ndef _py_version():\n    return sys.version.replace(\"\\n\", \" \")\n\n\ndef capstone_version():\n    try:\n        import capstone\n\n        return \".\".join(map(str, capstone.cs_version()))\n    except ImportError:\n        return \"not found\"\n\n\ndef unicorn_version():\n    try:\n        import unicorn\n\n        return unicorn.__version__\n    except ImportError:\n        return \"not found\"\n\n\ndef all_versions():\n    gdb_str = \"Gdb:      %s\" % _gdb_version()\n    py_str = \"Python:   %s\" % _py_version()\n    pwndbg_str = \"Pwndbg:   %s\" % pwndbg.__version__\n\n    capstone_str = \"Capstone: %s\" % capstone_version()\n    unicorn_str = \"Unicorn:  %s\" % unicorn_version()\n\n    all_versions = (gdb_str, py_str, pwndbg_str, capstone_str, unicorn_str)\n\n    ida_versions = pwndbg.ida.get_ida_versions()\n\n    if ida_versions is not None:\n        ida_version = \"IDA PRO:  %s\" % ida_versions[\"ida\"]\n        ida_py_ver = \"IDA Py:   %s\" % ida_versions[\"python\"]\n        ida_hr_ver = \"Hexrays:  %s\" % ida_versions[\"hexrays\"]\n        all_versions += (ida_version, ida_py_ver, ida_hr_ver)\n    return all_versions\n\n\n@pwndbg.commands.ArgparsedCommand(\n    \"Displays GDB, Python, and pwndbg versions.\", category=CommandCategory.PWNDBG\n)\ndef version() -> None:\n    \"\"\"\n    Displays GDB, Python, and pwndbg versions.\n    \"\"\"\n    print(\"\\n\".join(map(message.system, all_versions())))\n\n\nbugreport_parser = argparse.ArgumentParser(description=\"Generate a bug report.\")\nbugreport_group = bugreport_parser.add_mutually_exclusive_group()\nbugreport_group.add_argument(\n    \"--run-browser\", \"-b\", action=\"store_true\", help=\"Open browser on github/issues/new\"\n)\nbugreport_group.add_argument(\n    \"--use-gh\", \"-g\", action=\"store_true\", help=\"Create issue using Github CLI\"\n)\n\n\n@pwndbg.commands.ArgparsedCommand(bugreport_parser, category=CommandCategory.PWNDBG)\ndef bugreport(run_browser=False, use_gh=False):\n    ISSUE_TEMPLATE = \"\"\"\n<!--\nBefore reporting a new issue, make sure that we do not have any duplicates already open.\nIf there is one it might be good to take part in the discussion there.\n\nPlease make sure you have checked that the issue persists on LATEST pwndbg version.\n\nBelow is a template for BUG REPORTS.\nDon't include it if this is a FEATURE REQUEST.\n-->\n\n\n### Description\n\n<!--\nBriefly describe the problem you are having in a few paragraphs.\n-->\n\n### Steps to reproduce\n\n<!--\nWhat do we have to do to reproduce the problem?\nIf this is connected to particular C/asm code or a binary,\nplease provide the binary or if possible, a smallest C code that reproduces the issue.\n-->\n\nGdb session history:\n```\n{gdb_history}\n```\n\n### My setup\n\n<!--\nShow us your gdb/python/pwndbg/OS/IDA Pro version (depending on your case).\n\nNOTE: We are currently testing Pwndbg only on Ubuntu installations but it should work fine on other distros as well.\n\nThis can be displayed in pwndbg through `version` command.\n\nIf it is somehow unavailable, use:\n* `show version` - for gdb\n* `py import sys; print(sys.version)` - for python\n* pwndbg version/git commit id\n-->\n\n```\n{setup}\n```\"\"\"\n\n    gdb_config = gdb.execute(\"show configuration\", to_string=True).split(\"\\n\")\n    all_info = all_versions()\n    os_info = platform.system()\n\n    current_setup = \"Platform: %s\\n\" % platform.platform()\n\n    if os_info.lower() == \"linux\" and os.path.isfile(\"/etc/os-release\"):\n        with open(\"/etc/os-release\", \"r\") as os_release:\n            contents = os_release.read()\n            match = re.search('PRETTY_NAME=\"?([^\",\\n]+)', contents)\n            if match:\n                os_info = match.group(1)\n\n    current_setup += \"OS: %s\\n\" % os_info\n\n    # 1. showing osabi\n    osabi_info = platform.uname().version\n    current_setup += \"OS ABI: %s\\n\" % osabi_info\n\n    # 2. showing architecture\n    arch_info = platform.machine()\n    current_setup += \"Architecture: %s\\n\" % arch_info\n\n    # 3. showing endian\n    endian_info = sys.byteorder\n    current_setup += \"Endian: %s\\n\" % endian_info\n\n    # 4. Depending on current arch -- note that those are only available if given arch is supported by current GDB, like gdb-multiarch\n    if arch_info in [\"armv7l\", \"aarch64\"]:\n        arm_info = gdb.execute(\"show arm\", to_string=True)\n        current_setup += \"ARM: %s\\n\" % arm_info\n\n    elif arch_info in [\"mips\", \"mips64\"]:\n        mips_info = gdb.execute(\"show mips\", to_string=True)\n        current_setup += \"MIPS: %s\\n\" % mips_info\n\n    # 7. showing charset\n    charset_info = sys.getdefaultencoding()\n    current_setup += \"Charset: %s\\n\" % charset_info\n\n    # 8. showing width\n    width_info = os.get_terminal_size().columns\n    current_setup += \"Width: %s\\n\" % width_info\n\n    # 9. showing height\n    height_info = os.get_terminal_size().lines\n    current_setup += \"Height: %s\\n\" % height_info\n\n    current_setup += \"\\n\".join(all_info)\n    current_setup += \"\\n\" + \"\\n\".join(gdb_config)\n\n    # get saved history size (not including current gdb session)\n    gdb_history_file = gdb.execute(\"show history filename\", to_string=True)\n    gdb_history_file = gdb_history_file[\n        gdb_history_file.index('\"') + 1 : gdb_history_file.rindex('\"')\n    ]\n    gdb_history_len = 0\n    try:\n        with open(gdb_history_file, \"r\") as f:\n            gdb_history_len = len(f.readlines())\n    except FileNotFoundError:\n        pass\n\n    max_command_no = 0\n    history_commands = gdb.execute(\"show commands\", to_string=True)\n    if history_commands:\n        history_commands = history_commands.split(\"\\n\")\n        if len(history_commands) > 1:\n            # The last element of the list is the `show commands` command we\n            # just ran, so we need to get the second to last one\n            last_command = history_commands[-2]\n            max_command_no = int(last_command.split()[0]) - 1\n\n    show_command_size = 10  # 'show command' returns 10 commands\n    gdb_current_session_history = {}\n    current_command_no = gdb_history_len + 1\n\n    while current_command_no <= max_command_no:\n        cmds = gdb.execute(\n            \"show commands \" + str(current_command_no + (show_command_size // 2) + 1),\n            to_string=True,\n        ).split(\"\\n\")[:-1]\n        for cmd in cmds:\n            cmd_no, cmd = cmd.split(maxsplit=1)\n            cmd_no = int(cmd_no)\n            if cmd_no <= gdb_history_len:\n                continue\n            if current_command_no > max_command_no:\n                break\n            gdb_current_session_history[cmd_no] = cmd\n            current_command_no += 1\n\n    gdb_current_session_history = (v for (k, v) in sorted(gdb_current_session_history.items()))\n    gdb_current_session_history = \"\\n\".join(gdb_current_session_history)\n\n    issue_bugreport = ISSUE_TEMPLATE.format(\n        gdb_history=gdb_current_session_history, setup=current_setup\n    )\n    print(issue_bugreport)\n\n    please_please_submit = \"Please submit the bugreport generated above at \"\n    github_issue_url = \"https://github.com/pwndbg/pwndbg/issues/new\"\n    github_issue_body = \"?body=\" + quote(issue_bugreport)\n\n    if use_gh:\n        try:\n            with NamedTemporaryFile(\"w\", delete=True) as f:\n                f.write(issue_bugreport)\n                f.flush()\n                check_call([os.environ.get(\"EDITOR\", \"vi\"), f.name])\n                check_call([\"gh\", \"issue\", \"create\", \"--body-file\", f.name])\n        except Exception:\n            print(please_please_submit + github_issue_url)\n            raise\n    elif run_browser:\n        try:\n            check_output([\"xdg-open\", github_issue_url + github_issue_body])\n        except Exception:\n            print(please_please_submit + github_issue_url)\n    else:\n        print(please_please_submit + github_issue_url)\n", "path": "pwndbg/commands/version.py"}]}