Repository: flutter
Issue: Strange behavior when restarting from a breakpoint
Labels: tool,t: hot reload,a: debugging,has reproducible steps,P2,found in release: 3.3,found in release: 3.5,team-tool,triaged-tool

Hi,
I'm having the following problem when doing a 'restart' while in a breakpoint. 
Take the following code as example:

```
void main() {
  for (int i = 0; i < 10000; i++) {
    print(i);
  }
  runApp(const MyApp());
}
```

If I put a breakpoint in the `print(i)` line, and restart while on the breakpoint, I would expect the restart to take place immediately... however it continues execution, printing all lines in the console 0..10000 and only after that it restarts.

In several occasions, this behavior causes a very long time until the restart actually happens, or it will never restart if there is an infinite loop after the breakpoint.

I also tried the following code with a breakpoint at `fun1()` and found that it will execute both functions fun1 and fun2  complete before restarting.

```
void fun1() {
    print("fun1");
    for (int i = 0; i <= 1000; i++) {
      print("fun1: $i");
    }
  }

  void fun2() {
    print("fun2");
    for (int i = 0; i <= 1000; i++) {
      print("fun2: $i");
    }
  }

  @override
  void initState() {
    // TODO: implement initState
    fun1();
    fun2();
    super.initState();
  }

```
Is this normal behavior or a bug?
Im using VsCode V1.72.2

Thanks

<!-- Finally, paste the output of running `flutter doctor -v` here. -->
flutter doctor -v
[√] Flutter (Channel stable, 3.3.4, on Microsoft Windows [Versi¢n 10.0.19044.2130], locale es-AR)
    • Flutter version 3.3.4 on channel stable at c:\src\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision eb6d86ee27 (2 weeks ago), 2022-10-04 22:31:45 -0700
    • Engine revision c08d7d5efc
    • Dart version 2.18.2
    • DevTools version 2.15.0

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at d:\android\sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: D:\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.1)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.11.31613.86
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2021.2)
    • Android Studio at D:\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840)

[√] IntelliJ IDEA Community Edition (version 2020.2)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.2.3
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart

[√] VS Code (version 1.72.2)
    • VS Code at C:\Users\RomiyPablo\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.50.0

[√] Connected device (4 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 12 (API 31) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Versi¢n 10.0.19044.2130]
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 104.0.5112.102
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 106.0.1370.52

[√] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!