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

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

  •  
  •   KyL · Feb 4, 2015 · 4833 views
    This topic created in 4295 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
    liwei
    Feb 4, 2015❤️1
    1
    man gdbinit
    delo
    delo
    Feb 4, 2015 via iPhone❤️1
    2
    以前用gdb -x 不过搜了一下方法还蛮多的
    auser
    auser
    Feb 4, 2015 via Android
    3
    去官网下载gdb的doc

    几百页慢慢看 看完收获巨大
    silajoin
    silajoin
    Feb 4, 2015❤️1
    4
    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
    joyeblue
    Feb 4, 2015❤️1
    5
    保存
    save breakpoints filename
    加载
    source filename
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1404 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 00:11 · PVG 08:11 · LAX 16:11 · JFK 19:11
    ♥ Do have faith in what you're doing.