【问题标题】:How to set arg using gdbinit but just when a specific binary is loaded in gdb?如何使用 gdbinit 设置 arg 但仅在 gdb 中加载特定二进制文件时?
【发布时间】:2012-12-05 23:34:42
【问题描述】:

如何通过文件 ~/.gdbinit set arg -d 而只是在 gdb 中加载特定的二进制文件时?

【问题讨论】:

    标签: debugging gdb elf gdbinit


    【解决方案1】:

    使用 python,您可以在 gdbinit 中添加类似以下内容

    py
    def on_bin_echo(): gdb.execute("set arg -d")
    exec_funcs = {"/bin/echo" : on_bin_echo}
    map(lambda x: exec_funcs[x.filename]() if exec_funcs.has_key(x.filename) else None, gdb.objfiles())
    end
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-11
      • 2014-11-28
      • 1970-01-01
      相关资源
      最近更新 更多