Redirecting/storing output of shell into GDB variable?

后端 未结 1 1145
我在风中等你
我在风中等你 2020-12-03 04:39

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 lik

相关标签:
1条回答
  • 2020-12-03 05:43

    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] + "\"")
    
    0 讨论(0)
提交回复
热议问题