Skip to content

Commit 0268f84

Browse files
committed
Fix for non-English environment
1 parent b3f9080 commit 0268f84

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

ptrlib/debugger/unix/debug.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
logger = getLogger(__name__)
1515

1616
CUSTOM_SUDO_PROMPT = "[sudo] password: "
17-
GDB_PTRACE_ERROR = b"ptrace: Operation not permitted.\n"
17+
GDB_ATTACH_MSG = b"Attaching to process "
18+
GDB_PTRACE_ERROR = b"ptrace: "
1819
ANSI_RE = re.compile(rb'\x1B\[[0-?]*[ -/]*[@-~]')
1920
CTRL_RE = re.compile(rb'[\x00-\x08\x0B-\x1F]')
2021

@@ -84,6 +85,7 @@ def pid(self) -> int:
8485

8586
def _attach_direct(self):
8687
self._gdb = unix_process()(["gdb", "-q", "-p", str(self._pid)])
88+
self._gdb.recvuntil(GDB_ATTACH_MSG)
8789
init_msg = self._gdb.recvuntil(self._gdb_prompt, lookahead=True)
8890
if GDB_PTRACE_ERROR in init_msg:
8991
raise PermissionError(f"Cannot attach pid={self._pid}")

0 commit comments

Comments
 (0)