-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
write a minidump if ziti-edge-tunnel crashes on windows (#1084)
* write a minidump if ziti-edge-tunnel crashes on windows * windows only, just use MAX_PATH which is what we define PATH_MAX to when needed
- Loading branch information
1 parent
44f6c0d
commit 5ef54ac
Showing
5 changed files
with
74 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
Copyright NetFoundry Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
https://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
#include <windows.h> | ||
#include <dbghelp.h> | ||
#include <stdio.h> | ||
|
||
extern char* get_log_path(); | ||
LONG WINAPI CrashFilter(EXCEPTION_POINTERS *pExceptionInfo) { | ||
char* mini_dump_path = calloc(MAX_PATH, sizeof(char)); | ||
snprintf(mini_dump_path, MAX_PATH, "%s%cziti-edge-tunnel.crash.dmp", get_log_path(), PATH_SEP); | ||
|
||
printf("minidump created at: %s", mini_dump_path); | ||
HANDLE hFile = CreateFile(mini_dump_path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); | ||
if (hFile && hFile != INVALID_HANDLE_VALUE) { | ||
MINIDUMP_EXCEPTION_INFORMATION mei = { | ||
GetCurrentThreadId(), | ||
pExceptionInfo, | ||
TRUE | ||
}; | ||
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpWithThreadInfo, &mei, NULL, NULL); | ||
CloseHandle(hFile); | ||
} | ||
free(mini_dump_path); | ||
mini_dump_path = NULL; | ||
return EXCEPTION_EXECUTE_HANDLER; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
Copyright NetFoundry Inc. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
https://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
#ifndef ZITI_TUNNEL_SDK_C_MINIDUMP_H | ||
#define ZITI_TUNNEL_SDK_C_MINIDUMP_H | ||
|
||
#include <windows.h> | ||
LONG WINAPI CrashFilter(EXCEPTION_POINTERS *exceptionPointers); | ||
|
||
#endif //ZITI_TUNNEL_SDK_C_MINIDUMP_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters