From f07ff1f2465ba7290e8c4c968e33d2c26eceea8a Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Wed, 20 Sep 2023 22:55:59 +0800 Subject: [PATCH] finish IronPad debugging --- IronPad/IronPad.cpp | 28 +++++++++++++--------------- Unvirt/UnvirtContext.cpp | 2 -- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/IronPad/IronPad.cpp b/IronPad/IronPad.cpp index f9e02d5..e34c80c 100644 --- a/IronPad/IronPad.cpp +++ b/IronPad/IronPad.cpp @@ -177,22 +177,20 @@ namespace IronPad { } static void UExceptionCoreDump(LPCWSTR filename, LPEXCEPTION_POINTERS info) { - // setup handle - HANDLE hProcess = GetCurrentProcess(); - DWORD dwProcessId = GetCurrentProcessId(); - DWORD dwThreadId = GetCurrentThreadId(); - // open file and write - if (hProcess != INVALID_HANDLE_VALUE) { - HANDLE hFile = CreateFileW(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if (hFile != INVALID_HANDLE_VALUE) { - MINIDUMP_EXCEPTION_INFORMATION exception_info; - exception_info.ThreadId = dwThreadId; - exception_info.ExceptionPointers = info; - exception_info.ClientPointers = TRUE; - MiniDumpWriteDump(hProcess, dwProcessId, hFile, MiniDumpWithFullMemory, &exception_info, NULL, NULL); - CloseHandle(hFile); - } + HANDLE hFile = CreateFileW(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (hFile != INVALID_HANDLE_VALUE) { + MINIDUMP_EXCEPTION_INFORMATION exception_info; + exception_info.ThreadId = GetCurrentThreadId(); + exception_info.ExceptionPointers = info; + exception_info.ClientPointers = TRUE; + MiniDumpWriteDump( + GetCurrentProcess(), GetCurrentProcessId(), hFile, + MiniDumpWithFullMemory, + &exception_info, + NULL, NULL + ); + CloseHandle(hFile); } } diff --git a/Unvirt/UnvirtContext.cpp b/Unvirt/UnvirtContext.cpp index 2233a11..5248c45 100644 --- a/Unvirt/UnvirtContext.cpp +++ b/Unvirt/UnvirtContext.cpp @@ -442,8 +442,6 @@ namespace Unvirt::Context { void Unvirt::Context::UnvirtContext::ProcTest(const CmdHelper::ArgumentsMap* amap) { #if defined(LIBCMO_BUILD_DEBUG) // MARK: Add the debug code here. - char p = 0; - char a = 1 / p; #else PrintCommonError("Test command only available in Debug mode.");