I am trying to use the gdbinit file from https://github.com/gdbinit/Gdbinit while debugging some old fortran code. Everything works fine with GDB if I don't include the gdbinit file; however, when including the file I get the following error:
Error while running hook_stop:
A syntax error in expression, near `= 1'.
After digging around inside the file and using some comments I believe the issue is with the if statements in the following code:
# ____________________misc____________________
define hook-stop
# Display instructions formats
if $ARM == 1
if $ARMOPCODES == 1
set arm show-opcode-bytes 1
else
set arm show-opcode-bytes 1
end
else
if $X86FLAVOR == 0
set disassembly-flavor intel
else
set disassembly-flavor att
end
end
# this makes 'context' be called at every BP/step
if ($SHOW_CONTEXT > 0)
printf "%i", $SHOW_CONTEXT
context
end
if ($SHOW_NEST_INSN > 0)
set $x = $_nest
while ($x > 0)
printf "\t"
set $x = $x - 1
end
end
end
document hook-stop
!!! FOR INTERNAL USE ONLY - DO NOT CALL !!!
end
The reason I know that the if statements are the issue is because when I edit to code to be :
# ____________________misc____________________
define hook-stop
# Display instructions formats
# if $ARM == 1
# if $ARMOPCODES == 1
# set arm show-opcode-bytes 1
# else
# set arm show-opcode-bytes 1
# end
# else
# if $X86FLAVOR == 0
# set disassembly-flavor intel
# else
# set disassembly-flavor att
# end
# end
# this makes 'context' be called at every BP/step
if ($SHOW_CONTEXT > 0)
printf "%i", $SHOW_CONTEXT
context
end
if ($SHOW_NEST_INSN > 0)
set $x = $_nest
while ($x > 0)
printf "\t"
set $x = $x - 1
end
end
end
document hook-stop
!!! FOR INTERNAL USE ONLY - DO NOT CALL !!!
end
The error becomes: Error while running hook_stop A syntax error in expression, near '> 0'.
Does anyone know what is going on? I don't really know how the gdbinit file is read or the proper syntax for it.
For what it is worth I am running gdb 7.7.1 on Mac OSX 10.9.3.
I have also put in a bug report with the gi repository but thought that I might get a quicker answer here.
Thanks for your help!
Andrew