Skip to content
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

Crash if setting a breakpoint to the break statement of a for loop #1617

Closed
kinex opened this issue Apr 13, 2019 · 4 comments
Closed

Crash if setting a breakpoint to the break statement of a for loop #1617

kinex opened this issue Apr 13, 2019 · 4 comments

Comments

@kinex
Copy link

kinex commented Apr 13, 2019

Following code will cause a crash if you set a breakpoint in the break statement and start debugging (ignore what the code is doing, it is just a simplified sample code to reproduce the crash):

Future<void> test() async {
  for (int i = 0; i < 2; i++) {
    if (i > 0) {
      break;
    }
    await Future.delayed(Duration(seconds: 1));
  }
}

Few observations:

  • both the break and the await statements are required for the crash to occur
  • there is no crash if the breakpoint is removed
  • it won't crash if you replace the break statement with a continue statement

Crash log (there is some unrelated stuff in the log because I tested this inside my actual app):

E/DartVM  (27964): -------------------------
E/DartVM  (27964): Encountered context mismatch
E/DartVM  (27964): 	ctx_slot: 0
E/DartVM  (27964): 	frame_ctx_level: 1
E/DartVM  (27964): 	var_ctx_level: 0
E/DartVM  (27964):
E/DartVM  (27964): -------------------------
E/DartVM  (27964): Current frame:
E/DartVM  (27964): [ Frame pc(0x7428a4c6b8) fp(0x743cf3c3f8) sp(0x743cf3c388)
E/DartVM  (27964): 	function = HomePageState.:async_op
E/DartVM  (27964): 	url = package:myapp/views/home/home_page.dart
E/DartVM  (27964): 	line = 312
E/DartVM  (27964): 	context = Context num_variables: 9
E/DartVM  (27964): 	context level = 1 ]
E/DartVM  (27964):
E/DartVM  (27964): -------------------------
E/DartVM  (27964): Context contents:
E/DartVM  (27964):
I/chatty  (27964): uid=10571(u0_a571) Thread-6 identical 6 lines
E/DartVM  (27964):
E/DartVM  (27964): Context@0x73f940ac19 vars(9) {
E/DartVM  (27964):
I/chatty  (27964): uid=10571(u0_a571) Thread-6 identical 8 lines
E/DartVM  (27964):
E/DartVM  (27964): [0] = Instance of '_AsyncAwaitCompleter<void>'
E/DartVM  (27964):
I/chatty  (27964): uid=10571(u0_a571) Thread-6 identical 8 lines
E/DartVM  (27964):
E/DartVM  (27964): [1] = null
E/DartVM  (27964):
I/chatty  (27964): uid=10571(u0_a571) Thread-6 identical 8 lines
E/DartVM  (27964):
E/DartVM  (27964): [2] = [first 50 chars:] <asynchronous suspension>
E/DartVM  (27964): #0      HomePageState._h...
E/DartVM  (27964):
I/chatty  (27964): uid=10571(u0_a571) Thread-6 identical 8 lines
E/DartVM  (27964):
E/DartVM  (27964): [3] = Closure: (dynamic) => dynamic
E/DartVM  (27964):
I/chatty  (27964): uid=10571(u0_a571) Thread-6 identical 8 lines
E/DartVM  (27964):
E/DartVM  (27964): [4] = Closure: (dynamic, dynamic) => dynamic
E/DartVM  (27964):
I/chatty  (27964): uid=10571(u0_a571) Thread-6 identical 8 lines
E/DartVM  (27964):
E/DartVM  (27964): [5] = 1
E/DartVM  (27964):
I/chatty  (27964): uid=10571(u0_a571) Thread-6 identical 8 lines
E/DartVM  (27964):
E/DartVM  (27964): [6] = [first 50 chars:] Context num_variables: 1 parent:{ Context num_vari...
E/DartVM  (27964):
I/chatty  (27964): uid=10571(u0_a571) Thread-6 identical 8 lines
E/DartVM  (27964):
E/DartVM  (27964): [7] = Context num_variables: 9
E/DartVM  (27964):
I/chatty  (27964): uid=10571(u0_a571) Thread-6 identical 8 lines
E/DartVM  (27964):
E/DartVM  (27964): [8] = Closure: ([dynamic, dynamic, dynamic]) => dynamic
E/DartVM  (27964):
I/chatty  (27964): uid=10571(u0_a571) Thread-6 identical 6 lines
E/DartVM  (27964):
E/DartVM  (27964): }
E/DartVM  (27964): -------------------------
E/DartVM  (27964): Debugger stack trace...
E/DartVM  (27964):
E/DartVM  (27964): #0000 [ Frame pc(0x7428a4c6b8) fp(0x743cf3c3f8) sp(0x743cf3c388)
E/DartVM  (27964): 	function = HomePageState.:async_op
E/DartVM  (27964): 	url = package:myapp/views/home/home_page.dart
E/DartVM  (27964): 	line = 312
E/DartVM  (27964): 	context = Context: null
E/DartVM  (27964): 	context level = 1 ]
E/DartVM  (27964): #0001 [ Frame pc(0x743b3e85a4) fp(0x743cf3c498) sp(0x743cf3c450)
E/DartVM  (27964): 	function = <anonymous closure>
E/DartVM  (27964): 	url = dart:async/runtime/libasync_patch.dart
E/DartVM  (27964): 	line = 77
E/DartVM  (27964): 	context = Context: null
E/DartVM  (27964): 	context level = 0 ]
E/DartVM  (27964): #0002 [ Frame pc(0x743b3de654) fp(0x743cf3c518) sp(0x743cf3c4a8)
E/DartVM  (27964): 	function = _rootRunUnary@7048458
E/DartVM  (27964): 	url = dart:async/zone.dart
E/DartVM  (27964): 	line = 1132
E/DartVM  (27964): 	context = Context: null
E/DartVM  (27964): 	context level = -1 ]
E/DartVM  (27964): #0003 [ Frame pc(0x743b3dd9b0) fp(0x743cf3c628) sp(0x743cf3c598)
E/DartVM  (27964): 	function = _CustomZone@7048458.runUnary
E/DartVM  (27964): 	url = dart:async/zone.dart
E/DartVM  (27964): 	line = 1029
E/DartVM  (27964): 	context = Context: null
E/DartVM  (27964): 	context level = -1 ]
E/DartVM  (27964): #0004 [ Frame pc(0x743b3e7fe4) fp(0x743cf3c670) sp(0x743cf3c638)
E/DartVM  (27964): 	function = _FutureListener@7048458.handleValue
E/DartVM  (27964): 	url = dart:async/future_impl.dart
E/DartVM  (27964): 	line = 126
E/DartVM  (27964): 	context = Context: null
E/DartVM  (27964): 	context level = -1 ]
E/DartVM  (27964): #0005 [ Frame pc(0x743b3e7b14) fp(0x743cf3c6e0) sp(0x743cf3c680)
E/DartVM  (27964): 	function = _Future@7048458.handleValueCallback
E/DartVM  (27964): 	url = dart:async/future_impl.dart
E/DartVM  (27964): 	line = 639
E/DartVM  (27964): 	context = Context: null
E/DartVM  (27964): 	context level = 0 ]
E/DartVM  (27964): #0006 [ Frame pc(0x743b3e65b4) fp(0x743cf3c760) sp(0x743cf3c6f0)
E/DartVM  (27964): 	function = _Future@7048458._propagateToListeners@7048458
E/DartVM  (27964): 	url = dart:async/future_impl.dart
E/DartVM  (27964): 	line = 668
E/DartVM  (27964): 	context = Context: null
E/DartVM  (27964): 	context level = 2 ]
E/DartVM  (27964): #0007 [ Frame pc(0x743b3f7bf8) fp(0x743cf3c7a0) sp(0x743cf3c770)
E/DartVM  (27964): 	function = _Future@7048458._complete@7048458
E/DartVM  (27964): 	url = dart:async/future_impl.dart
E/DartVM  (27964): 	line = 473
E/DartVM  (27964): 	context = Context: null
E/DartVM  (27964): 	context level = -1 ]
E/DartVM  (27964): #0008 [ Frame pc(0x7425d79c4c) fp(0x743cf3c810) sp(0x743cf3c7b0)
E/DartVM  (27964): 	function = Future.<anonymous closure>
E/DartVM  (27964): 	url = dart:async/future.dart
E/DartVM  (27964): 	line = 313
E/DartVM  (27964): 	context = Context: null
E/DartVM  (27964): 	context level = 0 ]
E/DartVM  (27964): #0009 [ Frame pc(0x7438aba54c) fp(0x743cf3c888) sp(0x743cf3c820)
E/DartVM  (27964): 	function = _rootRun@7048458
E/DartVM  (27964): 	url = dart:async/zone.dart
E/DartVM  (27964): 	line = 1120
E/DartVM  (27964): 	context = Context: null
E/DartVM  (27964): 	context level = -1 ]
E/DartVM  (27964): #0010 [ Frame pc(0x7438ab9528) fp(0x743cf3c988) sp(0x743cf3c900)
E/DartVM  (27964): 	function = _CustomZone@7048458.run
E/DartVM  (27964): 	url = dart:async/zone.dart
E/DartVM  (27964): 	line = 1021
E/DartVM  (27964): 	context = Context: null
E/DartVM  (27964): 	context level = -1 ]
E/DartVM  (27964): #0011 [ Frame pc(0x743b3e409c) fp(0x743cf3c9f0) sp(0x743cf3c998)
E/DartVM  (27964): 	function = _CustomZone@7048458.runGuarded
E/DartVM  (27964): 	url = dart:async/zone.dart
E/DartVM  (27964): 	line = 923
E/DartVM  (27964): 	context = Context: null
E/DartVM  (27964): 	context level = -1 ]
E/DartVM  (27964): #0012 [ Frame pc(0x743b3e3ee0) fp(0x743cf3ca38) sp(0x743cf3ca00)
E/DartVM  (27964): 	function = _CustomZone@7048458.<anonymous closure>
E/DartVM  (27964): 	url = dart:async/zone.dart
E/DartVM  (27964): 	line = 963
E/DartVM  (27964): 	context = Context: null
E/DartVM  (27964): 	context level = 0 ]
E/DartVM  (27964): #0013 [ Frame pc(0x7438aba62c) fp(0x743cf3cab0) sp(0x743cf3ca48)
E/DartVM  (27964): 	function = _rootRun@7048458
E/DartVM  (27964): 	url = dart:async/zone.dart
E/DartVM  (27964): 	line = 1124
E/DartVM  (27964): 	context = Context: null
E/DartVM  (27964): 	context level = -1 ]
E/DartVM  (27964): #0014 [ Frame pc(0x7438ab9528) fp(0x743cf3cbb0) sp(0x743cf3cb28)
E/DartVM  (27964): 	function = _CustomZone@7048458.run
E/DartVM  (27964): 	url = dart:async/zone.dart
E/DartVM  (27964): 	line = 1021
E/DartVM  (27964): 	context = Context: null
E/DartVM  (27964): 	context level = -1 ]
E/DartVM  (27964): #0015 [ Frame pc(0x7425d79988) fp(0x743cf3cc08) sp(0x743cf3cbc0)
E/DartVM  (27964): 	function = _CustomZone@7048458.<anonymous closure>
E/DartVM  (27964): 	url = dart:async/zone.dart
E/DartVM  (27964): 	line = 947
E/DartVM  (27964): 	context = Context: null
E/DartVM  (27964): 	context level = 0 ]
E/DartVM  (27964): #0016 [ Frame pc(0x7425d796bc) fp(0x743cf3cc50) sp(0x743cf3cc18)
E/DartVM  (27964): 	function = Timer.<anonymous closure>
E/DartVM  (27964): 	url = dart:async/runtime/libtimer_patch.dart
E/DartVM  (27964): 	line = 21
E/DartVM  (27964): 	context = Context: null
E/DartVM  (27964): 	context level = 0 ]
E/DartVM  (27964): #0017 [ Frame pc(0x7425d78494) fp(0x743cf3cd20) sp(0x743cf3cc98)
E/DartVM  (27964): 	function = _Timer@1026248._runTimers@1026248
E/DartVM  (27964): 	url = dart:isolate/runtime/libtimer_impl.dart
E/DartVM  (27964): 	line = 382
E/DartVM  (27964): 	context = Context: null
E/DartVM  (27964): 	context level = -1 ]
E/DartVM  (27964): #0018 [ Frame pc(0x7425d76090) fp(0x743cf3cd58) sp(0x743cf3cd30)
E/DartVM  (27964): 	function = _Timer@1026248._handleMessage@1026248
E/DartVM  (27964): 	url = dart:isolate/runtime/libtimer_impl.dart
E/DartVM  (27964): 	line = 416
E/DartVM  (27964): 	context = Context: null
E/DartVM  (27964): 	context level = -1 ]
E/DartVM  (27964): #0019 [ Frame pc(0x7438aaeb60) fp(0x743cf3ce08) sp(0x743cf3cde0)
E/DartVM  (27964): 	function = _RawReceivePortImpl@1026248._handleMessage@1026248
E/DartVM  (27964): 	url = dart:isolate/runtime/libisolate_patch.dart
E/DartVM  (27964): 	line = 171
E/DartVM  (27964): 	context = Context: null
E/DartVM  (27964): 	context level = -1 ]
E/DartVM  (27964): -------------------------
E/DartVM  (27964): All frames...
E/DartVM  (27964):
E/DartVM  (27964): #0000 [exit     : sp(0) fp(0x743cf3c350) pc(0)]
E/DartVM  (27964): #0001 [stub     : sp(0x743cf3c360) fp(0x743cf3c378) pc(0x743c682b14)]
E/DartVM  (27964): #0002 [dart     : sp(0x743cf3c388) fp(0x743cf3c3f8) pc(0x7428a4c6b8) package:myapp/views/home/home_page.dart_HomePageState__test@1030431688__async_op ]
E/DartVM  (27964): #0003 [dart     : sp(0x743cf3c408) fp(0x743cf3c440) pc(0x743b3e8740) dart:core__Closure@0150898_call ]
E/DartVM  (27964): #0004 [dart     : sp(0x743cf3c450) fp(0x743cf3c498) pc(0x743b3e85a4) dart:async_::__asyncThenWrapperHelper@7048458_<anonymous closure> ]
E/DartVM  (27964): #0005 [dart     : sp(0x743cf3c4a8) fp(0x743cf3c518) pc(0x743b3de654) dart:async_::__rootRunUnary@7048458 ]
E/DartVM  (27964): #0006 [dart     : sp(0x743cf3c528) fp(0x743cf3c588) pc(0x743b3de354) dart:async_::__rootRunUnary@7048458__rootRunUnary@7048458 ]
E/DartVM  (27964): #0007 [dart     : sp(0x743cf3c598) fp(0x743cf3c628) pc(0x743b3dd9b0) dart:async__CustomZone@7048458_runUnary ]
E/DartVM  (27964): #0008 [dart     : sp(0x743cf3c638) fp(0x743cf3c670) pc(0x743b3e7fe4) dart:async__FutureListener@7048458_handleValue ]
E/DartVM  (27964): #0009 [dart     : sp(0x743cf3c680) fp(0x743cf3c6e0) pc(0x743b3e7b14) dart:async__Future@7048458__propagateToListeners@7048458_handleValueCallback ]
E/DartVM  (27964): #0010 [dart     : sp(0x743cf3c6f0) fp(0x743cf3c760) pc(0x743b3e65b4) dart:async__Future@7048458__propagateToListeners@7048458 ]
E/DartVM  (27964): #0011 [dart     : sp(0x743cf3c770) fp(0x743cf3c7a0) pc(0x743b3f7bf8) dart:async__Future@7048458__complete@7048458 ]
E/DartVM  (27964): #0012 [dart     : sp(0x743cf3c7b0) fp(0x743cf3c810) pc(0x7425d79c4c) dart:async_Future_Future.delayed_<anonymous closure> ]
E/DartVM  (27964): #0013 [dart     : sp(0x743cf3c820) fp(0x743cf3c888) pc(0x7438aba54c) dart:async_::__rootRun@7048458 ]
E/DartVM  (27964): #0014 [dart     : sp(0x743cf3c898) fp(0x743cf3c8f0) pc(0x7438aba23c) dart:async_::__rootRun@7048458__rootRun@7048458 ]
E/DartVM  (27964): #0015 [dart     : sp(0x743cf3c900) fp(0x743cf3c988) pc(0x7438ab9528) dart:async__CustomZone@7048458_run ]
E/DartVM  (27964): #0016 [dart     : sp(0x743cf3c998) fp(0x743cf3c9f0) pc(0x743b3e409c) dart:async__CustomZone@7048458_runGuarded ]
E/DartVM  (27964): #0017 [dart     : sp(0x743cf3ca00) fp(0x743cf3ca38) pc(0x743b3e3ee0) dart:async__CustomZone@7048458_bindCallbackGuarded_<anonymous closure> ]
E/DartVM  (27964): #0018 [dart     : sp(0x743cf3ca48) fp(0x743cf3cab0) pc(0x7438aba62c) dart:async_::__rootRun@7048458 ]
E/DartVM  (27964): #0019 [dart     : sp(0x743cf3cac0) fp(0x743cf3cb18) pc(0x7438aba23c) dart:async_::__rootRun@7048458__rootRun@7048458 ]
E/DartVM  (27964): #0020 [dart     : sp(0x743cf3cb28) fp(0x743cf3cbb0) pc(0x7438ab9528) dart:async__CustomZone@7048458_run ]
E/DartVM  (27964): #0021 [dart     : sp(0x743cf3cbc0) fp(0x743cf3cc08) pc(0x7425d79988) dart:async__CustomZone@7048458_bindCallback_<anonymous closure> ]
E/DartVM  (27964): #0022 [dart     : sp(0x743cf3cc18) fp(0x743cf3cc50) pc(0x7425d796bc) dart:async_Timer__createTimer@7048458_<anonymous closure> ]
E/DartVM  (27964): #0023 [dart     : sp(0x743cf3cc60) fp(0x743cf3cc88) pc(0x7438aaec90) dart:core__Closure@0150898_call ]
E/DartVM  (27964): #0024 [dart     : sp(0x743cf3cc98) fp(0x743cf3cd20) pc(0x7425d78494) dart:isolate__Timer@1026248__runTimers@1026248 ]
E/DartVM  (27964): #0025 [dart     : sp(0x743cf3cd30) fp(0x743cf3cd58) pc(0x7425d76090) dart:isolate__Timer@1026248__handleMessage@1026248 ]
E/DartVM  (27964): #0026 [dart     : sp(0x743cf3cd68) fp(0x743cf3cd98) pc(0x7425d75ab4) dart:isolate__Timer@1026248__handleMessage@1026248__handleMessage@1026248 ]
E/DartVM  (27964): #0027 [dart     : sp(0x743cf3cda8) fp(0x743cf3cdd0) pc(0x7438aaec90) dart:core__Closure@0150898_call ]
E/DartVM  (27964): #0028 [dart     : sp(0x743cf3cde0) fp(0x743cf3ce08) pc(0x7438aaeb60) dart:isolate__RawReceivePortImpl@1026248__handleMessage@1026248 ]
E/DartVM  (27964): #0029 [entry    : sp(0x743cf3ce18) fp(0x743cf3ced8) pc(0x743c681ad0)]
F/libc    (27964): Fatal signal 7 (SIGBUS), code 1, fault addr 0x743c6c0041 in tid 28071 (Thread-6)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/heroltexx/herolte:8.0.0/R16NW/G930FXXS3ESA2:user/release-keys'
Revision: '8'
ABI: 'arm64'
pid: 27964, tid: 28071, name: Thread-6  >>> com.xxxxxx.myapp.dev <<<
signal 7 (SIGBUS), code 1 (BUS_ADRALN), fault addr 0x743c6c0041
    x0   000000743c6c0041  x1   0000000000000001  x2   00000073f940eb48  x3   000000743c6d68c1
    x4   000000743c6c2af1  x5   0000000000000001  x6   0000000000000009  x7   8000000000008000
    x8   000000743c6819e0  x9   0000000000000001  x10  000000000000003b  x11  0000000080000168
    x12  000000000000001f  x13  0000000000000000  x14  0000007438f205a8  x15  000000743cf3b030
    x16  0000000000000003  x17  000000745f68db08  x18  0000000000000000  x19  0000007438f20000
    x20  000000744b564e20  x21  000000744b564e10  x22  000000744b564e30  x23  000000743c6c0041
    x24  000000743c6c0041  x25  000000743ce63000  x26  0000007438f20000  x27  000000743c6c0041
    x28  0000000000000004  x29  000000743cf3b0e8  x30  000000743c681ad0
    sp   000000743cf3a0f0  pc   000000743c6c0041  pstate 0000000060000000
backtrace:
    #00 pc 0000000000000041  <anonymous:000000743c6c0000>
    #01 pc 0000000000001acc  <anonymous:000000743c680000>
Lost connection to device.
Exited (sigterm)

@kinex kinex changed the title Crash if setting a breakpoint in a break statement of a for loop Crash if setting a breakpoint to the break statement of a for loop Apr 13, 2019
@DanTup
Copy link
Member

DanTup commented Apr 13, 2019

Yikes! Thanks for reporting - this is a VM issue and I can reproduce on todays build so I've moved it over to dart-lang/sdk#36622.

@DanTup DanTup closed this as completed Apr 13, 2019
@DanTup DanTup added the upstream in dart / flutter Needs changing in Dart or Flutter label Apr 13, 2019
@kinex
Copy link
Author

kinex commented Apr 13, 2019

Ok, thanks. I wasn't sure where to report this.

@DanTup DanTup added fixed in dart / flutter and removed upstream in dart / flutter Needs changing in Dart or Flutter labels Apr 25, 2019
@DanTup
Copy link
Member

DanTup commented Apr 25, 2019

The issue has been fixed in the SDK. I've verified it with the current nightly build 👍 It will take a little while to make stable builds of Dart/Flutter though.

@kinex
Copy link
Author

kinex commented Apr 25, 2019

Great! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants