Newer versions of GDB come with the nifty find command. The old version of GDB I have to use does not. It is also incapable of generating a proper stack trace for the platform it supposedly serves. But that’s a whole other story…
Anyway, I found a piece of code that almost does the same. I tweaked it a bit, fixed the stray bug ($x -> %p) and would like to never do it again. So here it is for my future reference and your indulgent.
define find set $start = (uint64 *) $arg0 set $end = $start + $arg1 set $pattern = (uint64) $arg2 set $p = $start while $p < $end if (*(uint64 *) $p) == $pattern printf "pattern %p found at %pn", $pattern, $p end set $p++ end end