Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirecting/storing output of shell into GDB variable?

Tags:

I would like to know how it is possible to know the current system architecture in GDB and store this information into a variable for later evaluation.

Something like:

set variable $x=`shell uname -m` 
like image 508
vburdon Avatar asked Jul 30 '11 20:07

vburdon


1 Answers

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] + "\"") 
like image 70
matt Avatar answered Oct 17 '22 05:10

matt