Skip to content
Permalink
Browse files
2011-01-24 Pavel Podivilov <podivilov@chromium.org>
        Reviewed by Yury Semikhatsky.

        Web Inspector: set breakpoints by line:column.
        https://bugs.webkit.org/show_bug.cgi?id=52615

        * CMakeLists.txt:
        * GNUmakefile.am:
        * WebCore.gypi:
        * WebCore.pro:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/ScriptDebugServer.cpp:
        (WebCore::ScriptDebugServer::setBreakpoint):
        (WebCore::ScriptDebugServer::removeBreakpoint):
        (WebCore::ScriptDebugServer::hasBreakpoint):
        (WebCore::ScriptDebugServer::clearBreakpoints):
        * bindings/js/ScriptDebugServer.h:
        * bindings/v8/DebuggerScript.js:
        ():
        * bindings/v8/ScriptDebugServer.cpp:
        (WebCore::ScriptDebugServer::setBreakpoint):
        * bindings/v8/ScriptDebugServer.h:
        * inspector/Inspector.idl:
        * inspector/InspectorBrowserDebuggerAgent.cpp:
        (WebCore::InspectorBrowserDebuggerAgent::restoreStickyBreakpoint):
        * inspector/InspectorDebuggerAgent.cpp:
        (WebCore::InspectorDebuggerAgent::setStickyBreakpoint):
        (WebCore::InspectorDebuggerAgent::setBreakpoint):
        (WebCore::InspectorDebuggerAgent::restoreBreakpoint):
        (WebCore::InspectorDebuggerAgent::didParseSource):
        * inspector/InspectorDebuggerAgent.h:
        * inspector/ScriptBreakpoint.cpp: Removed.
        * inspector/ScriptBreakpoint.h:
        (WebCore::ScriptBreakpoint::ScriptBreakpoint):
        * inspector/front-end/Breakpoint.js:
        (WebInspector.Breakpoint):
        (WebInspector.Breakpoint.prototype.get url):
        * inspector/front-end/BreakpointManager.js:
        (WebInspector.JavaScriptBreakpoint.prototype._serializeToJSON):
        * inspector/front-end/DebuggerModel.js:
        (WebInspector.DebuggerModel.prototype.continueToLine):
        (WebInspector.DebuggerModel.prototype.setBreakpoint):
        (WebInspector.DebuggerModel.prototype._breakpointSetOnBackend):
        (WebInspector.DebuggerDispatcher.prototype.breakpointResolved):

Canonical link: https://commits.webkit.org/66742@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@76509 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Pavel Podivilov committed Jan 24, 2011
1 parent 5ed8793 commit df43cfc06885ba00e23534b654f1872901f8021f
Showing 21 changed files with 175 additions and 171 deletions.
@@ -1179,7 +1179,6 @@ SET(WebCore_SOURCES
inspector/InspectorTimelineAgent.cpp
inspector/InspectorValues.cpp
inspector/ScriptArguments.cpp
inspector/ScriptBreakpoint.cpp
inspector/ScriptCallFrame.cpp
inspector/ScriptCallStack.cpp
inspector/TimelineRecordFactory.cpp
@@ -1,3 +1,50 @@
2011-01-24 Pavel Podivilov <podivilov@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: set breakpoints by line:column.
https://bugs.webkit.org/show_bug.cgi?id=52615

* CMakeLists.txt:
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/ScriptDebugServer.cpp:
(WebCore::ScriptDebugServer::setBreakpoint):
(WebCore::ScriptDebugServer::removeBreakpoint):
(WebCore::ScriptDebugServer::hasBreakpoint):
(WebCore::ScriptDebugServer::clearBreakpoints):
* bindings/js/ScriptDebugServer.h:
* bindings/v8/DebuggerScript.js:
():
* bindings/v8/ScriptDebugServer.cpp:
(WebCore::ScriptDebugServer::setBreakpoint):
* bindings/v8/ScriptDebugServer.h:
* inspector/Inspector.idl:
* inspector/InspectorBrowserDebuggerAgent.cpp:
(WebCore::InspectorBrowserDebuggerAgent::restoreStickyBreakpoint):
* inspector/InspectorDebuggerAgent.cpp:
(WebCore::InspectorDebuggerAgent::setStickyBreakpoint):
(WebCore::InspectorDebuggerAgent::setBreakpoint):
(WebCore::InspectorDebuggerAgent::restoreBreakpoint):
(WebCore::InspectorDebuggerAgent::didParseSource):
* inspector/InspectorDebuggerAgent.h:
* inspector/ScriptBreakpoint.cpp: Removed.
* inspector/ScriptBreakpoint.h:
(WebCore::ScriptBreakpoint::ScriptBreakpoint):
* inspector/front-end/Breakpoint.js:
(WebInspector.Breakpoint):
(WebInspector.Breakpoint.prototype.get url):
* inspector/front-end/BreakpointManager.js:
(WebInspector.JavaScriptBreakpoint.prototype._serializeToJSON):
* inspector/front-end/DebuggerModel.js:
(WebInspector.DebuggerModel.prototype.continueToLine):
(WebInspector.DebuggerModel.prototype.setBreakpoint):
(WebInspector.DebuggerModel.prototype._breakpointSetOnBackend):
(WebInspector.DebuggerDispatcher.prototype.breakpointResolved):

2011-01-24 Peter Beverloo <peter@chromium.org>

Reviewed by Pavel Feldman.
@@ -2007,7 +2007,6 @@ webcore_sources += \
Source/WebCore/inspector/InspectorWorkerResource.h \
Source/WebCore/inspector/ScriptArguments.cpp \
Source/WebCore/inspector/ScriptArguments.h \
Source/WebCore/inspector/ScriptBreakpoint.cpp \
Source/WebCore/inspector/ScriptBreakpoint.h \
Source/WebCore/inspector/ScriptCallFrame.cpp \
Source/WebCore/inspector/ScriptCallFrame.h \
@@ -2058,7 +2058,6 @@
'inspector/InspectorValues.cpp',
'inspector/InspectorValues.h',
'inspector/InspectorWorkerResource.h',
'inspector/ScriptBreakpoint.cpp',
'inspector/ScriptBreakpoint.h',
'inspector/ScriptArguments.cpp',
'inspector/ScriptArguments.h',
@@ -1068,7 +1068,6 @@ SOURCES += \
inspector/InspectorTimelineAgent.cpp \
inspector/InspectorValues.cpp \
inspector/ScriptArguments.cpp \
inspector/ScriptBreakpoint.cpp \
inspector/ScriptCallFrame.cpp \
inspector/ScriptCallStack.cpp \
inspector/TimelineRecordFactory.cpp \
@@ -65297,10 +65297,6 @@
RelativePath="..\inspector\ScriptArguments.h"
>
</File>
<File
RelativePath="..\inspector\ScriptBreakpoint.cpp"
>
</File>
<File
RelativePath="..\inspector\ScriptBreakpoint.h"
>
@@ -647,7 +647,6 @@
1CF6BE140E9BB4670025E1CD /* ObjCNodeFilterCondition.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1CF6BE120E9BB4670025E1CD /* ObjCNodeFilterCondition.mm */; };
1CF6BE150E9BB4670025E1CD /* ObjCNodeFilterCondition.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CF6BE130E9BB4670025E1CD /* ObjCNodeFilterCondition.h */; };
1CFAE3230A6D6A3F0032593D /* libobjc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1CFAE3220A6D6A3F0032593D /* libobjc.dylib */; };
200B190911C277D900DCCD3A /* ScriptBreakpoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 200B190811C277D900DCCD3A /* ScriptBreakpoint.cpp */; };
20D629261253690B00081543 /* InspectorInstrumentation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 20D629241253690B00081543 /* InspectorInstrumentation.cpp */; };
20D629271253690B00081543 /* InspectorInstrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = 20D629251253690B00081543 /* InspectorInstrumentation.h */; };
228C284510D82500009D0D0E /* ScriptWrappable.h in Headers */ = {isa = PBXBuildFile; fileRef = 228C284410D82500009D0D0E /* ScriptWrappable.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -6990,7 +6989,6 @@
1CF6BE120E9BB4670025E1CD /* ObjCNodeFilterCondition.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ObjCNodeFilterCondition.mm; sourceTree = "<group>"; };
1CF6BE130E9BB4670025E1CD /* ObjCNodeFilterCondition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjCNodeFilterCondition.h; sourceTree = "<group>"; };
1CFAE3220A6D6A3F0032593D /* libobjc.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libobjc.dylib; path = /usr/lib/libobjc.dylib; sourceTree = "<absolute>"; };
200B190811C277D900DCCD3A /* ScriptBreakpoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptBreakpoint.cpp; sourceTree = "<group>"; };
20D629241253690B00081543 /* InspectorInstrumentation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorInstrumentation.cpp; sourceTree = "<group>"; };
20D629251253690B00081543 /* InspectorInstrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorInstrumentation.h; sourceTree = "<group>"; };
228C284410D82500009D0D0E /* ScriptWrappable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptWrappable.h; sourceTree = "<group>"; };
@@ -13035,7 +13033,6 @@
BCC64F5F0DCFB84E0081EF3B /* localizedStrings.js */,
F39BE95912673BF400E0A674 /* ScriptArguments.cpp */,
F39BE95A12673BF400E0A674 /* ScriptArguments.h */,
200B190811C277D900DCCD3A /* ScriptBreakpoint.cpp */,
7AFD4A8A1131C2760035B883 /* ScriptBreakpoint.h */,
416E75CA0EDF90C700360E1D /* ScriptCallFrame.cpp */,
416E75C90EDF90C700360E1D /* ScriptCallFrame.h */,
@@ -24616,7 +24613,6 @@
BCEC01BD0C274DAC009F4EC9 /* Screen.cpp in Sources */,
A84D82C211D3474800972990 /* ScriptableDocumentParser.cpp in Sources */,
F39BE95B12673BF400E0A674 /* ScriptArguments.cpp in Sources */,
200B190911C277D900DCCD3A /* ScriptBreakpoint.cpp in Sources */,
41F1D2200EF35C2A00DA8753 /* ScriptCachedFrameData.cpp in Sources */,
416E75CC0EDF90C700360E1D /* ScriptCallFrame.cpp in Sources */,
416E75BF0EDF8FD700360E1D /* ScriptCallStack.cpp in Sources */,
@@ -138,19 +138,21 @@ bool ScriptDebugServer::hasListenersInterestedInPage(Page* page)
return m_pageListenersMap.contains(page);
}

String ScriptDebugServer::setBreakpoint(const String& sourceID, unsigned lineNumber, const String& condition, bool enabled, unsigned* actualLineNumber)
String ScriptDebugServer::setBreakpoint(const String& sourceID, const ScriptBreakpoint& scriptBreakpoint, long* actualLineNumber, long* actualColumnNumber)
{
intptr_t sourceIDValue = sourceID.toIntPtr();
if (!sourceIDValue)
return "";
BreakpointsMap::iterator it = m_breakpoints.find(sourceIDValue);
if (it == m_breakpoints.end())
it = m_breakpoints.set(sourceIDValue, SourceBreakpoints()).first;
if (it->second.contains(lineNumber))
SourceIdToBreakpointsMap::iterator it = m_sourceIdToBreakpoints.find(sourceIDValue);
if (it == m_sourceIdToBreakpoints.end())
it = m_sourceIdToBreakpoints.set(sourceIDValue, LineToBreakpointMap()).first;
if (it->second.contains(scriptBreakpoint.lineNumber))
return "";
it->second.set(lineNumber, ScriptBreakpoint(enabled, condition));
*actualLineNumber = lineNumber;
return makeString(sourceID, ":", String::number(lineNumber));
it->second.set(scriptBreakpoint.lineNumber, scriptBreakpoint);
*actualLineNumber = scriptBreakpoint.lineNumber;
// FIXME(WK53003): implement setting breakpoints by line:column.
*actualColumnNumber = 1;
return makeString(sourceID, ":", String::number(scriptBreakpoint.lineNumber));
}

void ScriptDebugServer::removeBreakpoint(const String& breakpointId)
@@ -166,8 +168,8 @@ void ScriptDebugServer::removeBreakpoint(const String& breakpointId)
unsigned lineNumber = tokens[1].toUInt(&success);
if (!success)
return;
BreakpointsMap::iterator it = m_breakpoints.find(sourceIDValue);
if (it != m_breakpoints.end())
SourceIdToBreakpointsMap::iterator it = m_sourceIdToBreakpoints.find(sourceIDValue);
if (it != m_sourceIdToBreakpoints.end())
it->second.remove(lineNumber);
}

@@ -176,10 +178,10 @@ bool ScriptDebugServer::hasBreakpoint(intptr_t sourceID, unsigned lineNumber) co
if (!m_breakpointsActivated)
return false;

BreakpointsMap::const_iterator it = m_breakpoints.find(sourceID);
if (it == m_breakpoints.end())
SourceIdToBreakpointsMap::const_iterator it = m_sourceIdToBreakpoints.find(sourceID);
if (it == m_sourceIdToBreakpoints.end())
return false;
SourceBreakpoints::const_iterator breakIt = it->second.find(lineNumber);
LineToBreakpointMap::const_iterator breakIt = it->second.find(lineNumber);
if (breakIt == it->second.end() || !breakIt->second.enabled)
return false;

@@ -198,7 +200,7 @@ bool ScriptDebugServer::hasBreakpoint(intptr_t sourceID, unsigned lineNumber) co

void ScriptDebugServer::clearBreakpoints()
{
m_breakpoints.clear();
m_sourceIdToBreakpoints.clear();
}

void ScriptDebugServer::setBreakpointsActivated(bool activated)
@@ -64,7 +64,7 @@ class ScriptDebugServer : JSC::Debugger {
void addListener(ScriptDebugListener*, Page*);
void removeListener(ScriptDebugListener*, Page*);

String setBreakpoint(const String& sourceID, unsigned lineNumber, const String& condition, bool enabled, unsigned* actualLineNumber);
String setBreakpoint(const String& sourceID, const ScriptBreakpoint&, long* actualLineNumber, long* actualColumnNumber);
void removeBreakpoint(const String& breakpointId);
void clearBreakpoints();
void setBreakpointsActivated(bool activated);
@@ -138,7 +138,8 @@ class ScriptDebugServer : JSC::Debugger {
void didRemoveListener(Page*);

typedef HashMap<Page*, ListenerSet*> PageListenersMap;
typedef HashMap<intptr_t, SourceBreakpoints> BreakpointsMap;
typedef HashMap<long, ScriptBreakpoint> LineToBreakpointMap;
typedef HashMap<intptr_t, LineToBreakpointMap> SourceIdToBreakpointsMap;

PageListenersMap m_pageListenersMap;
bool m_callingListeners;
@@ -150,7 +151,7 @@ class ScriptDebugServer : JSC::Debugger {
bool m_breakpointsActivated;
JavaScriptCallFrame* m_pauseOnCallFrame;
RefPtr<JavaScriptCallFrame> m_currentCallFrame;
BreakpointsMap m_breakpoints;
SourceIdToBreakpointsMap m_sourceIdToScriptBreakpoints;
Timer<ScriptDebugServer> m_recompileTimer;
};

@@ -91,15 +91,17 @@ DebuggerScript._formatScript = function(script)

DebuggerScript.setBreakpoint = function(execState, args)
{
args.lineNumber = DebuggerScript._webkitToV8LineNumber(args.lineNumber);
var breakId = Debug.setScriptBreakPointById(args.scriptId, args.lineNumber, 0 /* column */, args.condition);
var lineNumber = DebuggerScript._webkitToV8LineNumber(args.lineNumber);
var columnNumber = DebuggerScript._webkitToV8LineNumber(args.columnNumber);
var breakId = Debug.setScriptBreakPointById(args.scriptId, lineNumber, columnNumber, args.condition);
if (!args.enabled)
Debug.disableScriptBreakPoint(breakId);

var locations = Debug.findBreakPointActualLocations(breakId);
if (!locations.length)
return undefined;
args.lineNumber = DebuggerScript._v8ToWebkitLineNumber(locations[0].line);
args.columnNumber = DebuggerScript._v8ToWebkitLineNumber(locations[0].column);
return breakId.toString();
}

@@ -143,23 +143,25 @@ void ScriptDebugServer::removeListener(ScriptDebugListener* listener, Page* page
// FIXME: Remove all breakpoints set by the agent.
}

String ScriptDebugServer::setBreakpoint(const String& sourceID, unsigned lineNumber, const String& condition, bool enabled, unsigned* actualLineNumber)
String ScriptDebugServer::setBreakpoint(const String& sourceID, const ScriptBreakpoint& scriptBreakpoint, long* actualLineNumber, long* actualColumnNumber)
{
v8::HandleScope scope;
v8::Local<v8::Context> debuggerContext = v8::Debug::GetDebugContext();
v8::Context::Scope contextScope(debuggerContext);

v8::Local<v8::Object> args = v8::Object::New();
args->Set(v8::String::New("scriptId"), v8String(sourceID));
args->Set(v8::String::New("lineNumber"), v8::Integer::New(lineNumber));
args->Set(v8::String::New("condition"), v8String(condition));
args->Set(v8::String::New("enabled"), v8::Boolean::New(enabled));
args->Set(v8::String::New("lineNumber"), v8::Integer::New(scriptBreakpoint.lineNumber));
args->Set(v8::String::New("columnNumber"), v8::Integer::New(scriptBreakpoint.columnNumber));
args->Set(v8::String::New("condition"), v8String(scriptBreakpoint.condition));
args->Set(v8::String::New("enabled"), v8::Boolean::New(scriptBreakpoint.enabled));

v8::Handle<v8::Function> setBreakpointFunction = v8::Local<v8::Function>::Cast(m_debuggerScript.get()->Get(v8::String::New("setBreakpoint")));
v8::Handle<v8::Value> breakpointId = v8::Debug::Call(setBreakpointFunction, args);
if (!breakpointId->IsString())
return "";
*actualLineNumber = args->Get(v8::String::New("lineNumber"))->Int32Value();
*actualColumnNumber = args->Get(v8::String::New("columnNumber"))->Int32Value();
return v8StringToWebCoreString(breakpointId->ToString());
}

@@ -56,7 +56,7 @@ class ScriptDebugServer {
void addListener(ScriptDebugListener*, Page*);
void removeListener(ScriptDebugListener*, Page*);

String setBreakpoint(const String& sourceID, unsigned lineNumber, const String& condition, bool enabled, unsigned* actualLineNumber);
String setBreakpoint(const String& sourceID, const ScriptBreakpoint&, long* actualLineNumber, long* actualColumnNumber);
void removeBreakpoint(const String& breakpointId);
void clearBreakpoints();
void setBreakpointsActivated(bool activated);
@@ -253,7 +253,7 @@ module core {
[domain=Debugger] void activateBreakpoints();
[domain=Debugger] void deactivateBreakpoints();

[domain=Debugger] void setBreakpoint(in String sourceID, in unsigned int lineNumber, in String condition, in boolean enabled, out String breakpointId, out unsigned int actualLineNumber);
[domain=Debugger] void setBreakpoint(in Object breakpoint, out String breakpointId, out long actualLineNumber, out long actualColumnNumber);
[domain=Debugger] void removeBreakpoint(in String breakpointId);

[domain=BrowserDebugger] void setDOMBreakpoint(in long nodeId, in long type);
@@ -279,7 +279,7 @@ module core {
[domain=Debugger] void evaluateOnCallFrame(in Object callFrameId, in String expression, in String objectGroup, out Value result);
[domain=Debugger] void getCompletionsOnCallFrame(in Object callFrameId, in String expression, in boolean includeInspectorCommandLineAPI, out Value result);

[notify, domain=Debugger] void breakpointResolved(out String breakpointId, out String sourceID, out unsigned int lineNumber, out String condition, out boolean enabled, out unsigned int originalLineNumber);
[notify, domain=Debugger] void breakpointResolved(out String breakpointId, out Object breakpoint);

#if defined(ENABLE_WORKERS) && ENABLE_WORKERS
[notify, domain=Debugger] void didCreateWorker(out long id, out String url, out boolean isShared);
@@ -119,10 +119,13 @@ void InspectorBrowserDebuggerAgent::restoreStickyBreakpoint(PassRefPtr<Inspector
double lineNumber;
if (!condition->getNumber("lineNumber", &lineNumber))
return;
double columnNumber;
if (!condition->getNumber("columnNumber", &columnNumber))
return;
String javaScriptCondition;
if (!condition->getString("condition", &javaScriptCondition))
return;
m_inspectorAgent->debuggerAgent()->setStickyBreakpoint(url, static_cast<unsigned>(lineNumber), javaScriptCondition, enabled);
m_inspectorAgent->debuggerAgent()->setStickyBreakpoint(url, ScriptBreakpoint(long(lineNumber), long(columnNumber), javaScriptCondition, enabled));
} else if (type == xhrBreakpointType) {
if (!enabled)
return;

0 comments on commit df43cfc

Please sign in to comment.