-
Notifications
You must be signed in to change notification settings - Fork 1.2k
xplat: Debugger Support #2056
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xplat: Debugger Support #2056
Conversation
|
/cc @agarwal-sandeep |
| function Script1Func3() { scriptFunc3(); } \ | ||
| function setFunc2(func) { scriptFunc2 = func; } \ | ||
| function setFunc3(func) { scriptFunc3 = func; }", | ||
| "samethread", "Script1.js"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Script1.js" [](start = 16, length = 12)
Why remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When file name is given, LoadScript is trying to find the full path on xplat and that fails
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then we should fix WScriptJsrt::LoadScript?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessarily. The comment there says; // No fileName provided (WScript.LoadScript()), use dummy "script.js" IMHO the intention there is clean. This particular script file doesn't do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In debugging it makes a difference as when giving the source we will give Unknown script, you can try that by using debugger annotation dumpSourceList().
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sense however, for this particular test, it doesn't make any difference. Opening a GH issue to track this instead.
| #if defined(ENABLE_SCRIPT_PROFILING) | ||
| if (attach) | ||
| { | ||
| this->RegisterDebugThunk(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RegisterDebugThunk [](start = 18, length = 18)
We use ProfileThunk under debugger and its set in this function, if we are not calling this where are we setting the thunk?
test/Debugger/rlexe.xml
Outdated
| <default> | ||
| <compile-flags>-debuglaunch -dbgbaseline:JsDiagGetFunctionPosition.js.dbg.baseline</compile-flags> | ||
| <files>JsDiagGetFunctionPosition.js</files> | ||
| <!-- xplat-todo: enable back [not supported] --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not supported [](start = 36, length = 13)
Why? JsDiagGetFunctionPosition doesn't seems to have any xplat specific code? and it is used in node-chakracore debugging which seems to be working fine on xplat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? JsDiagGetFunctionPosition doesn't seems to have any xplat specific code? and it is used in node-chakracore debugging which seems to be working fine on xplat.
@agarwal-sandeep Intl is not enabled on xplat.
9341ff8 to
06a2fbc
Compare
|
@agarwal-sandeep ping |
| #define DefaultDeferredParsingThunk Js::JavascriptFunction::DeferredParsingThunk | ||
| #ifdef ENABLE_SCRIPT_PROFILING | ||
| #if defined(ENABLE_SCRIPT_PROFILING) || defined(ENABLE_SCRIPT_DEBUGGING) | ||
| #define ProfileDeferredParsingThunk Js::ScriptContext::ProfileModeDeferredParsingThunk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we use ProfileDeferredParsingThunk in debugging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, the method itself doesn't receive any call but I've fixed it's impl. for xplat instead of adding even more ifdef checks etc.
| #endif | ||
| { | ||
| return true; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whole if should be under #ifdef _WN32, we don't want to retrun true without setting sourceName. and in JsRT there is no sourceName support.
| __finally | ||
| #endif | ||
| { | ||
| threadContext->GetDebugManager()->GetDebuggingFlags()->SetIsBuiltInWrapperPresent(isOrigWrapperPresent); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
threadContext->GetDebugManager()->GetDebuggingFlags()->SetIsBuiltInWrapperPresent(isOrigWrapperPresent); [](start = 24, length = 104)
How will this work with DISABLE_SEH?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agarwal-sandeep We don't have SEH on xplat. Can you please explain more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean if we don't have try finally and CallFunction throws how will we make sure SetIsBuiltInWrapperPresent is restored?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it throws something that requires SEH in place, we can't restore on xplat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change these __try/__finally to use TryFinally function https://github.com/Microsoft/ChakraCore/blob/master/lib/Common/CommonPal.h#L603.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jianchun That PAL interface is subject to be removal. No libunwind / seh etc..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@obastemur The TryFinally function I mentioned has nothing to do with libunwind / seh, and why "subject to removal"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@obastemur This was the TryFinally comment not addressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind; I was referring to something totally unrelated and this one is update to one we have in CommonPAL
|
Have we run crawler and exprgen with this change? We should do private testing before checking in this change. |
@agarwal-sandeep I tried not to change anything for non xplat. Could you please point out the places might affect Windows? |
|
I understand the sentiment that we haven't touched the code for windows but testing a change before it goes in doesn't harm. plus we have a single click test system at http://onecirro/ where you just provide a private and it does the rest. |
| import os | ||
|
|
||
| def print_usage(): | ||
| print "usage: jstoc.py <js file path> <variable name>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usage: jstoc.py [](start = 11, length = 15)
Output some more help message about what this script does?
lib/Common/CommonDefines.h
Outdated
| #ifdef _WIN32 | ||
| // dep: TIME_ZONE_INFORMATION, DaylightTimeHelper, Windows.Globalization | ||
| #define ENABLE_GLOBALIZATION | ||
| // dep: IDebugDocumentContext |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this comment together with ENABLE_SCRIPT_DEBUGGING?
3cc4f2d to
0744052
Compare
|
Also tested with full project. Test/Debug .. |
|
ping |
5ac66cf to
c933dc4
Compare
|
@agarwal-sandeep I got the Crawler result and looks like that one is also good. |
| JavascriptMethod origEntryPoint = function->GetFunctionInfo()->GetOriginalEntryPoint(); | ||
|
|
||
| __try | ||
| __TRY_FINALLY_BEGIN // SEH is not guaranteed, see the implementation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add the test case for returnValue to DebuggerCommon
function foo1() {
return 1;
}
function foo2() {
return 2;
}
function foo() {
var x = 1; /bp:resume('step_over');resume('step_over');locals()/
return foo1() + foo2();
}
foo();
WScript.Attach(foo);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agarwal-sandeep thanks for the test case, added under the DebuggerCommon. Testing on CI now, lets see how Windows testing is going to react to my baseline file line-endings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agarwal-sandeep checked other tests we have and saw returnedvaluetests1 is actually doing the same. No reason to introduce this extra test ?
356fa3e to
0113657
Compare
| JavascriptMethod origEntryPoint = function->GetFunctionInfo()->GetOriginalEntryPoint(); | ||
|
|
||
| __try | ||
| __TRY_FINALLY_BEGIN // SEH is not guaranteed, see the implementation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__TRY_FINALLY_BEGIN // SEH is not guaranteed, see the implementation [](start = 8, length = 68)
I wonder if I misunderstand something. Does this code need sth. special from SEH? Why do you mention SEH and try to keep __try/__finally on Windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jianchun I also didn't observe any SEH specific code after reading to code again.
2 things I've been trying to to with this PR; 1) do not update any Windows specific code unless it is a bug etc. 2) generally update TRY/FINALLY code to macro.
The second one was out of the scope and we hadn't reach to a consensus there. Updating this implementation very close to original while adding a notice. In case, in the future, if someone expects this part of the code handling SEH, the comment above should be enough to keep the intentions away. In the meantime, adding a macro for future use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, no more issues from me. I haven't reviewed other part, assuming @agarwal-sandeep did.
d2e0406 to
e321447
Compare
In addition to Debugger support, this PR also brings the required base for compiling code with script profiler.
|
@obastemur @jianchun I have reviewed debugger specific changes and they look good to me |
|
@agarwal-sandeep @jianchun @ThomsonTan Thanks for the reviews. @Oceanswave Thanks for opening the issue and follow ups! |
|
@obastemur thank you for the hard work and sticking through. Greatly appreciate the effort. |
In addition to Debugger support, this PR also brings the required base for compiling code with script profiler.
Fixes #2058