Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion ci/timeout_with_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import argparse
import os
import shutil
import signal
import subprocess
import sys
Expand Down Expand Up @@ -109,9 +110,14 @@ def capture_stack_trace(pid: int, stack_type=StackType.C) -> None:
else:
bt_command = "thread apply all py-bt"
print(f"\nCapturing Python stack trace for process {pid}:")
gdb = shutil.which("gdb")
if gdb is None:
print(f"Skipping stack trace for process {pid}: gdb not found")
return

proc = subprocess.run(
[
"gdb",
gdb,
"--quiet",
"--pid",
str(pid),
Expand All @@ -128,7 +134,10 @@ def capture_stack_trace(pid: int, stack_type=StackType.C) -> None:
text=True,
check=False,
)

print(proc.stdout)
if proc.stderr:
print(proc.stderr, file=sys.stderr)


def capture_all_stacks(pid: int, *, enable_python: bool = False) -> None:
Expand Down
Loading