Skip to content

Instantly share code, notes, and snippets.

@pollend
Created November 27, 2024 17:26
Show Gist options
  • Save pollend/fd5cd55ce696fd2cf8a6e74660678676 to your computer and use it in GitHub Desktop.
Save pollend/fd5cd55ce696fd2cf8a6e74660678676 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Get the process name as an argument
process_name="wf_steam.x86_64"
# Loop until the process is found
while true; do
# Use pgrep to find the PID of the process
pid=$(pgrep -f "$process_name")
# Check if the process was found
if [ -n "$pid" ]; then
echo "PID of $process_name is $pid"
# Attach gdb to the process
gdb -p "$pid"
# Exit the loop after gdb detaches
break
else
echo "Process $process_name not found, retrying..."
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment