我想知道如何知道GDB中的当前系统架构并将此信息存储到变量中以供以后评估.
就像是:
set variable $x=`shell uname -m`
Run Code Online (Sandbox Code Playgroud)
mat*_*att 20
有两种方式:
较旧的方式:
(gdb) shell echo set \$x=\"$(uname -m)\" >/tmp/foo.gdb
(gdb) source /tmp/foo.gdb
Run Code Online (Sandbox Code Playgroud)
更新的python:
(gdb) python gdb.execute("set $y=\"" + os.uname()[4] + "\"")
Run Code Online (Sandbox Code Playgroud)