From 64c8cd409d596e06f0b4c8bbd5fb7b0f80c1e857 Mon Sep 17 00:00:00 2001 From: rc-swag <58423624+rc-swag@users.noreply.github.com> Date: Thu, 9 Jun 2022 17:20:37 +1000 Subject: [PATCH] Created Delphi Debugging Notes (markdown) --- Delphi-Debugging-Notes.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Delphi-Debugging-Notes.md diff --git a/Delphi-Debugging-Notes.md b/Delphi-Debugging-Notes.md new file mode 100644 index 0000000..9481d13 --- /dev/null +++ b/Delphi-Debugging-Notes.md @@ -0,0 +1,25 @@ +**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.