gdbserver自身不支持multiple process;如果你调试parent process时在子进程上下断点,子进程在运行到那个断点时就会SIGTRAP。

如果你要调试fork出来的子进程:

1. 运行父进程,fork,得到child pid;

2. 子进程sleep;

3. 开gdb,attach到child pid。

这里面的step 2是个可选项;如果你不需要调试子进程的启动阶段,就不需要sleep:step 2的目的是为了让你在子进程真正运行起来前有时间attach上去。

如果你用gdbserver做remote debug:

$ gdbserver --attach ip:port pid

gdb: multiple process debug的更多相关文章

  1. GDB: advanced usages

    Sometimes running program in Unix will fail without any debugging info or warnings because of the la ...

  2. https://sourceware.org/gdb/onlinedocs/gdb/Forks.html

    https://sourceware.org/gdb/onlinedocs/gdb/Forks.html Next: Checkpoint/Restart, Previous: Threads, Up ...

  3. invoking gdb

    [invoking gdb] The most usual way to start gdb is with one argument, specifying an executable progra ...

  4. 利用gdb 调试android jni c动态库

    http://blog.dornea.nu/2015/07/01/debugging-android-native-shared-libraries/ Since I haven't done thi ...

  5. GDB技巧整理

    https://blog.atime.me/note/gdb-tricks.html 整理常用的gdb技巧. 常用命令 常用的gdb命令... 启动gdb 直接运行 gdb --args prog a ...

  6. [转] linux下的c/c++调试器gdb

    PS:1. 断点C++类函数,用b 命名空间::类名::方法名 2. 编译参数一定要加-g,才可断点调试 http://www.cnblogs.com/xd502djj/archive/2012/08 ...

  7. 使用单进程、strace、gdb调试PHP错误

    使用单进程.strace.gdb调试PHP错误 PHP一般是在FPM的呵护下运行的,但是某些情况下进程异常崩溃会导致502.下面是解决思想: 1. 单进程运行: php -d display_erro ...

  8. GDB使用记录

    ref:http://sunyongfeng.com/201506/programmer/tools/gdb.html 简介 GDB,GNU Debugger,特性如下: GDB具备各种调试功效,可对 ...

  9. Debug Hacks中文版——深入调试的技术和工具

    关键词:gdb.strace.kprobe.uprobe.objdump.meminfo.valgrind.backtrace等. <Debugs Hacks中文版——深入调试的技术和工具> ...

随机推荐

  1. hdu 5206 Four Inages Strategy

    题目大意: 判断空间上4个点是否形成一个正方形 分析: 标称思想 : 在p2,p3,p4中枚举两个点作为p1的邻点,不妨设为pi,pj,然后判断p1pi与p1pj是否相等.互相垂直,然后由向量法,最后 ...

  2. 检测到在集成的托管管道模式下不适用的 ASP.NET 设置的解决方法

    在将应用程序从经典模式迁移到集成模式时,可以保留经典模式下的自定义模块和处理程序注册,也可以将这些注册移除.如果不移除经典模式下使用的 httpModules 和 httpHandlers 注册,则必 ...

  3. C# DataSet取值

    1.读取dataset中某表某行某列的值: dataset.Tables[].Rows[].ItemArray[].ToString()dataset.Tables[0].Rows[0][0]; 该示 ...

  4. 关于FireFox类VIM插件。VimPerator

    说实话现在一直非常喜欢VIM的那种操控方式.当然我不是一个程序员,只是觉得处理文本的时候,那种效率很快.而且不用来回再鼠标跟键盘之间的切换也让我感觉很舒服. 以前一直在想如果开网页的时候也能那样得话不 ...

  5. 215. Kth Largest Element in an Array

    Find the kth largest element in an unsorted array. Note that it is the kth largest element in the so ...

  6. 334. Increasing Triplet Subsequence

    Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the ar ...

  7. lable自动适配大小

    #import "ViewController.h" @interface ViewController () @end @implementation ViewControlle ...

  8. Container With Most Water

    Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai).  ...

  9. hdu3308 线段树——区间合并

    更新一个点: 求某个区间的最长连续上升序列: 链接:http://acm.hdu.edu.cn/showproblem.php?pid=3308 #include <cstdio> #in ...

  10. Codeforces Round #146 (Div. 2)

    A. Boy or Girl 模拟题意. B. Easy Number Challenge 筛素数,预处理出\(d_i\). 三重循环枚举. C. LCM Challenge 打表找规律. 若\(n\ ...