zoukankan      html  css  js  c++  java
  • gdb与信号

    http://simohayha.iteye.com/blog/493091

    gdb可以监测在你的程序中的任何信号。 

    主要靠的命令是:

    handle signal [keywords...] 

    这里的keywords可以有以下内容:

    1 nostop gdb接收到信号不会停止程序,而只是打印出一段message 

    2 stop 和上面类似只不过会停止程序。 

    3 print 当信号发生必须打印一条消息通知。 

    4 noprint 信号发生,gdb将不会打印任何东西。 

    5 pass和noignore 这两个是同义的。表示信号对你的程序是可见的。 

    6 nopass和ignore 这两个也是同义的。和上面相反。。 

    线程模式,

    set scheduler-locking on|off|step

    默认为off,也就是所有的线程都一起走。

    set schedule-multiple mode 

    这个是针对进程的线程,如果为on,那么所有进程的线程都能够执行。

    none-stop模式。 

    顾名思义,当程序在gdb中停止,只有当前的线程会被停止,而其他的线程将会继续运行。 
    这个时候step,next这些命令就只对当前的线程起作用。 

    我们要打开这个模式需要这样操作: 

    # Enable the async interface.  
    set target-async 1  
    # If using the CLI, pagination breaks non-stop.  
    set pagination off  
    # Finally, turn it on!  
    set non-stop on  

    在all-stop模式中interrupt将会停止所有的线程。而在none-stop中只会停止当前线程。interrupt -a此时就能停止所有线程。’ 

    当你有多个线程,你此时只想给某个线程设置断点,这个时候可以用这个命令: 

    break linespec thread threadno 
    break linespec thread threadno if ... 

    linespec为源码行号,threadno为线程id。 

  • 相关阅读:
    ubuntu12.04 安装CAJViewer-ubuntu(待解决)
    ROS中遇到的一些问题和解决(更新)
    Virtualbox主机和虚拟机之间文件夹共享及双向拷贝
    Ubuntu自带截图工具screenshoot
    Ubuntu vim终端常用的快捷键
    Ubuntu终端多窗口分屏Terminator
    Apollo快速安装视频教程
    ML--XOR问题
    DL之Example1--MNIST
    Python之ML--人工神经网络识别图像
  • 原文地址:https://www.cnblogs.com/charlesblc/p/6433929.html
Copyright © 2011-2022 走看看