Bug 42670

Summary: Would like a way to break into the debugger when the web process launches
Product: WebKit Reporter: Adam Roben (:aroben) <aroben>
Component: New BugsAssignee: Adam Roben (:aroben) <aroben>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: OS X 10.5   
Attachments:
Description Flags
Patch andersca: review+

Description Adam Roben (:aroben) 2010-07-20 14:34:18 PDT
Would like a way to break into the debugger when the web process launches
Comment 1 Adam Roben (:aroben) 2010-07-20 14:35:55 PDT
Created attachment 62112 [details]
Patch
Comment 2 Anders Carlsson 2010-07-20 14:37:23 PDT
Comment on attachment 62112 [details]
Patch

>  extern "C" __declspec(dllexport) 
>  int WebKitMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpstrCmdLine, int nCmdShow)
>  {

Please add a comment here indicating the key combination and what this does.
Can ::GetKeyState change between calls? If so, should you keep it in a variable?

> +#ifndef NDEBUG
> +    const unsigned short highBitMaskShort = 0x8000;
> +    if ((::GetKeyState(VK_CONTROL) & highBitMaskShort) && (::GetKeyState(VK_MENU) & highBitMaskShort) && (::GetKeyState(VK_SHIFT) & highBitMaskShort))
> +        DebugBreak();

This should be ::DebugBreak().
Comment 3 Adam Roben (:aroben) 2010-07-20 14:40:00 PDT
(In reply to comment #2)
> (From update of attachment 62112 [details])
> >  extern "C" __declspec(dllexport) 
> >  int WebKitMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpstrCmdLine, int nCmdShow)
> >  {
> 
> Please add a comment here indicating the key combination and what this does.

Added:

    // 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.

> Can ::GetKeyState change between calls? If so, should you keep it in a variable?

Not without returning to the message loop. GetKeyState returns the state of the keys when the last input message was generated. (We can't keep it in a variable anyway, since you have to pass the key you care about to the function.)

> > +#ifndef NDEBUG
> > +    const unsigned short highBitMaskShort = 0x8000;
> > +    if ((::GetKeyState(VK_CONTROL) & highBitMaskShort) && (::GetKeyState(VK_MENU) & highBitMaskShort) && (::GetKeyState(VK_SHIFT) & highBitMaskShort))
> > +        DebugBreak();
> 
> This should be ::DebugBreak().

::OK. *grumble*

Thanks for reviewing!
Comment 4 Adam Roben (:aroben) 2010-07-20 15:01:38 PDT
Committed r63777: <http://trac.webkit.org/changeset/63777>