We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Pwndbg failing with GDB using language different than English
### Description

After installing pwndbg with a GDB that uses Spanish language we do fail on detecting whether `osabi` is Linux.

This happens after launching GDB:
https://prnt.sc/itwf3u

And this is the return of `show osabi` for GDB with spanish language:
```
(gdb) show osabi                                     
El actual SO ABI es «auto» (actualmente «GNU/Linux»).
El SO ABI predeterminado es «GNU/Linux».             
```

This is the code responsible for failure:
https://github.com/pwndbg/pwndbg/blob/dev/pwndbg/abi.py#L127-L140



--- 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/abi.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 from __future__ import absolute_import
3 from __future__ import division
4 from __future__ import print_function
5 from __future__ import unicode_literals
6 
7 import functools
8 import re
9 
10 import gdb
11 
12 import pwndbg.arch
13 import pwndbg.color.message as M
14 
15 
16 class ABI(object):
17     """
18     Encapsulates information about a calling convention.
19     """
20     #: List or registers which should be filled with arguments before
21     #: spilling onto the stack.
22     register_arguments = []
23 
24     #: Minimum alignment of the stack.
25     #: The value used is min(context.bytes, stack_alignment)
26     #: This is necessary as Windows x64 frames must be 32-byte aligned.
27     #: "Alignment" is considered with respect to the last argument on the stack.
28     arg_alignment    = 1
29 
30     #: Minimum number of stack slots used by a function call
31     #: This is necessary as Windows x64 requires using 4 slots on the stack
32     stack_minimum      = 0
33 
34     #: Indicates that this ABI returns to the next address on the slot
35     returns            = True
36 
37     def __init__(self, regs, align, minimum):
38         self.register_arguments = regs
39         self.arg_alignment      = align
40         self.stack_minimum      = minimum
41 
42     @staticmethod
43     def default():
44         return {
45         (32, 'i386', 'linux'):  linux_i386,
46         (64, 'x86-64', 'linux'): linux_amd64,
47         (64, 'aarch64', 'linux'): linux_aarch64,
48         (32, 'arm', 'linux'):   linux_arm,
49         (32, 'thumb', 'linux'):   linux_arm,
50         (32, 'mips', 'linux'):   linux_mips,
51         (32, 'powerpc', 'linux'): linux_ppc,
52         (64, 'powerpc', 'linux'): linux_ppc64,
53         }[(8*pwndbg.arch.ptrsize, pwndbg.arch.current, 'linux')]
54 
55     @staticmethod
56     def syscall():
57         return {
58         (32, 'i386', 'linux'):  linux_i386_syscall,
59         (64, 'x86-64', 'linux'): linux_amd64_syscall,
60         (64, 'aarch64', 'linux'): linux_aarch64_syscall,
61         (32, 'arm', 'linux'):   linux_arm_syscall,
62         (32, 'thumb', 'linux'):   linux_arm_syscall,
63         (32, 'mips', 'linux'):   linux_mips_syscall,
64         (32, 'powerpc', 'linux'): linux_ppc_syscall,
65         (64, 'powerpc', 'linux'): linux_ppc64_syscall,
66         }[(8*pwndbg.arch.ptrsize, pwndbg.arch.current, 'linux')]
67 
68     @staticmethod
69     def sigreturn():
70         return {
71         (32, 'i386', 'linux'):  linux_i386_sigreturn,
72         (64, 'x86-64', 'linux'): linux_amd64_sigreturn,
73         (32, 'arm', 'linux'):   linux_arm_sigreturn,
74         (32, 'thumb', 'linux'):   linux_arm_sigreturn,
75         }[(8*pwndbg.arch.ptrsize, pwndbg.arch.current, 'linux')]
76 
77 class SyscallABI(ABI):
78     """
79     The syscall ABI treats the syscall number as the zeroth argument,
80     which must be loaded into the specified register.
81     """
82     def __init__(self, register_arguments, *a, **kw):
83         self.syscall_register = register_arguments.pop(0)
84         super(SyscallABI, self).__init__(register_arguments, *a, **kw)
85 
86 
87 class SigreturnABI(SyscallABI):
88     """
89     The sigreturn ABI is similar to the syscall ABI, except that
90     both PC and SP are loaded from the stack.  Because of this, there
91     is no 'return' slot necessary on the stack.
92     """
93     returns = False
94 
95 
96 linux_i386   = ABI([], 4, 0)
97 linux_amd64  = ABI(['rdi','rsi','rdx','rcx','r8','r9'], 8, 0)
98 linux_arm    = ABI(['r0', 'r1', 'r2', 'r3'], 8, 0)
99 linux_aarch64 = ABI(['x0', 'x1', 'x2', 'x3'], 16, 0)
100 linux_mips  = ABI(['$a0','$a1','$a2','$a3'], 4, 0)
101 linux_ppc = ABI(['r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9', 'r10'], 4, 0)
102 linux_ppc64 = ABI(['r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9', 'r10'], 8, 0)
103 
104 linux_i386_syscall = SyscallABI(['eax', 'ebx', 'ecx', 'edx', 'esi', 'edi', 'ebp'], 4, 0)
105 linux_amd64_syscall = SyscallABI(['rax','rdi', 'rsi', 'rdx', 'r10', 'r8', 'r9'],   8, 0)
106 linux_arm_syscall   = SyscallABI(['r7', 'r0', 'r1', 'r2', 'r3', 'r4', 'r5', 'r6'], 4, 0)
107 linux_aarch64_syscall   = SyscallABI(['x8', 'x0', 'x1', 'x2', 'x3', 'x4', 'x5', 'x6'], 16, 0)
108 linux_mips_syscall  = SyscallABI(['$v0', '$a0','$a1','$a2','$a3'], 4, 0)
109 linux_ppc_syscall = ABI(['r0', 'r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9'], 4, 0)
110 linux_ppc64_syscall = ABI(['r0', 'r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9'], 8, 0)
111 
112 linux_i386_sigreturn = SigreturnABI(['eax'], 4, 0)
113 linux_amd64_sigreturn = SigreturnABI(['rax'], 4, 0)
114 linux_arm_sigreturn = SigreturnABI(['r7'], 4, 0)
115 
116 # Fake ABIs used by SROP
117 linux_i386_srop = ABI(['eax'], 4, 0)
118 linux_amd64_srop = ABI(['rax'], 4, 0)
119 linux_arm_srop = ABI(['r7'], 4, 0)
120 
121 
122 @pwndbg.events.start
123 def update():
124     global abi
125     global linux
126 
127     # Detect current ABI of client side by 'show osabi'
128     osabi_string = gdb.execute('show osabi', to_string=True)
129 
130     # The return string will be:
131     # The current OS ABI is "auto" (currently "GNU/Linux").
132     match = re.search('currently "([^"]+)"', osabi_string)
133     if match:
134         # 'GNU/Linux': linux
135         # 'none': bare metal
136         abi = match.group(1)
137 
138         linux = 'Linux' in abi
139 
140     if not linux:
141         msg = M.warn(
142             "The bare metal debugging is enabled since the gdb's osabi is '%s' which is not 'GNU/Linux'.\n"
143             "Ex. the page resolving and memory de-referencing ONLY works on known pages.\n"
144             "This option is based ib gdb client compile arguments (by default) and will be corrected if you load an ELF which has the '.note.ABI-tag' section.\n"
145             "If you are debuging a program that runs on Linux ABI, please select the correct gdb client."
146             % abi
147         )
148         print(msg)
149 
150 
151 def LinuxOnly(default=None):
152     """Create a decorator that the function will be called when ABI is Linux.
153     Otherwise, return `default`.
154     """
155     def decorator(func):
156         @functools.wraps(func)
157         def caller(*args, **kwargs):
158             if linux:
159                 return func(*args, **kwargs)
160             else:
161                 return default
162         return caller
163 
164     return decorator
165 
166 
167 # Update when starting the gdb to show warning message for non-Linux ABI user.
168 update()
169
```
--- 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/abi.py b/pwndbg/abi.py
--- a/pwndbg/abi.py
+++ b/pwndbg/abi.py
@@ -125,17 +125,23 @@
     global linux
 
     # Detect current ABI of client side by 'show osabi'
-    osabi_string = gdb.execute('show osabi', to_string=True)
-
-    # The return string will be:
-    # The current OS ABI is "auto" (currently "GNU/Linux").
-    match = re.search('currently "([^"]+)"', osabi_string)
-    if match:
-        # 'GNU/Linux': linux
-        # 'none': bare metal
-        abi = match.group(1)
-
-        linux = 'Linux' in abi
+    #
+    # Examples of strings returned by `show osabi`:
+    # 'The current OS ABI is "auto" (currently "GNU/Linux").\nThe default OS ABI is "GNU/Linux".\n'
+    # 'The current OS ABI is "GNU/Linux".\nThe default OS ABI is "GNU/Linux".\n'
+    # 'El actual SO ABI es «auto» (actualmente «GNU/Linux»).\nEl SO ABI predeterminado es «GNU/Linux».\n'
+    # 'The current OS ABI is "auto" (currently "none")'
+    #
+    # As you can see, there might be GDBs with different language versions
+    # and so we have to support it there too.
+    # Lets assume and hope that `current osabi` is returned in first line in all languages...
+    current_osabi = gdb.execute('show osabi', to_string=True).split('\n')[0]
+
+    # Currently we support those osabis:
+    # 'GNU/Linux': linux
+    # 'none': bare metal
+
+    linux = 'GNU/Linux' in current_osabi
 
     if not linux:
         msg = M.warn(

{"golden_diff": "diff --git a/pwndbg/abi.py b/pwndbg/abi.py\n--- a/pwndbg/abi.py\n+++ b/pwndbg/abi.py\n@@ -125,17 +125,23 @@\n     global linux\n \n     # Detect current ABI of client side by 'show osabi'\n-    osabi_string = gdb.execute('show osabi', to_string=True)\n-\n-    # The return string will be:\n-    # The current OS ABI is \"auto\" (currently \"GNU/Linux\").\n-    match = re.search('currently \"([^\"]+)\"', osabi_string)\n-    if match:\n-        # 'GNU/Linux': linux\n-        # 'none': bare metal\n-        abi = match.group(1)\n-\n-        linux = 'Linux' in abi\n+    #\n+    # Examples of strings returned by `show osabi`:\n+    # 'The current OS ABI is \"auto\" (currently \"GNU/Linux\").\\nThe default OS ABI is \"GNU/Linux\".\\n'\n+    # 'The current OS ABI is \"GNU/Linux\".\\nThe default OS ABI is \"GNU/Linux\".\\n'\n+    # 'El actual SO ABI es \u00abauto\u00bb (actualmente \u00abGNU/Linux\u00bb).\\nEl SO ABI predeterminado es \u00abGNU/Linux\u00bb.\\n'\n+    # 'The current OS ABI is \"auto\" (currently \"none\")'\n+    #\n+    # As you can see, there might be GDBs with different language versions\n+    # and so we have to support it there too.\n+    # Lets assume and hope that `current osabi` is returned in first line in all languages...\n+    current_osabi = gdb.execute('show osabi', to_string=True).split('\\n')[0]\n+\n+    # Currently we support those osabis:\n+    # 'GNU/Linux': linux\n+    # 'none': bare metal\n+\n+    linux = 'GNU/Linux' in current_osabi\n \n     if not linux:\n         msg = M.warn(\n", "issue": "Pwndbg failing with GDB using language different than English\n### Description\r\n\r\nAfter installing pwndbg with a GDB that uses Spanish language we do fail on detecting whether `osabi` is Linux.\r\n\r\nThis happens after launching GDB:\r\nhttps://prnt.sc/itwf3u\r\n\r\nAnd this is the return of `show osabi` for GDB with spanish language:\r\n```\r\n(gdb) show osabi                                     \r\nEl actual SO ABI es \u00abauto\u00bb (actualmente \u00abGNU/Linux\u00bb).\r\nEl SO ABI predeterminado es \u00abGNU/Linux\u00bb.             \r\n```\r\n\r\nThis is the code responsible for failure:\r\nhttps://github.com/pwndbg/pwndbg/blob/dev/pwndbg/abi.py#L127-L140\r\n\r\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport functools\nimport re\n\nimport gdb\n\nimport pwndbg.arch\nimport pwndbg.color.message as M\n\n\nclass ABI(object):\n    \"\"\"\n    Encapsulates information about a calling convention.\n    \"\"\"\n    #: List or registers which should be filled with arguments before\n    #: spilling onto the stack.\n    register_arguments = []\n\n    #: Minimum alignment of the stack.\n    #: The value used is min(context.bytes, stack_alignment)\n    #: This is necessary as Windows x64 frames must be 32-byte aligned.\n    #: \"Alignment\" is considered with respect to the last argument on the stack.\n    arg_alignment    = 1\n\n    #: Minimum number of stack slots used by a function call\n    #: This is necessary as Windows x64 requires using 4 slots on the stack\n    stack_minimum      = 0\n\n    #: Indicates that this ABI returns to the next address on the slot\n    returns            = True\n\n    def __init__(self, regs, align, minimum):\n        self.register_arguments = regs\n        self.arg_alignment      = align\n        self.stack_minimum      = minimum\n\n    @staticmethod\n    def default():\n        return {\n        (32, 'i386', 'linux'):  linux_i386,\n        (64, 'x86-64', 'linux'): linux_amd64,\n        (64, 'aarch64', 'linux'): linux_aarch64,\n        (32, 'arm', 'linux'):   linux_arm,\n        (32, 'thumb', 'linux'):   linux_arm,\n        (32, 'mips', 'linux'):   linux_mips,\n        (32, 'powerpc', 'linux'): linux_ppc,\n        (64, 'powerpc', 'linux'): linux_ppc64,\n        }[(8*pwndbg.arch.ptrsize, pwndbg.arch.current, 'linux')]\n\n    @staticmethod\n    def syscall():\n        return {\n        (32, 'i386', 'linux'):  linux_i386_syscall,\n        (64, 'x86-64', 'linux'): linux_amd64_syscall,\n        (64, 'aarch64', 'linux'): linux_aarch64_syscall,\n        (32, 'arm', 'linux'):   linux_arm_syscall,\n        (32, 'thumb', 'linux'):   linux_arm_syscall,\n        (32, 'mips', 'linux'):   linux_mips_syscall,\n        (32, 'powerpc', 'linux'): linux_ppc_syscall,\n        (64, 'powerpc', 'linux'): linux_ppc64_syscall,\n        }[(8*pwndbg.arch.ptrsize, pwndbg.arch.current, 'linux')]\n\n    @staticmethod\n    def sigreturn():\n        return {\n        (32, 'i386', 'linux'):  linux_i386_sigreturn,\n        (64, 'x86-64', 'linux'): linux_amd64_sigreturn,\n        (32, 'arm', 'linux'):   linux_arm_sigreturn,\n        (32, 'thumb', 'linux'):   linux_arm_sigreturn,\n        }[(8*pwndbg.arch.ptrsize, pwndbg.arch.current, 'linux')]\n\nclass SyscallABI(ABI):\n    \"\"\"\n    The syscall ABI treats the syscall number as the zeroth argument,\n    which must be loaded into the specified register.\n    \"\"\"\n    def __init__(self, register_arguments, *a, **kw):\n        self.syscall_register = register_arguments.pop(0)\n        super(SyscallABI, self).__init__(register_arguments, *a, **kw)\n\n\nclass SigreturnABI(SyscallABI):\n    \"\"\"\n    The sigreturn ABI is similar to the syscall ABI, except that\n    both PC and SP are loaded from the stack.  Because of this, there\n    is no 'return' slot necessary on the stack.\n    \"\"\"\n    returns = False\n\n\nlinux_i386   = ABI([], 4, 0)\nlinux_amd64  = ABI(['rdi','rsi','rdx','rcx','r8','r9'], 8, 0)\nlinux_arm    = ABI(['r0', 'r1', 'r2', 'r3'], 8, 0)\nlinux_aarch64 = ABI(['x0', 'x1', 'x2', 'x3'], 16, 0)\nlinux_mips  = ABI(['$a0','$a1','$a2','$a3'], 4, 0)\nlinux_ppc = ABI(['r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9', 'r10'], 4, 0)\nlinux_ppc64 = ABI(['r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9', 'r10'], 8, 0)\n\nlinux_i386_syscall = SyscallABI(['eax', 'ebx', 'ecx', 'edx', 'esi', 'edi', 'ebp'], 4, 0)\nlinux_amd64_syscall = SyscallABI(['rax','rdi', 'rsi', 'rdx', 'r10', 'r8', 'r9'],   8, 0)\nlinux_arm_syscall   = SyscallABI(['r7', 'r0', 'r1', 'r2', 'r3', 'r4', 'r5', 'r6'], 4, 0)\nlinux_aarch64_syscall   = SyscallABI(['x8', 'x0', 'x1', 'x2', 'x3', 'x4', 'x5', 'x6'], 16, 0)\nlinux_mips_syscall  = SyscallABI(['$v0', '$a0','$a1','$a2','$a3'], 4, 0)\nlinux_ppc_syscall = ABI(['r0', 'r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9'], 4, 0)\nlinux_ppc64_syscall = ABI(['r0', 'r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9'], 8, 0)\n\nlinux_i386_sigreturn = SigreturnABI(['eax'], 4, 0)\nlinux_amd64_sigreturn = SigreturnABI(['rax'], 4, 0)\nlinux_arm_sigreturn = SigreturnABI(['r7'], 4, 0)\n\n# Fake ABIs used by SROP\nlinux_i386_srop = ABI(['eax'], 4, 0)\nlinux_amd64_srop = ABI(['rax'], 4, 0)\nlinux_arm_srop = ABI(['r7'], 4, 0)\n\n\n@pwndbg.events.start\ndef update():\n    global abi\n    global linux\n\n    # Detect current ABI of client side by 'show osabi'\n    osabi_string = gdb.execute('show osabi', to_string=True)\n\n    # The return string will be:\n    # The current OS ABI is \"auto\" (currently \"GNU/Linux\").\n    match = re.search('currently \"([^\"]+)\"', osabi_string)\n    if match:\n        # 'GNU/Linux': linux\n        # 'none': bare metal\n        abi = match.group(1)\n\n        linux = 'Linux' in abi\n\n    if not linux:\n        msg = M.warn(\n            \"The bare metal debugging is enabled since the gdb's osabi is '%s' which is not 'GNU/Linux'.\\n\"\n            \"Ex. the page resolving and memory de-referencing ONLY works on known pages.\\n\"\n            \"This option is based ib gdb client compile arguments (by default) and will be corrected if you load an ELF which has the '.note.ABI-tag' section.\\n\"\n            \"If you are debuging a program that runs on Linux ABI, please select the correct gdb client.\"\n            % abi\n        )\n        print(msg)\n\n\ndef LinuxOnly(default=None):\n    \"\"\"Create a decorator that the function will be called when ABI is Linux.\n    Otherwise, return `default`.\n    \"\"\"\n    def decorator(func):\n        @functools.wraps(func)\n        def caller(*args, **kwargs):\n            if linux:\n                return func(*args, **kwargs)\n            else:\n                return default\n        return caller\n\n    return decorator\n\n\n# Update when starting the gdb to show warning message for non-Linux ABI user.\nupdate()\n", "path": "pwndbg/abi.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport functools\nimport re\n\nimport gdb\n\nimport pwndbg.arch\nimport pwndbg.color.message as M\n\n\nclass ABI(object):\n    \"\"\"\n    Encapsulates information about a calling convention.\n    \"\"\"\n    #: List or registers which should be filled with arguments before\n    #: spilling onto the stack.\n    register_arguments = []\n\n    #: Minimum alignment of the stack.\n    #: The value used is min(context.bytes, stack_alignment)\n    #: This is necessary as Windows x64 frames must be 32-byte aligned.\n    #: \"Alignment\" is considered with respect to the last argument on the stack.\n    arg_alignment    = 1\n\n    #: Minimum number of stack slots used by a function call\n    #: This is necessary as Windows x64 requires using 4 slots on the stack\n    stack_minimum      = 0\n\n    #: Indicates that this ABI returns to the next address on the slot\n    returns            = True\n\n    def __init__(self, regs, align, minimum):\n        self.register_arguments = regs\n        self.arg_alignment      = align\n        self.stack_minimum      = minimum\n\n    @staticmethod\n    def default():\n        return {\n        (32, 'i386', 'linux'):  linux_i386,\n        (64, 'x86-64', 'linux'): linux_amd64,\n        (64, 'aarch64', 'linux'): linux_aarch64,\n        (32, 'arm', 'linux'):   linux_arm,\n        (32, 'thumb', 'linux'):   linux_arm,\n        (32, 'mips', 'linux'):   linux_mips,\n        (32, 'powerpc', 'linux'): linux_ppc,\n        (64, 'powerpc', 'linux'): linux_ppc64,\n        }[(8*pwndbg.arch.ptrsize, pwndbg.arch.current, 'linux')]\n\n    @staticmethod\n    def syscall():\n        return {\n        (32, 'i386', 'linux'):  linux_i386_syscall,\n        (64, 'x86-64', 'linux'): linux_amd64_syscall,\n        (64, 'aarch64', 'linux'): linux_aarch64_syscall,\n        (32, 'arm', 'linux'):   linux_arm_syscall,\n        (32, 'thumb', 'linux'):   linux_arm_syscall,\n        (32, 'mips', 'linux'):   linux_mips_syscall,\n        (32, 'powerpc', 'linux'): linux_ppc_syscall,\n        (64, 'powerpc', 'linux'): linux_ppc64_syscall,\n        }[(8*pwndbg.arch.ptrsize, pwndbg.arch.current, 'linux')]\n\n    @staticmethod\n    def sigreturn():\n        return {\n        (32, 'i386', 'linux'):  linux_i386_sigreturn,\n        (64, 'x86-64', 'linux'): linux_amd64_sigreturn,\n        (32, 'arm', 'linux'):   linux_arm_sigreturn,\n        (32, 'thumb', 'linux'):   linux_arm_sigreturn,\n        }[(8*pwndbg.arch.ptrsize, pwndbg.arch.current, 'linux')]\n\nclass SyscallABI(ABI):\n    \"\"\"\n    The syscall ABI treats the syscall number as the zeroth argument,\n    which must be loaded into the specified register.\n    \"\"\"\n    def __init__(self, register_arguments, *a, **kw):\n        self.syscall_register = register_arguments.pop(0)\n        super(SyscallABI, self).__init__(register_arguments, *a, **kw)\n\n\nclass SigreturnABI(SyscallABI):\n    \"\"\"\n    The sigreturn ABI is similar to the syscall ABI, except that\n    both PC and SP are loaded from the stack.  Because of this, there\n    is no 'return' slot necessary on the stack.\n    \"\"\"\n    returns = False\n\n\nlinux_i386   = ABI([], 4, 0)\nlinux_amd64  = ABI(['rdi','rsi','rdx','rcx','r8','r9'], 8, 0)\nlinux_arm    = ABI(['r0', 'r1', 'r2', 'r3'], 8, 0)\nlinux_aarch64 = ABI(['x0', 'x1', 'x2', 'x3'], 16, 0)\nlinux_mips  = ABI(['$a0','$a1','$a2','$a3'], 4, 0)\nlinux_ppc = ABI(['r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9', 'r10'], 4, 0)\nlinux_ppc64 = ABI(['r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9', 'r10'], 8, 0)\n\nlinux_i386_syscall = SyscallABI(['eax', 'ebx', 'ecx', 'edx', 'esi', 'edi', 'ebp'], 4, 0)\nlinux_amd64_syscall = SyscallABI(['rax','rdi', 'rsi', 'rdx', 'r10', 'r8', 'r9'],   8, 0)\nlinux_arm_syscall   = SyscallABI(['r7', 'r0', 'r1', 'r2', 'r3', 'r4', 'r5', 'r6'], 4, 0)\nlinux_aarch64_syscall   = SyscallABI(['x8', 'x0', 'x1', 'x2', 'x3', 'x4', 'x5', 'x6'], 16, 0)\nlinux_mips_syscall  = SyscallABI(['$v0', '$a0','$a1','$a2','$a3'], 4, 0)\nlinux_ppc_syscall = ABI(['r0', 'r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9'], 4, 0)\nlinux_ppc64_syscall = ABI(['r0', 'r3', 'r4', 'r5', 'r6', 'r7', 'r8', 'r9'], 8, 0)\n\nlinux_i386_sigreturn = SigreturnABI(['eax'], 4, 0)\nlinux_amd64_sigreturn = SigreturnABI(['rax'], 4, 0)\nlinux_arm_sigreturn = SigreturnABI(['r7'], 4, 0)\n\n# Fake ABIs used by SROP\nlinux_i386_srop = ABI(['eax'], 4, 0)\nlinux_amd64_srop = ABI(['rax'], 4, 0)\nlinux_arm_srop = ABI(['r7'], 4, 0)\n\n\n@pwndbg.events.start\ndef update():\n    global abi\n    global linux\n\n    # Detect current ABI of client side by 'show osabi'\n    #\n    # Examples of strings returned by `show osabi`:\n    # 'The current OS ABI is \"auto\" (currently \"GNU/Linux\").\\nThe default OS ABI is \"GNU/Linux\".\\n'\n    # 'The current OS ABI is \"GNU/Linux\".\\nThe default OS ABI is \"GNU/Linux\".\\n'\n    # 'El actual SO ABI es \u00abauto\u00bb (actualmente \u00abGNU/Linux\u00bb).\\nEl SO ABI predeterminado es \u00abGNU/Linux\u00bb.\\n'\n    # 'The current OS ABI is \"auto\" (currently \"none\")'\n    #\n    # As you can see, there might be GDBs with different language versions\n    # and so we have to support it there too.\n    # Lets assume and hope that `current osabi` is returned in first line in all languages...\n    current_osabi = gdb.execute('show osabi', to_string=True).split('\\n')[0]\n\n    # Currently we support those osabis:\n    # 'GNU/Linux': linux\n    # 'none': bare metal\n\n    linux = 'GNU/Linux' in current_osabi\n\n    if not linux:\n        msg = M.warn(\n            \"The bare metal debugging is enabled since the gdb's osabi is '%s' which is not 'GNU/Linux'.\\n\"\n            \"Ex. the page resolving and memory de-referencing ONLY works on known pages.\\n\"\n            \"This option is based ib gdb client compile arguments (by default) and will be corrected if you load an ELF which has the '.note.ABI-tag' section.\\n\"\n            \"If you are debuging a program that runs on Linux ABI, please select the correct gdb client.\"\n            % abi\n        )\n        print(msg)\n\n\ndef LinuxOnly(default=None):\n    \"\"\"Create a decorator that the function will be called when ABI is Linux.\n    Otherwise, return `default`.\n    \"\"\"\n    def decorator(func):\n        @functools.wraps(func)\n        def caller(*args, **kwargs):\n            if linux:\n                return func(*args, **kwargs)\n            else:\n                return default\n        return caller\n\n    return decorator\n\n\n# Update when starting the gdb to show warning message for non-Linux ABI user.\nupdate()\n", "path": "pwndbg/abi.py"}]}