在调试一些旧的fortran代码时,我尝试使用https://github.com/gdbinit/Gdbinit中的gdbinit文件。如果我不包含gdbinit文件,那么GDB一切正常;但是,当包含该文件时,我得到以下错误:
Error while running hook_stop:
A syntax error in expression, near `= 1'.在深入研究了文件并使用了一些注释之后,我认为问题出在以下代码中的if语句:
# ____________________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我之所以知道if语句是问题所在,是因为当我编辑代码时:
# ____________________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该错误变为:运行hook_stop时出现错误表达式中的语法错误,在'> 0‘附近。
有人知道这是怎么回事吗?我真的不知道gdbinit文件是如何读取的,也不知道它的正确语法。
无论如何,我在Mac 10.9.3上运行gdb 7.7.1。
我也向gi仓库提交了一份bug报告,但我想我可能会在这里得到一个更快的答案。
谢谢你的帮忙!
安德鲁
发布于 2014-07-17 08:57:23
这段代码引用了各种方便的变量,比如$ARM,但是没有显示它们是如何定义的,或者是否定义了它们。所以,这将是我第一个要看的地方。
https://stackoverflow.com/questions/24640538
复制相似问题