Bug 134514

Summary: Debugger's breakpoint list should not be a Vector
Product: WebKit Reporter: Mark Lam <mark.lam>
Component: JavaScriptCoreAssignee: Mark Lam <mark.lam>
Status: RESOLVED FIXED    
Severity: Normal CC: bunhere, cdumez, commit-queue, fpizlo, ggaren, gyuyoung.kim, mhahnenberg, mmirman, msaboff, oliver, sergio
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
the patch
ggaren: review+
updated patch to make the EWS bots happy + Geoff's suggested fix. none

Description Mark Lam 2014-07-01 14:50:25 PDT
The debugger currently stores breakpoint data as entries in a Vector (see BreakpointsInLine).  It also keeps a fast map look up of breakpoint IDs to the breakpoint data (see m_breakpointIDToBreakpoint).  Because a Vector can compact or reallocate it backing store, this can causes all sorts of havoc.  The m_breakpointIDToBreakpoint assumes that the breakpoint data doesn't move in memory.

The fix is to replace the BreakpointsInLine Vector with a BreakpointsList doubly linked list.
Comment 1 Mark Lam 2014-07-01 14:51:00 PDT
<rdar://problem/17487061>
Comment 2 Mark Lam 2014-07-01 15:38:59 PDT
Created attachment 234208 [details]
the patch
Comment 3 Geoffrey Garen 2014-07-01 15:46:04 PDT
Comment on attachment 234208 [details]
the patch

View in context: https://bugs.webkit.org/attachment.cgi?id=234208&action=review

r=me

> Source/JavaScriptCore/debugger/Breakpoint.h:56
> +    Breakpoint(Breakpoint& other)

Should be const&.
Comment 4 Mark Lam 2014-07-01 15:49:40 PDT
The compiler was complaining about:
Source/JavaScriptCore/debugger/Breakpoint.h:88:27: error: using the result of an assignment as a condition without parentheses [-Werror,-Wparentheses]
        while (breakpoint = removeHead())
               ~~~~~~~~~~~^~~~~~~~~~~~~~

Will add the parens.
Comment 5 Mark Lam 2014-07-01 15:51:28 PDT
Created attachment 234209 [details]
updated patch to make the EWS bots happy + Geoff's suggested fix.
Comment 6 Mark Lam 2014-07-01 16:43:12 PDT
Thanks.  Patch with fixes land in r170677: <http://trac.webkit.org/r170677>.