我想知道如何知道 GDB 中当前的系统架构并将此信息存储到变量中以供以后评估。
就像是:
set variable $x=`shell uname -m`
最佳答案
有2种方式:
较旧的方式:
(gdb) shell echo set \$x=\"$(uname -m)\" >/tmp/foo.gdb
(gdb) source /tmp/foo.gdb
更新的python:
(gdb) python gdb.execute("set $y=\"" + os.uname()[4] + "\"")
关于shell - 将 shell 的输出重定向/存储到 GDB 变量中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6885923/