Bug 42670 - Would like a way to break into the debugger when the web process launches
Summary: Would like a way to break into the debugger when the web process launches
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Adam Roben (:aroben)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-20 14:34 PDT by Adam Roben (:aroben)
Modified: 2010-07-20 15:01 PDT (History)
0 users

See Also:


Attachments
Patch (1.65 KB, patch)
2010-07-20 14:35 PDT, Adam Roben (:aroben)
andersca: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>