Redirecting/storing output of shell into GDB variable?

theres 2 ways:

the older way:

(gdb) shell echo set \$x=\"$(uname -m)\" >/tmp/foo.gdb
(gdb) source /tmp/foo.gdb

newer with python:

(gdb) python gdb.execute("set $y=\"" + os.uname()[4] + "\"")

Leave a Comment