-
Notifications
You must be signed in to change notification settings - Fork 340
Conversation
CI: https://ci.nodejs.org/job/chakracore-test-pull-request/33/ - PASSED Edit: With the way we currently handle node tests in node-chakracore, the test passes will always end with "UNSTABLE" status. For the purposes of CI we consider that to be a passing run. |
Resolves #228 |
src/node.cc
Outdated
// Start debug agent when argv has --debug | ||
if (debug_enabled) | ||
if (debug_options.debugger_enabled() || debug_options.inspector_enabled()) |
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.
debug_options.debugger_enabled() [](start = 6, length = 32)
This is no longer present in upstream. See if you can get rid of 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.
Did we take that change yet or is the hope that I just eliminate it now in preparation for that change?
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 am planning to do it in a day or 2. So yeah, consider it as prep work.
In reply to: 116625440 [](ancestors = 116625440)
@@ -28,7 +31,9 @@ bool V8InspectorSession::canDispatchMethod(const StringView& method) { | |||
stringViewStartsWith(method, | |||
protocol::Console::Metainfo::commandPrefix) || | |||
stringViewStartsWith(method, | |||
protocol::Schema::Metainfo::commandPrefix); | |||
protocol::Schema::Metainfo::commandPrefix) || | |||
stringViewStartsWith(method, |
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.
stringViewStartsWith [](start = 9, length = 20)
not too familiar with this code, but does this have to be inside TTT if-condition?
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 thought about it and decided not to mess with the dispatcher dynamically. The TTD dispatcher will be wired up, but any attempts to use it will return an error.
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.
Since we already have code under ENABLE_TTD_NODE might be good to have all this under same
In reply to: 116629150 [](ancestors = 116629150)
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.
There are currently no usages of ENABLE_TTD_NODE anywhere in chakrashim. I even see one instance where it's present, but commented out, so I suspect it's not possible.
m_timeTravelAgent = wrapUnique(new V8TimeTravelAgentImpl( | ||
this, this, agentState(protocol::TimeTravel::Metainfo::domainName))); | ||
protocol::TimeTravel::Dispatcher::wire(&m_dispatcher, | ||
m_timeTravelAgent.get()); |
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.
same here. Should they be only if TTT is enabled?
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 thought about it and decided not to mess with the dispatcher dynamically. The TTD dispatcher will be wired up, but any attempts to use it will return an error.
m_debugger->reverse(); | ||
} | ||
|
||
void V8DebuggerAgentImpl::stepBack(ErrorString* errorString) { |
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.
stepBack [](start = 26, length = 8)
should we add unit test or open an issue to add later?
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.
It's already the list in #227.
@agarwal-sandeep Can you take a look when you have a few minutes? |
@@ -91,7 +91,7 @@ class V8_EXPORT Debug { | |||
static Local<Context> GetDebugContext(Isolate* isolate); | |||
|
|||
static void EnableDebug(); | |||
static void EnableInspector(); | |||
static void EnableInspector(bool enableReplayDebug = false); |
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.
EnableInspector [](start = 14, length = 15)
This function is not in deps/v8/include/v8-debug.h generally we keep V8 header same between v8 and chakrashim. Is this specific to chakrashim?
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.
As far as I could see there was no EnableDebug
function defined either, so I didn't worry about it. The calls to both functions were gated behind CHAKRACORE conditions.
https://github.com/nodejs/node-chakracore/search?utf8=%E2%9C%93&q=enabledebug&type=
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.
Seems to remember that it was present when I implemented debugger support. If not I am fine with adding new function.
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 was present, it no longer is. Looking at the usage, I suspect we added it as a workaround.
EDIT: Seems like it was added in 99d6392 as part of the debugger enablement work.
@@ -171,7 +175,14 @@ class V8DebuggerAgentImpl : public protocol::Debugger::Backend { | |||
using DebugServerBreakpointToBreakpointIdAndSourceMap = | |||
protocol::HashMap<String16, std::pair<String16, BreakpointSource>>; | |||
|
|||
enum DebuggerStep { NoStep = 0, StepInto, StepOver, StepOut }; | |||
enum DebuggerStep { |
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.
DebuggerStep [](start = 7, length = 12)
Good to keep this in same order as JsDiagStepType
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.
The streams don't ever cross currently, but I've updated it.
#include "src/inspector/v8-inspector-session-impl.h" | ||
#include "src/inspector/v8-debugger-agent-impl.h" | ||
|
||
#include "src/jsrtinspector.h" |
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.
nit: remove extra empty lines
|
||
bool V8TimeTravelAgentImpl::checkEnabled(ErrorString* errorString) { | ||
if (enabled()) { | ||
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.
return true; [](start = 4, length = 12)
Initialize errorString to nullptr for this case? Same for reverse and stepBack functions
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.
The pattern elsewhere is to only touch the variable in cases where there's an error. This was consistent with the state of the V8 code at the time it was forked.
Beside some general changes the code looks good to me. Please incorporate feedback and merge if CI is clean. |
90d839e
to
828656c
Compare
If the debugger attempts to set a breakpoint that gets resolved to an existing breakpoint, then when we go to clear the same breakpoint will be removed twice. On the second removal the API returns JsErrorInvalidArgument which is a no-op for this function. PR-URL: nodejs#244 Reviewed-By: Kunal Pathak <Kunal.Pathak@microsoft.com> Reviewed-By: Sandeep Agarwal <saagarwa@microsoft.com>
* Added the TimeTravel domain and wired it up * Debuggers can now detect time travel mode by looking at the available domains. PR-URL: nodejs#244 Reviewed-By: Kunal Pathak <Kunal.Pathak@microsoft.com> Reviewed-By: Sandeep Agarwal <saagarwa@microsoft.com>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
chakrashim, inspector