语法gdbinit无效

时间:2014-07-08 19:47:41

标签: macos gdb gdbinit

我正在尝试使用https://github.com/gdbinit/Gdbinit中的gdbinit文件,同时调试一些旧的fortran代码。如果我不包含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 OSX 10.9.3上运行gdb 7.7.1。

我还在gi存储库中输入了一个错误报告,但我想我可能会在这里得到更快的答案。

感谢您的帮助!

安德鲁

1 个答案:

答案 0 :(得分:0)

此代码引用各种便利变量,例如$ ARM,但您不会显示它们是如何定义的,也不会定义它们。所以,那将是我看的第一个地方。

相关问题