Distributions
› Ubuntu
› Fedora
› CentOS
中文资源站
› 网易开源镜像站
KyL
V2EX  ›  Linux

GDB 的断点设置可以写成脚本执行吗

  •  
  •   KyL · Feb 4, 2015 · 4690 views
    This topic created in 4253 days ago, the information mentioned may be changed or developed.

    每次开始Debug的时候,执行run之前都要一个一个手动设置断点

    (gdb)b file1.c:foo1
    (gdb)b file2.c:foo2
    ...
    

    有没有办法把断点设置写成脚本,在启动GDB的时候能够直接根据脚本来设置呢?

    5 replies  •  2015-02-04 16:39:08 +08:00
    liwei
        1
    liwei  
       Feb 4, 2015   ❤️ 1
    man gdbinit
    delo
        2
    delo  
       Feb 4, 2015 via iPhone   ❤️ 1
    以前用gdb -x 不过搜了一下方法还蛮多的
    auser
        3
    auser  
       Feb 4, 2015 via Android
    去官网下载gdb的doc

    几百页慢慢看 看完收获巨大
    silajoin
        4
    silajoin  
       Feb 4, 2015   ❤️ 1
    https://sourceware.org/gdb/onlinedocs/gdb/Command-Files.html

    写到文件里,
    echo "b file1.c:foo1" > filename
    echo "b file2.c:foo2" >> filename

    (gdb) source filename
    joyeblue
        5
    joyeblue  
       Feb 4, 2015   ❤️ 1
    保存
    save breakpoints filename
    加载
    source filename
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   918 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 18:35 · PVG 02:35 · LAX 11:35 · JFK 14:35
    ♥ Do have faith in what you're doing.