-
Notifications
You must be signed in to change notification settings - Fork 51
Implement v8 Inspector Protocol #329
Implement v8 Inspector Protocol #329
Conversation
9bfcad7
to
42b6cfa
Compare
src/agent/debugapi.ts
Outdated
@@ -59,10 +60,13 @@ export function create( | |||
if (singleton && !config_.forceNewAgent_) { | |||
return singleton; | |||
} | |||
let debugapi: any; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
aac5727
to
cba34e1
Compare
cba34e1
to
52c7446
Compare
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 have a few comments - feel free to ping me on anything I need to elaborate on.
src/agent/debugapi.ts
Outdated
sourcemapper_: SourceMapper): DebugApi; | ||
} | ||
let debugApiConstructor: DebugApiConstructor; | ||
let nodeVersion = /v(\d+\.\d+\.\d+)/.exec(process.version); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/agent/debugapi.ts
Outdated
let nodeVersion = /v(\d+\.\d+\.\d+)/.exec(process.version); | ||
if (!nodeVersion || nodeVersion.length < 2) { | ||
console.error('can\'t get the node version.'); | ||
process.exit(1); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/agent/debugapi.ts
Outdated
let debugapi: any; | ||
debugapi = new debugApiConstructor(logger_, config_, jsFiles_, sourcemapper_); | ||
|
||
singleton = { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/agent/debugapi.ts
Outdated
singleton.disconnect(); | ||
} | ||
|
||
let debugapi: any; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/agent/debugapi.ts
Outdated
let singleton: DebugApi; | ||
|
||
export function create( | ||
logger_: Logger, config_: DebugAgentConfig, jsFiles_: ScanStats, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
* | ||
* @return an object with error and mirror fields. | ||
*/ | ||
export function evaluate( |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/agent/state-inspector.ts
Outdated
// Evaluate the watch expressions | ||
const evalIndexSet = new Set(); | ||
if (this.expressions_) { | ||
this.expressions_.forEach(async (expression, index2) => { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/agent/state-inspector.ts
Outdated
} | ||
|
||
resolveFullPath_(frame: inspector.Debugger.CallFrame): string { | ||
let scriptId: string = frame.location.scriptId; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/agent/state-inspector.ts
Outdated
varTableIndex: ARG_LOCAL_LIMIT_MESSAGE_INDEX | ||
}); | ||
} else { | ||
args = []; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/agent/state-inspector.ts
Outdated
* name. | ||
* @function resolveLocalsList_ | ||
* @memberof StateResolver | ||
* @param {FrameMirror} frame - A instance of FrameMirror |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Also, could you give this PR (and future PRs) a more descriptive title than its branch 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.
Looks good for the most part. I left a few more comments... should be good to go once you've addressed these.
public id: string, public active: boolean, | ||
public apiBreakpoint: apiTypes.Breakpoint, | ||
public parsedCondition: estree.Node, | ||
public compile: null|((src: string) => string)) {} |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/agent/debugapi.ts
Outdated
const nodeVersion = /v(\d+\.\d+\.\d+)/.exec(process.version); | ||
|
||
if (!nodeVersion || nodeVersion.length < 2) { | ||
console.error( |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/agent/inspectordebugapi.ts
Outdated
try { | ||
this.handleDebugPausedEvent(message.params); | ||
} catch (error) { | ||
console.error(error); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/agent/inspectordebugapi.ts
Outdated
} | ||
} | ||
|
||
handleDebugPausedEvent(params: inspector.Debugger.PausedEventDataType) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/agent/debugapi.ts
Outdated
|
||
export function create( | ||
logger: Logger, config: DebugAgentConfig, jsFiles: ScanStats, | ||
sourcemapper: SourceMapper): DebugApi|null { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/agent/inspectordebugapi.ts
Outdated
utils.messages.V8_BREAKPOINT_CLEAR_ERROR); | ||
} | ||
const id = breakpoint.id; | ||
let result = this.v8Inspector.removeBreakpoint(breakpointData.id); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/agent/inspectordebugapi.ts
Outdated
breakpoint.logMessageFormat as string, | ||
// TODO: Determine how to remove the `as` cast below | ||
breakpoint.evaluatedExpressions.map( | ||
JSON.stringify as (ob: any) => string)); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/agent/state-inspector.ts
Outdated
scriptmapper: {[id: string]: any}, v8Inspector: V8Inspector) { | ||
this.callFrames_ = callFrames; | ||
this.breakpoint_ = breakpoint; | ||
this.expressions_ = breakpoint.expressions as string[]; |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/agent/state-inspector.ts
Outdated
assert(!this.resolvedVariableTable_[index]); // shouldn't have it | ||
// resolved yet | ||
const isEvaluated = evalIndexSet.has(index); | ||
if (this.rawVariableTable_[index].objectId) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/agent/state-inspector.ts
Outdated
for (let i = 0; i < count; ++i) { | ||
let result = this.v8Inspector_.getProperties( | ||
frame.scopeChain[i].object.objectId as string); | ||
if (result.response && !isEmpty(result.response.result)) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
LGTM
No description provided.