Skip to content
Permalink
Browse files
Use ::MessageBox instead of ::DebugBreak to make the web process wait…
… for a debugger

While ::DebugBreak can make it easier to attach a debugger (because it
brings up the Just-in-Time debugger window), using ::MessageBox has
two advantages:
  1) It explains to the user what's going on, so it's harder to
     mistake this debugging aid for a bug.
  2) It allows you to debug the UI process and the web process using
     the same debugger, if desired.

Special thanks to John Sullivan for help with the text that's shown in
the alert.

Fixes <http://webkit.org/b/42848> WebKit2's wait-for-debugger
debugging aid should explain to the user what's happening

Reviewed by John Sullivan and Anders Carlsson.

* WebProcess/WebKitMain.cpp:
(WebKitMain): Use a ::MessageBox instead of a ::DebugBreak to wait for
the debugger. The alert explains to the user what's going on.

Canonical link: https://commits.webkit.org/54750@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@63913 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
aroben committed Jul 22, 2010
1 parent 9c7d7ab commit 0112632654556636220e9afa836edf08ea427c2a
Showing with 34 additions and 3 deletions.
  1. +25 −0 WebKit2/ChangeLog
  2. +9 −3 WebKit2/WebProcess/WebKitMain.cpp
@@ -1,3 +1,28 @@
2010-07-22 Adam Roben <aroben@apple.com>

Use ::MessageBox instead of ::DebugBreak to make the web process wait
for a debugger

While ::DebugBreak can make it easier to attach a debugger (because it
brings up the Just-in-Time debugger window), using ::MessageBox has
two advantages:
1) It explains to the user what's going on, so it's harder to
mistake this debugging aid for a bug.
2) It allows you to debug the UI process and the web process using
the same debugger, if desired.

Special thanks to John Sullivan for help with the text that's shown in
the alert.

Fixes <http://webkit.org/b/42848> WebKit2's wait-for-debugger
debugging aid should explain to the user what's happening

Reviewed by John Sullivan and Anders Carlsson.

* WebProcess/WebKitMain.cpp:
(WebKitMain): Use a ::MessageBox instead of a ::DebugBreak to wait for
the debugger. The alert explains to the user what's going on.

2010-07-22 Adam Roben <aroben@apple.com>

Make WorkQueue aware of potential errors with ::WaitForMultipleObjects
@@ -55,6 +55,12 @@ int WebKitMain(int argc, char** argv)

#elif PLATFORM(WIN)

#ifndef DEBUG_ALL
#define PROCESS_NAME L"WebKit2WebKitProcess.exe"
#else
#define PROCESS_NAME L"WebKit2WebProcess_debug.exe"
#endif

static void enableTerminationOnHeapCorruption()
{
// Enable termination on heap corruption on OSes that support it (Vista and XPSP3).
@@ -78,11 +84,11 @@ extern "C" __declspec(dllexport)
int WebKitMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpstrCmdLine, int nCmdShow)
{
#ifndef NDEBUG
// Break into the debugger when Ctrl-Alt-Shift is held down during launch. This makes it easier
// to debug problems that happen early in the web process's liftime.
// Show an alert when Ctrl-Alt-Shift is held down during launch to give the user time to attach a
// debugger. This is useful for debugging problems that happen early in the web process's lifetime.
const unsigned short highBitMaskShort = 0x8000;
if ((::GetKeyState(VK_CONTROL) & highBitMaskShort) && (::GetKeyState(VK_MENU) & highBitMaskShort) && (::GetKeyState(VK_SHIFT) & highBitMaskShort))
::DebugBreak();
::MessageBoxW(0, L"You can now attach a debugger to " PROCESS_NAME L". You can use\nthe same debugger for WebKit2WebProcessand the UI process, if desired.\nClick OK when you are ready for WebKit2WebProcess to continue.", L"WebKit2WebProcess has launched", MB_OK | MB_ICONINFORMATION);
#endif

enableTerminationOnHeapCorruption();

0 comments on commit 0112632

Please sign in to comment.