How do you set new values to every address you find in gdb with "find" at once?

48 Views Asked by At

Is there some loop syntax I could use?

I'm searching for values at addresses with the find command, but rather than manually changing the values at each address it finds one at a time, I'd like to change each addresses' value much faster. Sort of like what you can do with Cheat Engine.

I basically did a search with find like;

(gdb) find 0x00100000,0x00900000, 0x190

Which printed a list of addresses with this value, but now I'd like to change each of the listed addresses' values to 0x140

1

There are 1 best solutions below

1
Mark Plotnick On

This will pipe the output of GDB's find command to the awk program to generate a series of set commands.

pipe find 0x00100000,0x00900000,0x190 | awk '$1 ~ /^0x/ { print "set *(int *)" $1 " = 0x140" }' > ~/set140.gdb
source ~/set140.gdb