Reputation: 21
I was using the answer from this post (Using GDB to debug an MPI program in Fortran) to debug an MPI Fortran program on my Mac. I tried to implement the answer that was given by Vladimir F. However, after:
gdb -pid <the_pid_you_got_from_getpid>
The debugger opened and I got the following message:
warning: unhandled dyld version (15)
0x00007fffb6f2ef46 in ?? ()
And when I tried:
(gdb) info locals
I got "No symbol table info available"
. As a result I can not attach gdb to the running process.
I am working with MacOS 10.12 (Sierra), gdb 8.0, and compiling with mpif90 configured for ifort (version: 17.0.4).
Any ideas about what could be the cause of my problem?
Upvotes: 2
Views: 1989
Reputation: 13405
If you are not that committed to gdb (which is, in fact, deprecated at mac os as part of default toolchain), you can play with lldb.
So, for a code like this:
program main
use mpi
integer error
integer id
integer p
call MPI_Init ( error )
call MPI_Comm_size ( MPI_COMM_WORLD, p, error )
call MPI_Comm_rank ( MPI_COMM_WORLD, id, error )
write (*,*) 'Hello: ', id, '/', p
call MPI_Finalize ( error )
stop
end
and compilation like this
mpif90 -g -o fort ./fort.f90
you should be able to start lldb following way
mpirun -np 2 xterm -e lldb ./fort
which will give you two, separate xterms with lldb running
Note that for xterm you need to have XQuartz installed (https://www.xquartz.org)
Update:
I am not sure whether this will help with this particular issue, but you can always try to compile GDB from the sources. Take a look here for description how to do it: Building GDB on macOS Sierra
Then, you can run mpirun with xterm and gdb and your MPI code like this
mpirun -np 2 xterm -e gdb ./mpi_sample
Now, you can see that there is still warning with dyld version, but code seems to work fine.
But still, question is, what will happen with ifort compiled code :( In my case I am using:
mpifort --version
GNU Fortran (GCC) 6.3.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
gdb --version
GNU gdb (GDB) 8.0
Copyright (C) 2017 Free Software Foundation, Inc.
mpirun --version
mpirun (Open MPI) 2.0.2
Upvotes: 3