[Lldb-commits] [PATCH] D128410: [lldb] Add a testcase for nested exceptions on Windows
Martin Storsjö via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Jun 23 01:48:54 PDT 2022
mstorsjo created this revision.
mstorsjo added reviewers: labath, alvinhochun, DavidSpickett.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a project: LLDB.
This adds a testcase for
4d123783957e547009e55346bf3a8ae43a88fa14 <https://reviews.llvm.org/rG4d123783957e547009e55346bf3a8ae43a88fa14> / D128201 <https://reviews.llvm.org/D128201>. Before that commit,
lldb would crash here, while now lldb manages to stop after the
exception.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D128410
Files:
lldb/test/Shell/Process/Windows/wndproc_exception.cpp
Index: lldb/test/Shell/Process/Windows/wndproc_exception.cpp
===================================================================
--- /dev/null
+++ lldb/test/Shell/Process/Windows/wndproc_exception.cpp
@@ -0,0 +1,54 @@
+// clang-format off
+
+// Check that lldb doesn't crash when there's a nested exception.
+
+// REQUIRES: system-windows
+// RUN: %clangxx_host -o %t.exe -luser32 -v -- %s
+// RUN: %lldb -f %t.exe -o "run"
+
+#include <windows.h>
+
+static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,
+ LPARAM lParam) {
+ switch (uMsg) {
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ return 0;
+
+ case WM_PAINT:
+ *(volatile int *)nullptr = 1;
+ return 0;
+ }
+ return DefWindowProcA(hwnd, uMsg, wParam, lParam);
+}
+
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR pCmdLine,
+ int nCmdShow) {
+ const char CLASS_NAME[] = "Crash Window Class";
+
+ WNDCLASSA wc = {};
+
+ wc.lpfnWndProc = WindowProc;
+ wc.hInstance = hInstance;
+ wc.lpszClassName = CLASS_NAME;
+
+ RegisterClassA(&wc);
+
+ HWND hwnd = CreateWindowExA(0, CLASS_NAME, "Crash", WS_OVERLAPPEDWINDOW,
+ CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+ CW_USEDEFAULT,
+ NULL, NULL, hInstance, NULL);
+
+ if (hwnd == NULL)
+ return 0;
+
+ ShowWindow(hwnd, nCmdShow);
+
+ MSG msg = {};
+ while (GetMessageA(&msg, NULL, 0, 0) > 0) {
+ TranslateMessage(&msg);
+ DispatchMessageA(&msg);
+ }
+
+ return 0;
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128410.439278.patch
Type: text/x-patch
Size: 1584 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220623/1c801a1d/attachment.bin>
More information about the lldb-commits
mailing list