I think that it would be useful to add a "vgstack" script. This would work like pstack/gstack but rather than print the host stack it would print the guest stack. gstack does this $GDB --quiet -nx $GDBARGS /proc/$1/exe $1 <<EOF 2>&1 | set width 0 set height 0 set pagination no $backtrace EOF /bin/sed -n \ -e 's/^\((gdb) \)*//' \ -e '/^#/p' \ -e '/^Thread/p' If I move the exe and pid and put in a vgdb command like this $GDB --quiet -nx $GDBARGS <<EOF 2>&1 | set width 0 set height 0 set pagination no target remote | vgdb --pid=$1 $backtrace EOF /bin/sed -n \ -e 's/^\((gdb) \)*//' \ -e '/^#/p' \ -e '/^Thread/p' then it seems to work reasonably well. I'll need to adapt it so that it works on FreeBSD (and maybe illumos).
Created attachment 181250 [details] initial patch Just tested on FreeBSD so far.
This doesn't work on illumos. The Valgrind process core dumps and vgstack gets no output. Possibly the same issue as https://bugs.kde.org/show_bug.cgi?id=503130
Seems OK on Linux.
commit 568ce38ac76e1cefc20b006c7da8cf7bf2209596 (HEAD -> master, origin/master, origin/HEAD, bug504101) Author: Paul Floyd <pjfloyd@wanadoo.fr> Date: Tue May 13 20:34:48 2025 +0200 Bug 504101 - Add a "vgstack" script This works just like pstack/gstack (and bstack on FreeBSD). Run "vgstack [valgrind pid]" and you will get the guest backtraces.