@@ -228,8 +228,9 @@ class Debugger extends Domain {
228
228
int line, {
229
229
int column,
230
230
}) async {
231
+ column ?? = 0 ;
231
232
checkIsolate ('addBreakpoint' , isolateId);
232
- final breakpoint = await _breakpoints.add (scriptId, line);
233
+ final breakpoint = await _breakpoints.add (scriptId, line, column );
233
234
_notifyBreakpoint (breakpoint);
234
235
return breakpoint;
235
236
}
@@ -249,7 +250,9 @@ class Debugger extends Domain {
249
250
for (var breakpoint in previousBreakpoints) {
250
251
var scriptRef = await _updatedScriptRefFor (breakpoint);
251
252
var updatedLocation = await _locations.locationForDart (
252
- DartUri (scriptRef.uri, _root), _lineNumberFor (breakpoint));
253
+ DartUri (scriptRef.uri, _root),
254
+ _lineNumberFor (breakpoint),
255
+ _columnNumberFor (breakpoint));
253
256
var updatedBreakpoint = _breakpoints._dartBreakpoint (
254
257
scriptRef, updatedLocation, breakpoint.id);
255
258
_breakpoints._note (
@@ -263,7 +266,8 @@ class Debugger extends Domain {
263
266
await addBreakpoint (
264
267
inspector.isolate.id,
265
268
(await _updatedScriptRefFor (breakpoint)).id,
266
- _lineNumberFor (breakpoint));
269
+ _lineNumberFor (breakpoint),
270
+ column: _columnNumberFor (breakpoint));
267
271
}
268
272
}
269
273
@@ -324,10 +328,11 @@ class Debugger extends Domain {
324
328
var frame = e.params['callFrames' ][0 ];
325
329
var location = frame['location' ];
326
330
var scriptId = location['scriptId' ] as String ;
327
- var lineNumber = location['lineNumber' ] as int ;
331
+ var line = location['lineNumber' ] as int ;
332
+ var column = location['columnNumber' ] as int ;
328
333
329
334
var url = _urlForScriptId (scriptId);
330
- return _locations.locationForJs (url, lineNumber + 1 );
335
+ return _locations.locationForJs (url, line + 1 , column + 1 );
331
336
}
332
337
333
338
/// The variables visible in a frame in Dart protocol [BoundVariable] form.
@@ -723,14 +728,23 @@ bool isNativeJsObject(InstanceRef instanceRef) {
723
728
724
729
/// Returns the Dart line number for the provided breakpoint.
725
730
int _lineNumberFor (Breakpoint breakpoint) =>
726
- int .parse (breakpoint.id.split ('#' ).last);
731
+ int .parse (breakpoint.id.split ('#' ).last.split (':' ).first);
732
+
733
+ /// Returns the Dart line number for the provided breakpoint.
734
+ int _columnNumberFor (Breakpoint breakpoint) =>
735
+ int .parse (breakpoint.id.split ('#' ).last.split (':' ).last);
727
736
728
737
/// Returns the breakpoint ID for the provided Dart script ID and Dart line
729
738
/// number.
730
- String breakpointIdFor (String scriptId, int line) => 'bp/$scriptId #$line ' ;
739
+ String breakpointIdFor (String scriptId, int line, int column) {
740
+ var id = 'bp/$scriptId #$line :$column ' ;
741
+ print ('breakpointIdFor: $scriptId , $line , $column : $id ' );
742
+ return id;
743
+ }
731
744
732
745
/// Keeps track of the Dart and JS breakpoint Ids that correspond.
733
746
class _Breakpoints extends Domain {
747
+ final _logger = Logger ('_Breakpoints' );
734
748
final _dartIdByJsId = < String , String > {};
735
749
final _jsIdByDartId = < String , String > {};
736
750
@@ -752,11 +766,12 @@ class _Breakpoints extends Domain {
752
766
}) : super (provider);
753
767
754
768
Future <Breakpoint > _createBreakpoint (
755
- String id, String scriptId, int line) async {
769
+ String id, String scriptId, int line, int column ) async {
756
770
var dartScript = inspector.scriptWithId (scriptId);
757
771
var dartUri = DartUri (dartScript.uri, root);
758
- var location = await locations.locationForDart (dartUri, line);
759
-
772
+ var location = await locations.locationForDart (dartUri, line, column);
773
+ _logger.warning (
774
+ '_createBreakpoint: uri: $dartUri , line: $line , column :$column , location: $location ' );
760
775
// TODO: Handle cases where a breakpoint can't be set exactly at that line.
761
776
if (location == null ) {
762
777
throw RPCError (
@@ -779,10 +794,10 @@ class _Breakpoints extends Domain {
779
794
780
795
/// Adds a breakpoint at [scriptId] and [line] or returns an existing one if
781
796
/// present.
782
- Future <Breakpoint > add (String scriptId, int line) async {
783
- final id = breakpointIdFor (scriptId, line);
797
+ Future <Breakpoint > add (String scriptId, int line, int column ) async {
798
+ final id = breakpointIdFor (scriptId, line, column );
784
799
return _bpByDartId.putIfAbsent (
785
- id, () => _createBreakpoint (id, scriptId, line));
800
+ id, () => _createBreakpoint (id, scriptId, line, column ));
786
801
}
787
802
788
803
/// Create a Dart breakpoint at [location] in [dartScript] with [id] .
@@ -812,6 +827,7 @@ class _Breakpoints extends Domain {
812
827
.sendCommand ('Debugger.setBreakpointByUrl' , params: {
813
828
'urlRegex' : urlRegex,
814
829
'lineNumber' : location.jsLocation.line - 1 ,
830
+ 'columnNumber' : location.jsLocation.column - 1 ,
815
831
});
816
832
return response.result['breakpointId' ] as String ;
817
833
});
0 commit comments