Last Updated: February 25, 2016
·
1.718K
· dawehner

Debug an openMPI application using lldb

Writing parallel code is a good source for all kind of bugs.

Here is a simple way to debug those using lldb. It creates one terminal window
for each parallel processes in which you have a running lldb. Yes, creating a lot of them really feels like being in the matrix.

# Start lldb with a lldb configuration attached.
/home/wehner/chroot/bin/mpirun -np 3 --prefix ~/chroot xterm -e lldb-3.4 -s lldb-debug.txt

The actual lldb-debug.txt then contains the breakpoint and other instructions.

# The lldb connection contains:
 file /home/wehner/path-to/executable

  # Ensure that lldb knows where the source files are
  settings set target.source-map /home/wehner/path-to               /home/wehner/diplomarbeit/home/wehner/path-to/executable

 file  /home/wehner/path-to/executable

 b foo.cpp:463
 process launch /home/wehner/path-to/executable additional-par

Finally a short list of links helpful for lldb