Skip to main content
edited title
Link

How do Ito use gdbthe GDB debugger with OpenMolcas?

Became Hot Network Question
Source Link

How do I use gdb with OpenMolcas?

I would like to follow how some variables are changing during an OpenMolcas calculation, and adding WRITE statements has become too tedious. I've compiled with the -DCMAKE_BUILD_TYPE=Debug option:

cmake ../OpenMolcas_HPQC_LEVEL -DCMAKE_BUILD_TYPE=Debug
make -j8

I've set the PATH accordingly:

pymolcas
> MOLCAS has been found at /home/nike/build_OpenMolcas_HPQC_LEVEL_Debug

Attempts to use gdb have failed, for example:

gdb --args pymolcas
> "/home/nike/build_OpenMolcas_HPQC_LEVEL_Debug/pymolcas": not in executable format: file format not recognized

When searching the word "debug" on the Molcas forum I got about 29 results, but most of them were about running calculations in parallel (I am not), or just had the word debug in the post because it was part of the CMAKE output, even if the post had nothing to do with debugging. The most relevant results that I found there were:

  • The -D DEBUG_DEFS=_DEVEL_ was recommended here but that was in the context of turning errors into warnings (which is not what I'm trying to do).
  • This post) includes an output file that says "To debug your program, run it with the --sync command line option", but it's in the context of LUSCUS and pymolcas -h suggests that --sync isn't an option for pymolcas.

I also searched the documentation, and found that there's a MOLCAS_DEBUGGER environment variable but running export MOLCAS_DEBUGGER=gdb before the above gdb command leads to the same error (and I assume this environment variable affects the running of molcas rather than pymolcas). The word "debug" shows up a few times in the Documentation PDF (18 times to be exact) but mainly in the context of printing more output, in addition to the afformentioned CMAKE build type and the MOLCAS_DEBUGGER variable

The word debug appears another 71 times in the CMakeLists file but rather than going through every possibility there, if there's perhaps a set of instructions on how to use gdb with OpenMolcas (perhaps in the documentation), it would be helpful if you could let me know them!