Can not see some local variables in debugger within intellij for some scala programs

12,576

Solution 1

This is mainly because debugging anonymous functions is inherently a hard job!

What you can do is to try to open $outer in variables section in debugger which means the anonymous function containing current context.

By doing this repeatedly (find $outer of that $outer again) there is a good chance you can find your variables.

enter image description here

If $outer is not available just navigate to the previous stack frame by clicking on it on Frames tab in Debugger.

Solution 2

I had a similar problem in IJ 2017: I declared and initialized two local booleans, but only the second one was displayed in the debugger.

AltF8 allowed me to evaluate the expression used to initialize that boolean but did not find the value of the boolean itself either.

Changing the expression slightly by comparing the result to true before assigning it made it work. So in your case, maybe varying the initialisation might work too.

Solution 3

You can try Alt+F8 to jump into expression evaluator, usually from that window I can reach all variables that are reachable from breakpoint.

Share:
12,576
WestCoastProjects
Author by

WestCoastProjects

R/python/javascript recently and before that Scala/Spark. Machine learning and data pipelines apps.

Updated on June 15, 2022

Comments

  • WestCoastProjects
    WestCoastProjects almost 2 years

    As described in the title there are some cases that Intellij is not able to recognized/display some of the local variables.

    enter image description here

    As can be seen, some of the local variables e.g. outarr and arrptr are already set: but the debugger does not know about them.

    I am running inside IJ 13.1.4 in a maven project and have enabled debugging info as follows:

          <configuration>
            <args>
                    ..
              <arg>-feature</arg>
                <arg>-g:notc</arg>
              </args>
             ..
    

    My question is about : does anyone recognize this problem and has come up with workaround(s) for it?

    Update Per suggestion on an answer here is the result of trying Alt-F8

    enter image description here