-
-
Notifications
You must be signed in to change notification settings - Fork 112
Delphi Debugging Notes
Debugging kmshell with Embarcadero® Delphi 10.3
Load the kmshell.dproj in the Embarcadero® Delphi IDE to debug kmshell.exe.
The main non-obvious step of setting this up is to use Regserv32 to register the kmcomapi.dll that your local branch is building.
Open an elevated command prompt (Run as administrator) Change directory to the where the release build is created for local developer builds. For example
Prompt:> cd "c:\Projects\keyman\app\windows\src\engine\kmcomapi\bin\Win32\Release\"
Prompt:> Regsvr32 kmcomapi.dll
Once finished debugging, re register your local Keyman installation version of the dll.
Prompt:> Regsvr32 "c:\program files (x86)\common files\keyman\keyman engine\kmcomapi.dll"
You can set up the command line arguments to run with kmshell.exe.
From the menu Run->Parameters
. This brings up a form with a text field to enter arguments. This is useful if you want to debug the forked child or elevated process.
Due to the need to run in different processes including sometimes elevated processes of kmshell.exe, it can be tricky to debug but there are ways to work around that.
For example, place a breakpoint just before the forked call to a new kmshell.exe process To see what all the arguments are at this point. Stop the debugger set the command parameters as mentioned above and execute the new process. If it needs to be an elevated process start the Delphi IDE as an elevated process.