diff --git a/windows/src/desktop/kmbrowserhost/kmbrowserhost.res b/windows/src/desktop/kmbrowserhost/kmbrowserhost.res
index 08809368b7..6876088a66 100644
Binary files a/windows/src/desktop/kmbrowserhost/kmbrowserhost.res and b/windows/src/desktop/kmbrowserhost/kmbrowserhost.res differ
diff --git a/windows/src/desktop/kmshell/kmshell.dpr b/windows/src/desktop/kmshell/kmshell.dpr
index 11b0f711c6..143e91ee97 100644
--- a/windows/src/desktop/kmshell/kmshell.dpr
+++ b/windows/src/desktop/kmshell/kmshell.dpr
@@ -157,7 +157,8 @@ uses
Sentry.Client in '..\..\ext\sentry\Sentry.Client.pas',
Sentry.Client.Vcl in '..\..\ext\sentry\Sentry.Client.Vcl.pas',
sentry in '..\..\ext\sentry\sentry.pas',
- Keyman.System.KeymanSentryClient in '..\..\global\delphi\general\Keyman.System.KeymanSentryClient.pas';
+ Keyman.System.KeymanSentryClient in '..\..\global\delphi\general\Keyman.System.KeymanSentryClient.pas',
+ Keyman.Configuration.UI.UfrmDiagnosticTests in 'util\Keyman.Configuration.UI.UfrmDiagnosticTests.pas' {frmDiagnosticTests};
{$R VERSION.RES}
{$R manifest.res}
diff --git a/windows/src/desktop/kmshell/kmshell.dproj b/windows/src/desktop/kmshell/kmshell.dproj
index c8b286254f..e104b76831 100644
--- a/windows/src/desktop/kmshell/kmshell.dproj
+++ b/windows/src/desktop/kmshell/kmshell.dproj
@@ -302,6 +302,10 @@
+
+
+ dfm
+
Cfg_2
@@ -394,18 +398,18 @@
true
-
-
- kmshell.exe
- true
-
-
.\
true
+
+
+ kmshell.exe
+ true
+
+
1
diff --git a/windows/src/desktop/kmshell/kmshell.res b/windows/src/desktop/kmshell/kmshell.res
index b40caabf45..8324d16ca3 100644
Binary files a/windows/src/desktop/kmshell/kmshell.res and b/windows/src/desktop/kmshell/kmshell.res differ
diff --git a/windows/src/desktop/kmshell/main/UfrmMain.pas b/windows/src/desktop/kmshell/main/UfrmMain.pas
index 2159c58cf5..9f3a1b1a60 100644
--- a/windows/src/desktop/kmshell/main/UfrmMain.pas
+++ b/windows/src/desktop/kmshell/main/UfrmMain.pas
@@ -168,6 +168,7 @@ uses
KeyboardListXMLRenderer,
Imm,
initprog,
+ Keyman.Configuration.UI.UfrmDiagnosticTests,
KeymanOptionNames,
KeyNames,
LanguagesXMLRenderer,
@@ -805,7 +806,10 @@ end;
procedure TfrmMain.Support_Diagnostics;
begin
- kmcom.Control.OpenDiagnostics;
+ // Show the internal debug diagnostic tests form if Ctrl+Shift is down
+ if(GetKeyState(VK_CONTROL) < 0) and (GetKeyState(VK_SHIFT) < 0)
+ then TfrmDiagnosticTests.Run
+ else kmcom.Control.OpenDiagnostics;
end;
procedure TfrmMain.Support_Online;
diff --git a/windows/src/desktop/kmshell/util/Keyman.Configuration.UI.UfrmDiagnosticTests.dfm b/windows/src/desktop/kmshell/util/Keyman.Configuration.UI.UfrmDiagnosticTests.dfm
new file mode 100644
index 0000000000..148e869fa4
--- /dev/null
+++ b/windows/src/desktop/kmshell/util/Keyman.Configuration.UI.UfrmDiagnosticTests.dfm
@@ -0,0 +1,72 @@
+object frmDiagnosticTests: TfrmDiagnosticTests
+ Left = 0
+ Top = 0
+ BorderIcons = [biSystemMenu]
+ BorderStyle = bsDialog
+ Caption = 'Diagnostic Tests'
+ ClientHeight = 166
+ ClientWidth = 362
+ Color = clBtnFace
+ Font.Charset = DEFAULT_CHARSET
+ Font.Color = clWindowText
+ Font.Height = -11
+ Font.Name = 'Tahoma'
+ Font.Style = []
+ OldCreateOrder = False
+ PixelsPerInch = 96
+ TextHeight = 13
+ object cmdSendTestException: TButton
+ Left = 8
+ Top = 8
+ Width = 185
+ Height = 25
+ Caption = '&Send Test Exception'
+ TabOrder = 0
+ OnClick = cmdSendTestExceptionClick
+ end
+ object cmdSendTestCOMAPIException: TButton
+ Left = 8
+ Top = 70
+ Width = 185
+ Height = 25
+ Caption = 'Send Test COM &API Exception'
+ TabOrder = 1
+ end
+ object cmdClose: TButton
+ Left = 279
+ Top = 133
+ Width = 75
+ Height = 25
+ Cancel = True
+ Caption = '&Close'
+ ModalResult = 1
+ TabOrder = 2
+ end
+ object cmdSendTestEvent: TButton
+ Left = 8
+ Top = 39
+ Width = 185
+ Height = 25
+ Caption = '&Send Test Event'
+ TabOrder = 3
+ OnClick = cmdSendTestEventClick
+ end
+ object cmdSendTestKeyman32Exception: TButton
+ Left = 8
+ Top = 101
+ Width = 185
+ Height = 25
+ Caption = 'Send Test &keyman32 Exception'
+ TabOrder = 4
+ OnClick = cmdSendTestKeyman32ExceptionClick
+ end
+ object cmdSendTestKMTipException: TButton
+ Left = 8
+ Top = 132
+ Width = 185
+ Height = 25
+ Caption = 'Send Test km&tip Exception'
+ TabOrder = 5
+ OnClick = cmdSendTestKMTipExceptionClick
+ end
+end
diff --git a/windows/src/desktop/kmshell/util/Keyman.Configuration.UI.UfrmDiagnosticTests.pas b/windows/src/desktop/kmshell/util/Keyman.Configuration.UI.UfrmDiagnosticTests.pas
new file mode 100644
index 0000000000..e80e49ef82
--- /dev/null
+++ b/windows/src/desktop/kmshell/util/Keyman.Configuration.UI.UfrmDiagnosticTests.pas
@@ -0,0 +1,99 @@
+unit Keyman.Configuration.UI.UfrmDiagnosticTests;
+
+interface
+
+uses
+ Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
+ Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
+
+type
+ TfrmDiagnosticTests = class(TForm)
+ cmdSendTestException: TButton;
+ cmdSendTestCOMAPIException: TButton;
+ cmdClose: TButton;
+ cmdSendTestEvent: TButton;
+ cmdSendTestKeyman32Exception: TButton;
+ cmdSendTestKMTipException: TButton;
+ procedure cmdSendTestExceptionClick(Sender: TObject);
+ procedure cmdSendTestEventClick(Sender: TObject);
+ procedure cmdSendTestCOMAPIEventClick(Sender: TObject);
+ procedure cmdSendTestKMTipExceptionClick(Sender: TObject);
+ procedure cmdSendTestKeyman32ExceptionClick(Sender: TObject);
+ private
+ { Private declarations }
+ public
+ { Public declarations }
+ class procedure Run;
+ end;
+
+implementation
+
+uses
+ Sentry.Client,
+
+ Keyman.System.KeymanSentryClient,
+ KeymanEngineControl,
+ kmint;
+
+{$R *.dfm}
+
+procedure TfrmDiagnosticTests.cmdSendTestCOMAPIEventClick(Sender: TObject);
+begin
+ (kmcom.Control as IKeymanEngineControl).DiagnosticTestException;
+end;
+
+procedure TfrmDiagnosticTests.cmdSendTestEventClick(Sender: TObject);
+begin
+ TKeymanSentryClient.Client.MessageEvent(Sentry.Client.SENTRY_LEVEL_INFO, 'Triggered '+TKeymanSentryClient.LOGGER_DESKTOP+'.kmshell');
+end;
+
+procedure TfrmDiagnosticTests.cmdSendTestExceptionClick(Sender: TObject);
+begin
+ TKeymanSentryClient.Validate(True);
+end;
+
+type
+ TKeyman_Diagnostic = procedure(mode: Integer); stdcall;
+
+procedure TfrmDiagnosticTests.cmdSendTestKeyman32ExceptionClick(
+ Sender: TObject);
+var
+ h: THandle;
+ Keyman_Diagnostic: TKeyman_Diagnostic;
+begin
+ h := GetModuleHandle('keyman32.dll');
+ if h <> 0 then
+ begin
+ Keyman_Diagnostic := GetProcAddress(h, 'Keyman_Diagnostic');
+ if Assigned(Keyman_Diagnostic) then
+ Keyman_Diagnostic(0);
+ end;
+end;
+
+procedure TfrmDiagnosticTests.cmdSendTestKMTipExceptionClick(Sender: TObject);
+var
+ h: THandle;
+ Keyman_Diagnostic: TKeyman_Diagnostic;
+begin
+ h := GetModuleHandle('kmtip.dll');
+ if h <> 0 then
+ begin
+ Keyman_Diagnostic := GetProcAddress(h, 'Keyman_Diagnostic');
+ if Assigned(Keyman_Diagnostic) then
+ Keyman_Diagnostic(0);
+ end;
+end;
+
+class procedure TfrmDiagnosticTests.Run;
+var
+ f: TfrmDiagnosticTests;
+begin
+ f := TfrmDiagnosticTests.Create(nil);
+ try
+ f.ShowModal;
+ finally
+ f.Free;
+ end;
+end;
+
+end.
diff --git a/windows/src/desktop/kmshell/xml/sentry.init.js.in b/windows/src/desktop/kmshell/xml/sentry.init.js.in
index e401a6c552..2624875636 100644
--- a/windows/src/desktop/kmshell/xml/sentry.init.js.in
+++ b/windows/src/desktop/kmshell/xml/sentry.init.js.in
@@ -12,15 +12,28 @@ Sentry.init({
release: 'release-$VersionWithTag'
});
-/* // Test sentry here:
-function foobar() {
- fbb();
+function keymanEnableDiagnostics() {
+ var e = document.createElement('button');
+ e.style.zIndex = '1000';
+ e.style.position = 'fixed';
+ e.style.right = '10px';
+ e.style.top = '10px';
+ e.style.height = '24px';
+ e.innerText = 'Test Exception';
+ e.onclick = function() {
+ var boo = null.boo();
+ }
+ document.body.appendChild(e);
+
+ e = document.createElement('button');
+ e.style.zIndex = '1000';
+ e.style.position = 'fixed';
+ e.style.right = '10px';
+ e.style.top = '38px';
+ e.style.height = '24px';
+ e.innerText = 'Test Event';
+ e.onclick = function() {
+ Sentry.captureMessage('Test Event');
+ }
+ document.body.appendChild(e);
}
-
-function fbb() {
-
- Sentry.captureException(new Error("Something broke again"));
-}
-
-foobar();
-*/
\ No newline at end of file
diff --git a/windows/src/developer/TIKE/main/UfrmMain.dfm b/windows/src/developer/TIKE/main/UfrmMain.dfm
index fb3c8d4764..9caa3a262b 100644
--- a/windows/src/developer/TIKE/main/UfrmMain.dfm
+++ b/windows/src/developer/TIKE/main/UfrmMain.dfm
@@ -3091,11 +3091,15 @@ inherited frmKeymanDeveloper: TfrmKeymanDeveloper
object Options1: TMenuItem
Action = modActionsMain.actToolsOptions
end
- object DebugTests1: TMenuItem
+ object mnuToolsDebugTests: TMenuItem
Caption = 'Debug Tests'
- object CrashTest1: TMenuItem
- Caption = 'Crash Test'
- OnClick = crash1Click
+ object mnuToolsDebugTestsExceptionTest: TMenuItem
+ Caption = '&Exception Test'
+ OnClick = mnuToolsDebugTestsExceptionTestClick
+ end
+ object mnuToolsDebugTestsCompilerExceptionTest: TMenuItem
+ Caption = '&Compiler Exception Test'
+ OnClick = mnuToolsDebugTestsCompilerExceptionTestClick
end
end
end
diff --git a/windows/src/developer/TIKE/main/UfrmMain.pas b/windows/src/developer/TIKE/main/UfrmMain.pas
index 4cb7f297a1..02c5b217a0 100644
--- a/windows/src/developer/TIKE/main/UfrmMain.pas
+++ b/windows/src/developer/TIKE/main/UfrmMain.pas
@@ -267,20 +267,21 @@ type
ReloadasANSI1: TMenuItem;
ReloadasUTF81: TMenuItem;
ReloadasUTF161: TMenuItem;
- DebugTests1: TMenuItem;
- CrashTest1: TMenuItem;
+ mnuToolsDebugTests: TMenuItem;
+ mnuToolsDebugTestsExceptionTest: TMenuItem;
CloseProject1: TMenuItem;
mnuModel: TMenuItem;
CompileModel1: TMenuItem;
N2: TMenuItem;
estLexicalModel1: TMenuItem;
+ mnuToolsDebugTestsCompilerExceptionTest: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure mnuFileClick(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure mnuProjectClick(Sender: TObject);
- procedure crash1Click(Sender: TObject);
+ procedure mnuToolsDebugTestsExceptionTestClick(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure cbTextFileFormatItemClick(Sender: TObject);
procedure cbDebugSystemKeyboard_DropDown(Sender: TObject);
@@ -292,6 +293,7 @@ type
procedure pagesChange(Sender: TObject);
procedure pagesCloseTab(Sender: TObject; Index: Integer);
procedure ools1Click(Sender: TObject);
+ procedure mnuToolsDebugTestsCompilerExceptionTestClick(Sender: TObject);
private
AppStorage: TJvAppRegistryStorage;
@@ -424,6 +426,7 @@ uses
Keyman.System.CEFManager,
CharMapDropTool,
+ compile,
HTMLHelpViewer,
KLog,
keymanapi_TLB,
@@ -1365,8 +1368,7 @@ end;
procedure TfrmKeymanDeveloper.ools1Click(Sender: TObject);
begin
- inherited;
- DebugTests1.Visible := GetKeyState(VK_SHIFT) < 0;
+ mnuToolsDebugTests.Visible := (GetKeyState(VK_CONTROL) < 0) and (GetKeyState(VK_SHIFT) < 0);
end;
procedure TfrmKeymanDeveloper.mnuProjectClick(Sender: TObject);
@@ -1403,7 +1405,13 @@ begin
modActionsMain.actToolsFileFormat.Execute;
end;
-procedure TfrmKeymanDeveloper.crash1Click(Sender: TObject);
+procedure TfrmKeymanDeveloper.mnuToolsDebugTestsCompilerExceptionTestClick(
+ Sender: TObject);
+begin
+ Compiler_Diagnostic(0);
+end;
+
+procedure TfrmKeymanDeveloper.mnuToolsDebugTestsExceptionTestClick(Sender: TObject);
begin
TKeymanSentryClient.Validate(True);
end;
diff --git a/windows/src/developer/TIKE/xml/app/lib/sentry/init.js.in b/windows/src/developer/TIKE/xml/app/lib/sentry/init.js.in
index 84b133982a..f7b15cd99c 100644
--- a/windows/src/developer/TIKE/xml/app/lib/sentry/init.js.in
+++ b/windows/src/developer/TIKE/xml/app/lib/sentry/init.js.in
@@ -12,15 +12,28 @@ Sentry.init({
release: 'release-$VersionWithTag'
});
-/* // Test sentry here:
-function foobar() {
- fbb();
+function keymanEnableDiagnostics() {
+ var e = document.createElement('button');
+ e.style.zIndex = '1000';
+ e.style.position = 'fixed';
+ e.style.right = '10px';
+ e.style.top = '10px';
+ e.style.height = '24px';
+ e.innerText = 'Test Exception';
+ e.onclick = function() {
+ var boo = null.boo();
+ }
+ document.body.appendChild(e);
+
+ e = document.createElement('button');
+ e.style.zIndex = '1000';
+ e.style.position = 'fixed';
+ e.style.right = '10px';
+ e.style.top = '38px';
+ e.style.height = '24px';
+ e.innerText = 'Test Event';
+ e.onclick = function() {
+ Sentry.captureMessage('Test Event');
+ }
+ document.body.appendChild(e);
}
-
-function fbb() {
-
- Sentry.captureException(new Error("Something broke again"));
-}
-
-foobar();
-*/
\ No newline at end of file
diff --git a/windows/src/developer/kmcmpdll/Compiler.cpp b/windows/src/developer/kmcmpdll/Compiler.cpp
index 2663db79c7..76d4aeb42b 100644
--- a/windows/src/developer/kmcmpdll/Compiler.cpp
+++ b/windows/src/developer/kmcmpdll/Compiler.cpp
@@ -3497,3 +3497,9 @@ HANDLE UTF16TempFromUTF8(HANDLE hInfile, BOOL hasPreamble)
SetFilePointer(hOutfile, 2, NULL, FILE_BEGIN);
return hOutfile;
}
+
+extern "C" void __declspec(dllexport) Keyman_Diagnostic(int mode) {
+ if (mode == 0) {
+ RaiseException(0xDEADBEEF, EXCEPTION_NONCONTINUABLE, 0, NULL);
+ }
+}
diff --git a/windows/src/developer/setup/setup.dproj b/windows/src/developer/setup/setup.dproj
index 8e39ae65cc..1c7e6d90c6 100644
--- a/windows/src/developer/setup/setup.dproj
+++ b/windows/src/developer/setup/setup.dproj
@@ -7,7 +7,7 @@
1
Console
None
- 18.4
+ 18.8
Win32
@@ -190,12 +190,16 @@
true
+
+
+ true
+
+
1
- Contents\MacOS
0
@@ -204,6 +208,20 @@
classes
1
+
+ classes
+ 1
+
+
+
+
+ res\xml
+ 1
+
+
+ res\xml
+ 1
+
@@ -216,90 +234,242 @@
library\lib\armeabi
1
+
+ library\lib\armeabi
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
library\lib\mips
1
+
+ library\lib\mips
+ 1
+
library\lib\armeabi-v7a
1
+
+ library\lib\arm64-v8a
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
res\drawable
1
+
+ res\drawable
+ 1
+
res\values
1
+
+ res\values
+ 1
+
+
+
+
+ res\values-v21
+ 1
+
+
+ res\values-v21
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+ res\values
+ 1
+
res\drawable
1
+
+ res\drawable
+ 1
+
res\drawable-xxhdpi
1
+
+ res\drawable-xxhdpi
+ 1
+
res\drawable-ldpi
1
+
+ res\drawable-ldpi
+ 1
+
res\drawable-mdpi
1
+
+ res\drawable-mdpi
+ 1
+
res\drawable-hdpi
1
+
+ res\drawable-hdpi
+ 1
+
res\drawable-xhdpi
1
+
+ res\drawable-xhdpi
+ 1
+
+
+
+
+ res\drawable-mdpi
+ 1
+
+
+ res\drawable-mdpi
+ 1
+
+
+
+
+ res\drawable-hdpi
+ 1
+
+
+ res\drawable-hdpi
+ 1
+
+
+
+
+ res\drawable-xhdpi
+ 1
+
+
+ res\drawable-xhdpi
+ 1
+
+
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+
+
+ res\drawable-xxxhdpi
+ 1
+
+
+ res\drawable-xxxhdpi
+ 1
+
res\drawable-small
1
+
+ res\drawable-small
+ 1
+
res\drawable-normal
1
+
+ res\drawable-normal
+ 1
+
res\drawable-large
1
+
+ res\drawable-large
+ 1
+
res\drawable-xlarge
1
+
+ res\drawable-xlarge
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+ res\values
+ 1
+
@@ -317,6 +487,10 @@
1
.framework
+
+ 1
+ .framework
+
0
@@ -326,6 +500,10 @@
1
.dylib
+
+ 1
+ .dylib
+
0
.dll;.bpl
@@ -348,6 +526,10 @@
1
.dylib
+
+ 1
+ .dylib
+
0
.bpl
@@ -357,6 +539,9 @@
0
+
+ 0
+
0
@@ -369,6 +554,9 @@
0
+
+ 0
+
0
@@ -384,6 +572,17 @@
1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
1
@@ -395,6 +594,39 @@
1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
1
@@ -406,6 +638,61 @@
1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
1
@@ -417,6 +704,116 @@
1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
1
@@ -450,10 +847,35 @@
1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
1
+
+ 1
+
@@ -479,6 +901,7 @@
1
+
@@ -486,12 +909,20 @@
Contents\Resources
1
+
+ Contents\Resources
+ 1
+
library\lib\armeabi-v7a
1
+
+ library\lib\arm64-v8a
+ 1
+
1
@@ -507,10 +938,19 @@
1
+
+ 1
+
0
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
1
@@ -546,7 +986,9 @@
+
+
12
diff --git a/windows/src/engine/keyman/UfrmKeyman7Main.pas b/windows/src/engine/keyman/UfrmKeyman7Main.pas
index f743a221f8..b6d59516f1 100644
--- a/windows/src/engine/keyman/UfrmKeyman7Main.pas
+++ b/windows/src/engine/keyman/UfrmKeyman7Main.pas
@@ -357,6 +357,8 @@ var
wm_keyman_globalswitch, wm_keyman_globalswitch_process, wm_keyman_control, wm_keyman_control_internal, wm_test_keyman_functioning: Cardinal;
+ FEnableCrashTest: Boolean = False;
+
const
KMC_StartProduct = 0;
KMC_StopProduct = 1;
@@ -396,6 +398,7 @@ uses
UfrmOSKCharacterMap,
utilstr,
utilwow64,
+ Keyman.System.KeymanSentryClient,
KeymanEngineControl,
KeymanControlMessages,
KeymanDesktopShell,
@@ -1543,6 +1546,10 @@ end;
procedure TfrmKeyman7Main.MnuOpenProductHelp(Sender: TObject);
begin
+ // Ctrl+Shift+Help command, with command line -sentry-client-test-exception
+ if FEnableCrashTest and (GetKeyState(VK_CONTROL) < 0) and (GetKeyState(VK_SHIFT) < 0) then
+ TKeymanSentryClient.Validate(True);
+
TKeymanDesktopShell.OpenHelpJump('context_traymenu', Self.ActiveKeyboard);
end;
diff --git a/windows/src/engine/keyman/main.pas b/windows/src/engine/keyman/main.pas
index 03715b1045..18ad8516e8 100644
--- a/windows/src/engine/keyman/main.pas
+++ b/windows/src/engine/keyman/main.pas
@@ -160,6 +160,7 @@ var
sCommand: string;
begin
Result := False;
+
if LowerCase(ParamStr(1)) <> '-kmc' then Exit;
sCommand := LowerCase(ParamStr(2));
@@ -174,6 +175,9 @@ begin
FCommand := KMC_HideVisualKeyboard
else Exit;
+ FEnableCrashTest := ParamStr(3) = '-sentry-client-test-exception';
+
+
Result := True;
end;
diff --git a/windows/src/engine/keyman32/KEYMAN32.DEF b/windows/src/engine/keyman32/KEYMAN32.DEF
index 199297f8e9..4dd5a3ca10 100644
--- a/windows/src/engine/keyman32/KEYMAN32.DEF
+++ b/windows/src/engine/keyman32/KEYMAN32.DEF
@@ -36,3 +36,5 @@ EXPORTS
Keyman_WriteDebugEvent
Keyman_UpdateTouchPanelVisibility
+
+ Keyman_Diagnostic
diff --git a/windows/src/engine/keyman32/k32_dbg.cpp b/windows/src/engine/keyman32/k32_dbg.cpp
index f78eb737fa..d19a6cfbc5 100644
--- a/windows/src/engine/keyman32/k32_dbg.cpp
+++ b/windows/src/engine/keyman32/k32_dbg.cpp
@@ -313,3 +313,9 @@ void _OutputThreadDebugString(char *s) {
OutputDebugString(buf);
}
#endif
+
+void WINAPI Keyman_Diagnostic(int mode) {
+ if (mode == 0) {
+ RaiseException(0xDEADBEEF, EXCEPTION_NONCONTINUABLE, 0, NULL);
+ }
+}
diff --git a/windows/src/engine/kmcomapi/com/system/keymancontrol.pas b/windows/src/engine/kmcomapi/com/system/keymancontrol.pas
index 693ab1922d..cd0e4fa5a8 100644
--- a/windows/src/engine/kmcomapi/com/system/keymancontrol.pas
+++ b/windows/src/engine/kmcomapi/com/system/keymancontrol.pas
@@ -147,6 +147,8 @@ type
procedure EnableUserInterface; safecall;
procedure UpdateTouchPanelVisibility(Value: Boolean); safecall;
+ procedure DiagnosticTestException; safecall;
+
{ IIntKeymanControl }
procedure AutoApplyKeyman;
procedure ApplyKeyman;
@@ -442,6 +444,11 @@ begin
Result := DefWindowProc(RefreshHandle, Msg, WParam, LParam);
end;
+procedure TKeymanControl.DiagnosticTestException;
+begin
+ raise Exception.Create('Testing safecall wrappering of exception for Sentry');
+end;
+
procedure TKeymanControl.DisableUserInterface;
const
KM_DISABLEUI = 1;
diff --git a/windows/src/engine/kmtip/debug.cpp b/windows/src/engine/kmtip/debug.cpp
index 09f0e5d5c6..4ba02ede37 100644
--- a/windows/src/engine/kmtip/debug.cpp
+++ b/windows/src/engine/kmtip/debug.cpp
@@ -115,3 +115,8 @@ void DebugLastError_1(char *file, int line, char *func, PWCHAR msg, DWORD err) {
}
}
+void WINAPI Keyman_Diagnostic(int mode) {
+ if (mode == 0) {
+ RaiseException(0xDEADBEEF, EXCEPTION_NONCONTINUABLE, 0, NULL);
+ }
+}
diff --git a/windows/src/engine/kmtip/kmtip.def b/windows/src/engine/kmtip/kmtip.def
index a7afa17a71..64c10743c2 100644
--- a/windows/src/engine/kmtip/kmtip.def
+++ b/windows/src/engine/kmtip/kmtip.def
@@ -5,4 +5,5 @@ EXPORTS
DllCanUnloadNow PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
- RefreshPreservedKeys
+ RefreshPreservedKeys
+ Keyman_Diagnostic
diff --git a/windows/src/engine/tsysinfo/sysinfo_main.dfm b/windows/src/engine/tsysinfo/sysinfo_main.dfm
index 027801366a..d288adab06 100644
--- a/windows/src/engine/tsysinfo/sysinfo_main.dfm
+++ b/windows/src/engine/tsysinfo/sysinfo_main.dfm
@@ -203,6 +203,7 @@ object frmDiagnostics: TfrmDiagnostics
end
object mnuOptions: TMenuItem
Caption = '&Options'
+ OnClick = mnuOptionsClick
object mnuOptionsAdvancedView: TMenuItem
Caption = '&Advanced View'
OnClick = mnuOptionsAdvancedViewClick
@@ -216,6 +217,13 @@ object frmDiagnostics: TfrmDiagnostics
Caption = 'Reload page'
ShortCut = 16466
end
+ object mnuOptionsDebugTests: TMenuItem
+ Caption = 'Debug Tests'
+ object mnuOptionsSentryExceptionTest: TMenuItem
+ Caption = 'Sentry Exception Test'
+ OnClick = mnuOptionsSentryExceptionTestClick
+ end
+ end
end
object mnuHelp: TMenuItem
Caption = '&Help'
diff --git a/windows/src/engine/tsysinfo/sysinfo_main.pas b/windows/src/engine/tsysinfo/sysinfo_main.pas
index a37dacb92a..bdb16e4dec 100644
--- a/windows/src/engine/tsysinfo/sysinfo_main.pas
+++ b/windows/src/engine/tsysinfo/sysinfo_main.pas
@@ -64,6 +64,8 @@ type
Label3: TLabel;
mnuOptionsXMLView: TMenuItem;
Reloadpage1: TMenuItem;
+ mnuOptionsDebugTests: TMenuItem;
+ mnuOptionsSentryExceptionTest: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure mnuFileOpenClick(Sender: TObject);
@@ -74,6 +76,8 @@ type
procedure mnuOptionsAdvancedViewClick(Sender: TObject);
procedure mnuHelpAboutClick(Sender: TObject);
procedure mnuOptionsXMLViewClick(Sender: TObject);
+ procedure mnuOptionsSentryExceptionTestClick(Sender: TObject);
+ procedure mnuOptionsClick(Sender: TObject);
private
FSIList: TSIList;
FGlobalXMLDocument: IXMLDOMDocument;
@@ -104,12 +108,19 @@ procedure KeymanDiag;
implementation
uses
- // keymanstrings,
- KeymanPaths, ActiveX, ComObj,
- ErrorControlledRegistry, RegistryKeys,
- shlobj,
+ System.Win.ComObj,
+ Winapi.ActiveX,
+ Winapi.shlobj,
+
+ ErrorControlledRegistry,
+ Keyman.System.KeymanSentryClient,
+ KeymanPaths,
+ RegistryKeys,
+ sysinfo_Util,
UframeAttachedFiles,
- VersionInfo, UfrmEmail, sysinfo_Util, utilexecute;
+ UfrmEmail,
+ utilexecute,
+ VersionInfo;
{$R *.dfm}
@@ -125,6 +136,11 @@ begin
Application.Run;
end;
+procedure TfrmDiagnostics.mnuOptionsSentryExceptionTestClick(Sender: TObject);
+begin
+ TKeymanSentryClient.Validate(True);
+end;
+
function TfrmDiagnostics.CollectDiagnostics: string;
begin
FSIList.Collect;
@@ -436,6 +452,11 @@ begin
pages.Visible := mnuOptionsAdvancedView.Checked;
end;
+procedure TfrmDiagnostics.mnuOptionsClick(Sender: TObject);
+begin
+ mnuOptionsDebugTests.Visible := (GetKeyState(VK_CONTROL) < 0) and (GetKeyState(VK_SHIFT) < 0);
+end;
+
procedure TfrmDiagnostics.mnuOptionsXMLViewClick(Sender: TObject); // I3766
var
i: Integer;
diff --git a/windows/src/engine/tsysinfo/tsysinfo.dproj b/windows/src/engine/tsysinfo/tsysinfo.dproj
index c217fda389..98e0737ffb 100644
--- a/windows/src/engine/tsysinfo/tsysinfo.dproj
+++ b/windows/src/engine/tsysinfo/tsysinfo.dproj
@@ -128,7 +128,6 @@
CompanyName=;FileVersion=5.0.0.26;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)
1033
Debug
- -c "C652180A07DD4C0CB7811A63E26BC1F7" "Keyman Developer" "tike-14.0.29-alpha-local" "keyman-developer" "ESentryTest" "Exception ESentryTest in module Tike.exe at 009B18A6. Just testing Sentry."
true
diff --git a/windows/src/engine/tsysinfox64/tsysinfox64.dpr b/windows/src/engine/tsysinfox64/tsysinfox64.dpr
index 1b3ccb5292..59ca997e2d 100644
--- a/windows/src/engine/tsysinfox64/tsysinfox64.dpr
+++ b/windows/src/engine/tsysinfox64/tsysinfox64.dpr
@@ -28,6 +28,7 @@ begin
TKeymanSentryClient.Start(TSentryClient, kscpDesktop, LOGGER_DESKTOP_ENGINE_TSYSINFOX64);
try
try
+ TKeymanSentryClient.Validate;
Run;
except
on E: Exception do
diff --git a/windows/src/global/delphi/general/KeymanEngineControl.pas b/windows/src/global/delphi/general/KeymanEngineControl.pas
index 5ddf601f1a..b6059eed6c 100644
--- a/windows/src/global/delphi/general/KeymanEngineControl.pas
+++ b/windows/src/global/delphi/general/KeymanEngineControl.pas
@@ -32,6 +32,8 @@ type
procedure DisableUserInterface; safecall;
procedure EnableUserInterface; safecall;
procedure UpdateTouchPanelVisibility(Value: Boolean); safecall;
+
+ procedure DiagnosticTestException; safecall;
end;
implementation
diff --git a/windows/src/global/delphi/general/compile.pas b/windows/src/global/delphi/general/compile.pas
index 4c15727f88..6715eef5a4 100644
--- a/windows/src/global/delphi/general/compile.pas
+++ b/windows/src/global/delphi/general/compile.pas
@@ -147,6 +147,7 @@ const
function CompileKeyboardFile(kmnFile, kmxFile: PChar; FSaveDebug, CompilerWarningsAsErrors, WarnDeprecatedCode: BOOL; CallBack: TCompilerCallback): Integer; cdecl; // I4865 // I4866
function CompileKeyboardFileToBuffer(kmnFile: PChar; buf: PFILE_KEYBOARD; CompilerWarningsAsErrors, WarnDeprecatedCode: BOOL; CallBack: TCompilerCallback; Target: Integer): Integer; cdecl; // I4865 // I4866
+procedure Compiler_Diagnostic(mode: Integer);
//
// For unit tests, point to a known-current version of kmcmpdll.dll
@@ -265,6 +266,44 @@ begin
Result := ckf(PAnsiChar(AnsiString(kmnFile)), buf, CompilerWarningsAsErrors, WarnDeprecatedCode, Callback, Target); // I3310 // I4865 // I4866
end;
+type
+ TKeyman_Diagnostic = procedure(mode: Integer); stdcall;
+
+procedure Compiler_Diagnostic(mode: Integer);
+var
+ s: string;
+ keyman_diagnostic: TKeyman_Diagnostic;
+begin
+ // Template copy verbatim from Compile functions; this needs refactoring
+ if HKMCmpDll = 0 then
+ begin
+ s := FUnitTestKMCmpDllPath;
+ if s = '' then
+ begin
+ s := GetDebugKMCmpDllPath;
+ if (s <> '') and not FileExists(s + kmcmpdll_lib) then // I4770
+ s := '';
+ if s = '' then
+ begin
+ try
+ s := GetDeveloperRootPath;
+ except
+ s := '';
+ end;
+ if s = '' then s := ExtractFilePath(ParamStr(0));
+ end;
+ end;
+
+ HKMCmpDll := LoadLibrary(PChar(s+kmcmpdll_lib));
+ if HKMCmpDll = 0 then
+ Exit;
+ end;
+
+ @keyman_diagnostic := GetProcAddress(HKMCmpDll, 'Keyman_Diagnostic');
+ if Assigned(@keyman_diagnostic) then
+ keyman_diagnostic(0);
+end;
+
initialization
finalization
diff --git a/windows/src/global/vc/keymansentry.cpp b/windows/src/global/vc/keymansentry.cpp
index fed621b4d2..628a4b666a 100644
--- a/windows/src/global/vc/keymansentry.cpp
+++ b/windows/src/global/vc/keymansentry.cpp
@@ -223,5 +223,5 @@ int keyman_sentry_wmain(bool is_keyman_developer, const char *logger, int argc,
void keyman_sentry_test_crash() {
fputs("Testing exception reporting:\n", stderr);
- RaiseException(0x00000001, EXCEPTION_NONCONTINUABLE, 0, NULL);
+ RaiseException(0xDEADBEEF, EXCEPTION_NONCONTINUABLE, 0, NULL);
}