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. 结果一看还真是那一行错了.

  • 相关阅读:
    如何统计一个字符串中某个字符出现的次数
    从GitHub克隆项目到本地
    nginx能做什么
    dubbo的使用实例
    zookeeper单机安装
    Http发送post(x-www-form-urlencoded)请求
    集群与分布式的区别
    cas的客户端应用是负载均衡,单点退出怎么办?
    mybatis执行DDL语句
    sql server 行列互换
  • 原文地址:https://www.cnblogs.com/Tokubara/p/14584250.html
Copyright © 2011-2022 走看看