将shell的输出重定向/存储到GDB变量中? [英] Redirecting/storing output of shell into GDB variable?
本文介绍了将shell的输出重定向/存储到GDB变量中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何才能知道GDB中的当前系统架构,并将这些信息存储到一个变量中供以后评估。
类似于:
设置变量$ x =`shell uname -m`
$ p $ 以前的方式:
$ b(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] + \)
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`
解决方案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] + "\"")
这篇关于将shell的输出重定向/存储到GDB变量中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文