-
-
Notifications
You must be signed in to change notification settings - Fork 17
Debug plugin
As you know, a plugin is a separated process of Yadoms. Traditional debugging (debug main application to enter in the plugin code) is not available. Here is the way to debug your plugin.
The simplest way is to create a empty (or not) file named waitForDebuggerAtStart
(without any extension), in the plugin executable folder (ie under Windows in : {Yadoms folder}\builds\DEBUG\plugins\myPlugin\
).
If this file exists, the plugin will wait at startup for 120 seconds, for a debugger to attach. Plugin will run normally if no debugger is attached after this time.
Use case example under Windows, with Visual Studio :
- Create the empty file
waitForDebuggerAtStart
in{Yadoms folder}\builds\DEBUG\plugins\dev-fakePlugin\
- Start Yadoms (or start a fakePlugin instance from Yadoms dashboard)
- In Yadoms console, you should see a message saying that plugin is waiting for a debugger
- On Visual Studio, click on "Debug/Attach to Process..."
- Select the
dev-fakePlugin.exe
process and click "Attach" - You can now open sources files, set breakpoints, etc...
This solution does not allow to debug at the very beginning of the plugin execution (static variables initialization for example). In you need such debug, use the second way.
This solution will attach a debugger as soon as plugin executable is loaded, before processing any code. It can be useful to debug initialization problems.
(Read more about this method here.)
Note : it seems that in certain situations Visual Studio must be started as administrator to make this solution work
- In the registry, add in
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\currentversion\image file execution options
, a key of the name of your plugin executable (ex :dev-fakePlugin.exe
). - Add a string value named
debugger
, containing the stringvsjitdebugger.exe
. - Next time your plugin will start, you will prompted for open a debugger, that will stop at your plugin first line.
- Now just open your source files (with File/Open menu command) to set breakpoints or debug step-by-step.
Yadoms -- The ultimate house automation solution