How to debug Salome 9.12.0 in vscode?

Hello everyone,
I want to use vscode to set breakpoints to see the values and that the gui context of salome get refreshed. (the old method in Salome 9.8.0 not works for 9.12.0)

In case you want to use Linux, here is what you can do:

  • Edit the .pyconf file in PROJECT/applications and set debug’ to ‘yes’

  • compile the module, e.g. GUI:

./sat/sat prepare SALOME-9.12.0-native -p GUI
./sat/sat -t compile SALOME-9.12.0-native -p GUI --clean_all
  • check that you can track processes. If not check SF-1160

  • install two additional VSCode extensions:

    Note that if the extensions are not found in VSCode, you need to download them by clicking on “Download extension” on the extension pag and in a console type: code --install-extension ext.vsix

  • Then, in the .vscode directory in your workspace, you need to attach the launch.json file at the end of this thread.

  • Finally, launch SALOME, and in the vscode debug interface select Attach to PID.

launch.json (828 Bytes)

If you come to some useful approach, feel free to share it.
Regards.

Thanks for your reply @NabilG, but I may not have expressed clear my question. I am trying to test my modeling script in vscode, for example I used geompy.addToStudy(obj, ‘myGeomObj’) and put a breakpoint in front of that line. I want to be able to render obj in an already opened salome instance when I run to that line in vscode.

then you need to start vscode from SALOME instance.
To do so, in the main menu, select Tools - plugins - Launch VSCode and run your script step by step.

Regards.

I have tried your method, but salome.sg.hasDesktop() returns False and there is nothing updated in GUI.

Regards.