Ignore:
Timestamp:
Jul 1, 2014, 4:40:32 PM (11 years ago)
Author:
[email protected]
Message:

Debugger's breakpoint list should not be a Vector.
<https://webkit.org/b/134514>

Reviewed by Geoffrey Garen.

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 its backing store, this can causes all sorts of havoc.
The m_breakpointIDToBreakpoint map assumes that the breakpoint data doesn't
move in memory.

The fix is to replace the BreakpointsInLine Vector with a BreakpointsList
doubly linked list.

  • debugger/Breakpoint.h:

(JSC::Breakpoint::Breakpoint):
(JSC::BreakpointsList::~BreakpointsList):

  • debugger/Debugger.cpp:

(JSC::Debugger::setBreakpoint):
(JSC::Debugger::removeBreakpoint):
(JSC::Debugger::hasBreakpoint):

  • debugger/Debugger.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/debugger/Debugger.h

    r165005 r170677  
    3030#include <wtf/HashSet.h>
    3131#include <wtf/RefPtr.h>
    32 #include <wtf/Vector.h>
    3332#include <wtf/text/TextPosition.h>
    3433
     
    129128    typedef HashMap<BreakpointID, Breakpoint*> BreakpointIDToBreakpointMap;
    130129
    131     typedef Vector<Breakpoint> BreakpointsInLine;
    132     typedef HashMap<unsigned, BreakpointsInLine, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>> LineToBreakpointsMap;
     130    typedef HashMap<unsigned, RefPtr<BreakpointsList>, WTF::IntHash<int>, WTF::UnsignedWithZeroKeyHashTraits<int>> LineToBreakpointsMap;
    133131    typedef HashMap<SourceID, LineToBreakpointsMap, WTF::IntHash<SourceID>, WTF::UnsignedWithZeroKeyHashTraits<SourceID>> SourceIDToBreakpointsMap;
    134132
Note: See TracChangeset for help on using the changeset viewer.