Bug 121214 - Keep sourceID and position info in DebuggerCallFrame instead of the Inspector's JavaScriptCallFrame
Summary: Keep sourceID and position info in DebuggerCallFrame instead of the Inspector...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-11 23:28 PDT by Mark Lam
Modified: 2013-09-12 09:29 PDT (History)
7 users (show)

See Also:


Attachments
the patch. (32.55 KB, patch)
2013-09-11 23:40 PDT, Mark Lam
ggaren: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 2013-09-11 23:28:39 PDT
Currently, our debugger callbacks explicitly passes sourceID and position (line and column) info to the Inspector along with the DebuggerCallFrame.  This info (the DebuggerCallFrame, sourceID, and position) is then stored in the Inspector's JavaScriptCallFrame.  Technically, we can just get this info from the DebuggerCallFrame.  There's no need to explicitly pass the sourceID and position info to the Inspector and have it stored in its JavaScriptCallFrame.

For the current implementation, JSC is not getting line and column info from the stack yet.  Instead the line and column number are explicitly passed in as arguments to the debug hooks.  For now, we'll continue to use the debug hook line and column info.  To do this, we'll store the values in the DebuggerCallFrame.  At a later date, we should have the DebuggerCallFrame get the info directly from the CallFrame based on its bytecodeOffset.

This refactoring is part of the work to move ScriptDebugServer functionality  into JSC.
Comment 1 Mark Lam 2013-09-11 23:40:03 PDT
Created attachment 211403 [details]
the patch.

This patch has run the layout tests with no new failures.
Comment 2 Oliver Hunt 2013-09-12 07:58:37 PDT
Comment on attachment 211403 [details]
the patch.

Can't we simply kill debuggercallframe and rely on the stack walking instead?  The removes (essentially) a duplicate type, and saves computing/storing line and column info unnecessarily.
Comment 3 Mark Lam 2013-09-12 08:15:22 PDT
(In reply to comment #2)
> (From update of attachment 211403 [details])
> Can't we simply kill debuggercallframe and rely on the stack walking instead?  The removes (essentially) a duplicate type, and saves computing/storing line and column info unnecessarily.

One step at a time.  I did this refactor because I found it to help organize the data in a way that allows me to move ScriptDebugServer functionality into JSC.  I'm trying to stay focus on changing the Inspector to debugger interface first.  I'll change the internal implementation of the debugger later after I've changed the interface to allow it.  This is a stepping stone to get there.
Comment 4 Geoffrey Garen 2013-09-12 08:44:21 PDT
> Can't we simply kill debuggercallframe and rely on the stack walking instead?

I think DebuggerCallFrame has one good feature: it distinguishes standard data in CallFrame from data that is only present when a stack frame has been put in debugger mode. For example, I think the debugger should get a "fake" activation, and not the real thing. We could accomplish that through something like CallFrame::debuggerActivation(), and not have two types. But I think it might be valuable to have a separate type for this interface. DebuggerCallFrame implies that everything is in a debuggable state, which will diverge from normal state over time. It also clarifies who relies on debug info.
Comment 5 Geoffrey Garen 2013-09-12 08:45:41 PDT
Comment on attachment 211403 [details]
the patch.

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

r=me

> Source/JavaScriptCore/interpreter/Interpreter.cpp:659
> +        DebuggerCallFrame debuggerCallFrame(callFrame, line, 0, exceptionValue);

Why not provide a real column number here?
Comment 6 Mark Lam 2013-09-12 08:50:30 PDT
(In reply to comment #5)
> (From update of attachment 211403 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=211403&action=review
> 
> r=me
> 
> > Source/JavaScriptCore/interpreter/Interpreter.cpp:659
> > +        DebuggerCallFrame debuggerCallFrame(callFrame, line, 0, exceptionValue);
> 
> Why not provide a real column number here?

I was just keeping parity with the pre-existing code, but it should be easy to provide a real column number there.  I'll change it and run it thru the layout tests again.
Comment 7 Mark Lam 2013-09-12 09:29:35 PDT
Thanks for the review.  Added the change to use the real column number in Interpreter::unwind().  Passes layout tests with no new failures.

Landed in r155622: <http://trac.webkit.org/r155622>.