summaryrefslogtreecommitdiff
path: root/gdb-helpers/libcr.py
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-12-08 18:08:27 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-12-09 12:24:43 -0700
commit150a10e8841f012645b77d1a6eb10d25dbf89b56 (patch)
treed0066f5651c3adf821ae44c4fd30ad1f221dfa73 /gdb-helpers/libcr.py
parent1c305010f427ac40fbecb80175d4323020a2ea66 (diff)
GDB fixes
Diffstat (limited to 'gdb-helpers/libcr.py')
-rw-r--r--gdb-helpers/libcr.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/gdb-helpers/libcr.py b/gdb-helpers/libcr.py
index c07b679..3ffafce 100644
--- a/gdb-helpers/libcr.py
+++ b/gdb-helpers/libcr.py
@@ -26,6 +26,14 @@ def gdb_unregister_unwinder(
gdb.invalidate_cached_frames()
+def gdb_is_on_os() -> bool:
+ try:
+ gdb.execute("info proc", to_string=True)
+ return True
+ except gdb.error:
+ return False
+
+
class gdb_JmpBuf:
"""Our own in-Python GDB-specific implementation of `jmp_buf`"""
@@ -105,7 +113,8 @@ class CrGlobals:
self._breakpoint.enabled = True
gdb.execute(f"call (void)cr_gdb_readjmp({env_ptr_expr})")
self._breakpoint.enabled = False
- gdb.execute("queue-signal SIGWINCH")
+ if gdb_is_on_os():
+ gdb.execute("queue-signal SIGWINCH")
return self._breakpoint.env
def _on_cont(self, event: gdb.Event) -> None: