Remote Debugging of OpenEMS

Hello All,

Has anyone here debugged the OpenEMS code remotely with Eclipse? I would like to have the OpenEMS instance running on a server without a GUI and still be able to debug and work with the code there.

Eg, VS Code has plugins to allow for remote debugging in such situations. Does Eclipse have a similar plugin? Eclipse has a debug setting for Remote Java Application but it is not available in the BndTools perspective. Should I be using that?

Thank you! :slight_smile:

Hi @dsen,

I have never tried it myself, but using bndtools it should be possible:

19.5 Remote Launching
The purpose of the aQute Remote project is to provide remote debugging support for bnd projects. It can be used to debug bundles and bndrun files in a remote machine running an OSGi framework with an agent installed on it; it can also install a framework on a remote machine before it uses the agent. The architecture is heavily optimized to run on small remote machines.

Regards,
Stefan

JAVA_TOOL_OPTIONS='-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005' java -jar ./openems-edge.jar

If you change to suspend=n, then process will not wait for debugger to attach. It will work just like within Eclipse/IDE launch.

The bnd launcher does not fork/launch new process, so all options which you specify for first Java process apply directly to openEMS. The JAVA_TOOL_OPTIONS is not well documented, but works across multiple places.

Cheers,
Łukasz

1 Like