How to debug custom SALOME module

Hi,

if you want to debug your module (other modules can stay in release mode):

  • start SALOME,
  • retrieve the pid of process SALOME_Session*
  • start gdb or any other debugger gui (e.g. gdbgui or QtCreator)
  • in your gdb session attach to the process.
    Note that you need to ensure that process tracking is enabled:
    cat /proc/sys/kernel/yama/ptrace_scope
    should return 0

More generally if you want to develop within SALOME, here is the approach you could use - I use it but other more advanced SALOME users may provide some additional tips/tricks.
This is illustrated below for Ubuntu 22.

Note that for Windows, you need to compile every module in debug with SAT, setting debug to yes in SALOME-9.12.0-windows.pyconf

# 0- Extract SALOME archive
tar zxf SALOME-9.12.0-native-UB22.04-SRC.tar.gz
cd SALOME-9.12.0-native-UB22.04-SRC

# 1- setup the developer mode
chmod u+x install_bin.sh
./install_bin.sh

# 2- generate a launcher which will use INSTALL directory instead of BINARIES-UB22.04
sat/sat launcher SALOME-9.12.0-native -n salome


# 3- generate a setup script aimed to set SALOME build and runtime environments
sat/sat environ SALOME-9.12.0-native

# 4- setup SALOME developer environment
source SALOME-9.12.0-native-UB22.04-SRC/env_build.sh

# 5- Prepare your sources and compile in DEBUG mode -  step 4 ensures that relevant environment variables are set.
#    Here you can iterate (make, make install)

# 6- edit file salome and append to it your module (see how this is done with  HELLO)

2 Likes