zoukankan      html  css  js  c++  java
  • 用反汇编调试mpi的段错误

    我不是标题党, 但我确实很惊讶, 原来反汇编真的有可能作为辅助的调试手段.

    我运行一个很小的mpi程序(奇偶排序). 得到了以下的报错:

    $ mpirun -n 2 ./a.out
    [parallels-Parallels-Virtual-Platform:15012] *** Process received signal ***
    [parallels-Parallels-Virtual-Platform:15012] Signal: Segmentation fault (11)
    [parallels-Parallels-Virtual-Platform:15012] Signal code: Address not mapped (1)
    [parallels-Parallels-Virtual-Platform:15012] Failing at address: (nil)
    [parallels-Parallels-Virtual-Platform:15012] [ 0] /lib/x86_64-linux-gnu/libc.so.6(+0x3ef20)[0x7f438e998f20]
    [parallels-Parallels-Virtual-Platform:15012] [ 1] ./a.out(+0xe39)[0x55f058e63e39]
    [parallels-Parallels-Virtual-Platform:15012] [ 2] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7
    f438e97bb97]
    [parallels-Parallels-Virtual-Platform:15012] [ 3] ./a.out(+0xb8a)[0x55f058e63b8a]
    [parallels-Parallels-Virtual-Platform:15012] *** End of error message ***
    --------------------------------------------------------------------------
    Primary job  terminated normally, but 1 process returned
    a non-zero exit code. Per user-direction, the job has been aborted.
    --------------------------------------------------------------------------
    --------------------------------------------------------------------------
    mpirun noticed that process rank 0 with PID 0 on node parallels-Parallels-Virtual-Platform exited on signal 1
    1 (Segmentation fault).
    --------------------------------------------------------------------------
    

    其中[1]指示的是a.out, 这是源文件, 其它的是链接文件. 地址是0xe39. 在反汇编结果(objdump -d)中搜索0xe39, 还真有. 问题是, 它对应的是哪一行c源代码呢? 我所说的惊人的信息, 就是在这里. 看这个回答, 只需要加上-S, 就可以知道了, 但要注意, 想用-S, 一定需要先加上-g. 结果一看还真是那一行错了.

  • 相关阅读:
    电感和感抗
    电容和容抗
    ULN2003A驱动12V继电器
    5V转3.3V(TPS73101)
    电解电容和钽电容的区别
    svn 报错 Previous operation has not finished; run 'cleanup' if it was interrupted
    html格式 保持原样输出的标签
    微信公众号开发
    Hibernate各种主键生成策略与配置详解
    SVN符号说明
  • 原文地址:https://www.cnblogs.com/Tokubara/p/14584250.html
Copyright © 2011-2022 走看看