docs/debugger/native-debugging.md
Since 2025.1.1 version Enso comes with first class support for
native image execution mode.
Such a mode is fast to start and is thus really suitable for production. In
majority of cases it behaves exactly the same as so called --jvm mode used
during development. As such there shall not be so much need, to debug the
native image itself. Use runtime debugging in the JVM
mode where possible. Should JVM debugging not be enough, continue reading.
By default the native image execution mode doesn't contain enough information for debugging. The native executable needs to be re-built with such debugging information. Since #12993 rebuilding is as easy as:
enso$ ENSO_LAUNCHER=native,-ls,fast,debug sbt buildEngineDistribution
and then use VSCode with
Enso extension
to debug enso native executable. Btw. no need for -ls,fast - they just make
the build faster.
With the Enso extension one can experience following:
The above picture shows what needs to be done in VSCode:
once the debug ready built is finished
switch to "Run and Debug" perspective
select "Launch Native Image" configuration
select an .enso file in editor like Vector_Spec.enso
press F5 to start debugging it
Mixed Debugging is usually performed in JVM mode. However with a bit of patience it is possible to do mixed debugging also in Launch Native Image mode with some more manual steps:
launch.json to provide polyglot.dap property.enso file is selectedOne can debug Java via NI debugger and Enso code via the DAP. One just needs to carefully switch between those two debugging sessions in VSCode.