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

Debug isn't working (optimized out) #53654

Closed
ozalisky opened this issue Sep 29, 2023 · 13 comments
Closed

Debug isn't working (optimized out) #53654

ozalisky opened this issue Sep 29, 2023 · 13 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. cherry-pick-candidate Candidates to be cherry-picked needs-info We need additional information from the issue author (auto-closed after 14 days if no response) P2 A bug or feature request we're likely to work on triaged Issue has been triaged by sub team vm-debugger

Comments

@ozalisky
Copy link

I will copy the description from the original issue Dart-Code/Dart-Code#4555 (comment)

Describe the bug
During debug, hovering a value doesn't show its value anymore.

To Reproduce
Steps to reproduce the behavior:

  1. Run some code
  2. Break in a breakpoint then hover some variable
  3. Most of the times it happens inside of a builder

Expected behavior
To show the value of the variable.

image
image

Please complete the following information:

Operating System and version: MacOS 13.5.2
VS Code version: 1.82.2
Flutter 3.13.4 • channel stable •
https://github.com/flutter/flutter.git
Framework • revision 367f9ea16b (2 weeks ago) •
2023-09-12 23:27:53 -0500
Engine • revision 9064459a8b
Tools • Dart 3.1.2 • DevTools 2.25.0

It appeared in Dart 3.0.1, Flutter 3.10.1

@keertip keertip added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. vm-debugger labels Sep 29, 2023
@a-siva
Copy link
Contributor

a-siva commented Sep 29, 2023

//cc @derekxu16

@a-siva a-siva added the P2 A bug or feature request we're likely to work on label Sep 29, 2023
@lirantzairi
Copy link

Sample code:

import 'package:flutter/material.dart';

void main() {
  runApp(const MainApp());
}

class MainApp extends StatelessWidget {
  const MainApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Builder(
          builder: (context) {
            return Center(
              child: Text('Hello World!'),
            );
          },
        ),
      ),
    );
  }
}

Put a breakpoint in return Center( and try to watch or print the inner context

@bahadirarslan
Copy link

Sample code:

import 'package:flutter/material.dart';

void main() {
  runApp(const MainApp());
}

class MainApp extends StatelessWidget {
  const MainApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Builder(
          builder: (context) {
            return Center(
              child: Text('Hello World!'),
            );
          },
        ),
      ),
    );
  }
}

Put a breakpoint in return Center( and try to watch or print the inner context

I can reproduce the bug with this code. Also, I noticed generally if there is a kind of loop, breakpoints in the loop cause this bug but if you add a breakpoint before loop operation problem doesn't occur.

@derekxu16
Copy link
Member

The problem is that my fix did not make it into the current stable Flutter release. The information above shows that Flutter 3.13.4 uses Dart 3.1.2. Dart 3.1.2's hash is 9bf2f88, and my change to debugger.cc (f5080be) does not appear when looking at the history of debugger.cc up to 9bf2f88 (https://github.com/dart-lang/sdk/commits/9bf2f88a8ba82fcfdc5960ac9c92e0e03fc0acef/runtime/vm/debugger.cc).

So, one solution is to use a newer release of Flutter that uses Dart 3.2.0. If this is not possible, please leave a 👍 on this comment to indicate that you would like us to cherry-pick the fix into a stable Flutter release.

@a-siva a-siva added cherry-pick-candidate Candidates to be cherry-picked triaged Issue has been triaged by sub team labels Oct 12, 2023
@a-siva
Copy link
Contributor

a-siva commented Oct 12, 2023

We have a planned release of the next Flutter stable release (3.16) which has the above change on November 15th, but I figure folks would like to get a fix sooner?

@lirantzairi
Copy link

We have a planned release of the next Flutter stable release (3.16) which has the above change on November 15th, but I figure folks would like to get a fix sooner?

Preferably yes because we need to use print()s instead of proper variable inspection

@bahadirarslan
Copy link

We have a planned release of the next Flutter stable release (3.16) which has the above change on November 15th, but I figure folks would like to get a fix sooner?

This bug really slows down debugging and sometimes this may take days. No one wants to waste time so please make it available sooner.

@a-siva
Copy link
Contributor

a-siva commented Oct 13, 2023

A hot fix request has been filed here #53747 and can be used to track progress.

@ozalisky
Copy link
Author

So, I'm on latest stable flutter (3.13.8) and optimized out message is gone for me, but there is the new strange behavior for debug:

image

When trying to view the value of variable - IDE shows the type and location of class, not the value. The value is not available in the Watch section too. But it's possible to see the value in the Variables section through the this._widget

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.8, on macOS 14.0 23A344 darwin-arm64, locale uk-UA)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.83.1)
[✓] Connected device (2 available)
[✓] Network resources

@derekxu16
Copy link
Member

Can you please share a minimal reproducible example? I tried writing similar code to the one in your screenshot and wasn't able to reproduce the problem.

@a-siva a-siva added the needs-info We need additional information from the issue author (auto-closed after 14 days if no response) label Nov 16, 2023
@a-siva
Copy link
Contributor

a-siva commented Nov 16, 2023

@ozalisky any updates on the reproduction example request from @derekxu16 above.
It would be ideal if we opened a new issue for the strange behavior under debug that you are seeing

@ozalisky
Copy link
Author

@ozalisky any updates on the reproduction example request from @derekxu16 above.

It would be ideal if we opened a new issue for the strange behavior under debug that you are seeing

Sorry, was busy with work. You can close this issue and I will try to create reproducible example for it next week. Still seeing the problem almost every day 😞

@a-siva
Copy link
Contributor

a-siva commented Nov 16, 2023

Ok, will close this issue and wait for you to open a new one for the other issue.

@a-siva a-siva closed this as completed Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. cherry-pick-candidate Candidates to be cherry-picked needs-info We need additional information from the issue author (auto-closed after 14 days if no response) P2 A bug or feature request we're likely to work on triaged Issue has been triaged by sub team vm-debugger
Projects
None yet
Development

No branches or pull requests

6 participants