# How to debug pvserver with MPI and gdb

**URL:** https://discourse.paraview.org/t/how-to-debug-pvserver-with-mpi-and-gdb/3173
**Category:** Tips and Tricks
**Created:** [December 12, 2019, 2:53pm UTC](https://discourse.paraview.org/t/how-to-debug-pvserver-with-mpi-and-gdb/3173 "2019-12-12T14:53:55Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [December 12, 2019, 2:53pm UTC](https://discourse.paraview.org/t/how-to-debug-pvserver-with-mpi-and-gdb/3173/1 "2019-12-12T14:53:55Z")

</div>

A simple yet very practical way to debug pvserver with mpi and gdb.

`mpirun -np 4 xterm -e gdb ./bin/pvserver -ex 'run'`

This will open 4 xterm windows, one for each process and start the pvserver inside gdb. You can then place breakpoints as needed.

This does not allows to create breakpoints on all instance with a single command, they need to be repeated.

You can then connect to the pvserver as usual.

---

<div class="post-metadata">

### Author: ![jfausty](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jfausty/32/9405_2.png) [@jfausty](https://discourse.paraview.org/u/jfausty)
#### Post date: [June 7, 2023, 2:03pm UTC](https://discourse.paraview.org/t/how-to-debug-pvserver-with-mpi-and-gdb/3173/2 "2023-06-07T14:03:03Z")

</div>

A great tool for performing this kind of operation is `tmpi` ([GitHub - Azrael3000/tmpi: Run a parallel command inside a split tmux window](https://github.com/Azrael3000/tmpi)).

By prefixing your debug command with `tmpi` as such:

```auto
tmpi 4 gdb ./bin/pvserver -ex 'run'

```

your parallel processes get attached to split tmux terminals and commands for controlling your debugger can be invoked on all processes at the same time.

I highly recommend it!

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [April 11, 2025, 1:23pm UTC](https://discourse.paraview.org/t/how-to-debug-pvserver-with-mpi-and-gdb/3173/3 "2025-04-11T13:23:57Z")

</div>

Side note: How to run gdb with a single server and run the other without it:

`mpirun -bynode -np 1 xterm -e gdb ./bin/pvserver : -np 2 xterm -e ./bin/pvserver`
