码迷,mamicode.com
首页 > 其他好文 > 详细

一个惊人的知识: 用反汇编调试mpi的段错误

时间:2021-03-29 12:06:47      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:ack   com   信息   x86   mapped   code   dump   反汇编   pre   

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

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

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

一个惊人的知识: 用反汇编调试mpi的段错误

标签:ack   com   信息   x86   mapped   code   dump   反汇编   pre   

原文地址:https://www.cnblogs.com/Tokubara/p/14584250.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!