I am writing a script to examine the core dump. The goal is to execute a gdb command using a while loop to analyze.
#!/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"
This script does not execute after the while loop. It stops at the while loop, expecting command line gdb commands. I am not sure why it does not go ahead and print the value of tag and continue looping. Can you please let me know what I am doing wrong?