#!/bin/bash # pmap_va.sh [hex-va ...] # Push guest_pmap.py to the running VM and translate the VAs of the named # process through the guest's own pagemap (root in the guest). set -u cd "$(dirname "$0")/../.." TARGET="$1"; shift VAS="$*" B64=$(base64 -w0 tools/guest-diag/guest_pmap.py) timeout 30 ./scripts/vgpu_vm.py exec --timeout 25 \ "echo '$B64' | base64 -d > /tmp/pmap.py" >/dev/null 2>&1 if ! [[ "$TARGET" =~ ^[0-9]+$ ]]; then PID=$(timeout 20 ./scripts/vgpu_vm.py exec --timeout 15 "pgrep -x $TARGET | head -1" 2>/dev/null | tail -1) [ -n "$PID" ] && TARGET="$PID" fi [ -n "$TARGET" ] || { echo "no pid found"; exit 1; } timeout 60 ./scripts/vgpu_vm.py exec --timeout 55 "sudo python3 /tmp/pmap.py $TARGET $VAS" 2>/dev/null | grep -E '^VA='