Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 299
WestCoastProjects Avatar asked Oct 24 '14 03:10

WestCoastProjects


3 Answers

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.

like image 126
Nader Ghanbari Avatar answered Sep 25 '22 15:09

Nader Ghanbari


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

like image 37
Eugene Zhulenev Avatar answered Sep 23 '22 15:09

Eugene Zhulenev


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.

like image 35
lucidbrot Avatar answered Sep 24 '22 15:09

lucidbrot