Fix system test break#333
Conversation
| public id: string, public active: boolean, | ||
| public apiBreakpoint: apiTypes.Breakpoint, | ||
| public parsedCondition: estree.Node, | ||
| public parsedCondition: estree.Node, public locationStr: 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/inspectordebugapi.ts
Outdated
| scriptmapper: {[id: string]: any} = {}; | ||
|
|
||
| listeners: {[id: string]: utils.Listener} = {}; | ||
| scriptmapper: {[id: string]: 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/inspectordebugapi.ts
Outdated
| const listener = | ||
| this.onBreakpointHit.bind(this, breakpoint, (err: Error) => { | ||
| this.listeners[bp.id].enabled = false; | ||
| this.listeners[breakpoint.id as string].enabled = false; |
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
| return result.error ? | ||
| result.error : | ||
| (result.object as inspector.Runtime.RemoteObject).value(); | ||
| if (result.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/v8inspector.ts
Outdated
| includeCommandLineAPI?: boolean, silent?: boolean, | ||
| returnByValue?: boolean, generatePreview?: boolean, | ||
| throwOnSideEffect?: boolean) { | ||
| callFrameId: string, expression: string, returnByValue?: boolean, |
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.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/agent/inspectordebugapi.ts
Outdated
| const bpId = breakpointData.id; | ||
|
|
||
| // delete breakpoint from locationmapper and breakpointmapper. | ||
| this.deleteBreakpointInArray( |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
kjin
left a comment
There was a problem hiding this comment.
My concern with landing this as-is is the combination of (1) extensive overloading of the term "breakpoint", which can mean either "v8/inspector breakpoint" or "stackdriver breakpoint", and (2) the potential difficulty in maintaining this code due to its complexity.
Given the existence of now five members (breakpoints, listeners, scriptmapper, locationmapper, breakpointmapper) of InspectorDebugApi that map various types of information from different origins to one another, as well as a BreakpointData class that holds additional associations, I think it would be worthwhile to consider writing a data structure that can encapsulate this complexity in a simpler and more easily reasoned-through format.
In particular, I think the the information held in breakpoints, listeners, locationmapper, and breakpointmapper can be put together in a more cohesive way, since they are all mappings indexed on some breakpoint property.
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
|
I signed it! |
|
CLAs look good, thanks! |
|
Hmm.. what happened with the CLA here? Do you somehow have a commit with a different address set in your git config? |
|
I have not modified my git config. I added my corp email address to CLA list and it worked. I have no ideas why googlebot checked cla:no only this time. |
src/agent/inspectordebugapi.ts
Outdated
| // undefined. | ||
| listeners: {[id: string]: utils.Listener} = {}; | ||
| // scriptmapper maps scriptId to actual script path. | ||
| scriptmapper: {[id: string]: 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/inspectordebugapi.ts
Outdated
| return Object.keys(this.listeners).length; | ||
| } | ||
|
|
||
| private deleteBreakpointInArray(breakpointArray: string[], bp: 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/inspectordebugapi.ts
Outdated
| {v8BreakpointId: inspector.Debugger.BreakpointId, | ||
| locationStr: string}|null { | ||
| let condition; | ||
| if (breakpoint.condition) condition = breakpoint.condition; |
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
| if (!this.locationmapper[locationStr]) { | ||
| // The first time when a breakpoint was set to this location. | ||
| let res = this.v8Inspector.setBreakpointByUrl( | ||
| line - 1, matchingScript, undefined, column - 1, condition); |
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
| // location Str will be a JSON string of Stackdriver breakpoint location. | ||
| // It will be used as key at locationmapper to ensure there will be no | ||
| // duplicate breakpoints at the same location. | ||
| let locationStr = JSON.stringify(breakpoint.location); |
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
| this.locationmapper[locationStr].push(breakpoint.id as string); | ||
| this.breakpointmapper[v8BreakpointId].push(breakpoint.id as string); | ||
|
|
||
| return {v8BreakpointId: v8BreakpointId, locationStr: locationStr}; |
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.
| callFrames: inspector.Debugger.CallFrame[]): void { | ||
| // TODO: Address the situation where `breakpoint.id` is `null`. | ||
| const bp = this.breakpoints[breakpoint.id as string]; | ||
| if (!bp.active) { |
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.
| const frame = callFrames[0]; | ||
| const evaluatedExpressions = breakpoint.expressions.map(function(exp) { | ||
| const result = state.evaluate(exp, frame, that.v8Inspector); | ||
| const result = state.evaluate(exp, frame, that.v8Inspector, true); |
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/v8inspector.ts
Outdated
| includeCommandLineAPI?: boolean, silent?: boolean, | ||
| returnByValue?: boolean, generatePreview?: boolean, | ||
| throwOnSideEffect?: boolean) { | ||
| callFrameId: string, expression: string, returnByValue?: boolean, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/types/api-types.ts
Outdated
| // TODO: The `controller.ts` file assumes `id` is not null or undefined. | ||
| // Verify it it should be optional. | ||
| id?: string; | ||
| id?: BreakpointId; |
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/utils.ts
Outdated
| } | ||
| } | ||
|
|
||
| export function removeElementInArray(array: string[], element: string) { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| @@ -33,9 +33,9 @@ import {V8Inspector} from './v8inspector'; | |||
|
|
|||
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
src/agent/v8debugapi.ts
Outdated
| @@ -187,7 +187,7 @@ export class V8DebugApi implements debugapi.DebugApi { | |||
| shouldStop: () => boolean): void { | |||
| const that = this; | |||
| // TODO: Address the case whree `breakpoint.id` is `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/v8debugapi.ts
Outdated
| @@ -338,7 +338,7 @@ export class V8DebugApi implements debugapi.DebugApi { | |||
| this.v8.setListener(this.handleDebugEvents); | |||
| } | |||
| // TODO: Address the case whree `breakpoint.id` is `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.
| execState: v8Types.ExecutionState): void { | ||
| // TODO: Address the situation where `breakpoint.id` is `null`. | ||
| const v8bp = this.breakpoints[breakpoint.id as string].v8Breakpoint; | ||
| const v8bp = this.breakpoints[breakpoint.id].v8Breakpoint; |
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/v8debugapi.ts
Outdated
| @@ -422,15 +422,14 @@ export class V8DebugApi implements debugapi.DebugApi { | |||
| execState: v8Types.ExecutionState): void { | |||
| const expressionErrors: Array<apiTypes.Variable|null> = []; | |||
| // TODO: Address the case where `breakpoint.id` is `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.
Fixed the e2e test when logpoint and breakpoint was set in one place.