Scripting 在gdb脚本中使用while循环
我正在编写一个脚本来检查核心转储。目标是使用while循环执行gdb命令进行分析Scripting 在gdb脚本中使用while循环,scripting,gdb,core,Scripting,Gdb,Core,我正在编写一个脚本来检查核心转储。目标是使用while循环执行gdb命令进行分析 #!/usr/local/bin/bash # # A script to extract core-file informations # #Binary image binimg=$1 # Today and yesterdays cores core=$2 gdblogfile=$3 loop = 3 gdb -batch \ -ex "set logging file $gdblogfi
#!/usr/local/bin/bash
#
# A script to extract core-file informations
#
#Binary image
binimg=$1
# Today and yesterdays cores
core=$2
gdblogfile=$3
loop = 3
gdb -batch \
-ex "set logging file $gdblogfile" \
-ex "set logging on" \
-ex "set pagination off" \
-ex "file $binimg" \
-ex "core-file $core" \
-ex "bt" \
-ex "frame 8" \
-ex "while $loop > 0 { print this->_tag; set $loop = $loop - 1; end }"
-ex "quit"
此脚本不会在while循环后执行。它在while循环处停止,需要命令行gdb命令。我不知道为什么它不继续打印标签的值并继续循环。你能告诉我我做错了什么吗?大括号不适用于gdb中的分组。不知道你为什么会这么想,但不管你从什么渠道得到的信息都是错误的——你应该让他们知道 如果要继续此路径,请将命令放入文件中,并使用“gdb-x”而不是“-ex” 不过,使用Python编写脚本的经验可能会更好