Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

about the immediate window

yingwu
Beginner
1,152 Views
I forget asking thsi question. During debugging the code, could I use immediate window of VS? Is there any command? For example, I want to display an array, A. I input print *,A in the immediate window. Is this possible?
0 Kudos
6 Replies
Lorri_M_Intel
Employee
1,152 Views
Quoting - yingwu
I forget asking thsi question. During debugging the code, could I use immediate window of VS? Is there any command? For example, I want to display an array, A. I input print *,A in the immediate window. Is this possible?

Well, I had never heard of the immediate window so I went poking around a bit.

Yes, you can use the immediate window to display Fortran variables, but quite frankly, I like the Locals window, the Watch window, or the tool-tip better.

If you want to use the Immediate window, use
>debug.print a



- Lorri
0 Kudos
yingwu
Beginner
1,152 Views

Well, I had never heard of the immediate window so I went poking around a bit.

Yes, you can use the immediate window to display Fortran variables, but quite frankly, I like the Locals window, the Watch window, or the tool-tip better.

If you want to use the Immediate window, use
>debug.print a



- Lorri

Hi, Lorri. When a breakpoint is set, you can call the immediate windows by Ctrl+Alt+i. I tried debug.print a, but the VS returns

debug.print i
Undefined variable debug

So it does not work. But it is OK. Could I ask what you mean 'the Locals window, the Watch window, or the tool-tip better'? What is locals window or the tool-tip? I know the watch window, but could I ask how to use it?

Thanks!
0 Kudos
Les_Neilson
Valued Contributor II
1,152 Views
Quoting - yingwu
Could I ask what you mean 'the Locals window, the Watch window, or the tool-tip better'? What is locals window or the tool-tip? I know the watch window, but could I ask how to use it?

Thanks!

When you are debugging using Visual Studio set a breakpoint somewhere in your code then run the program. When it reaches the breakpoint and pausesthen the Debug menu has the following options (among others) :
Debug->Windows->
Watch has 4 watch windows available where you can view the values of your variables.

Locals which shows the variables and their values local to the current routine (where your beakpoint has been set)

Call Stack showsC was called fromB (with the list of arguments) B was called fromA and so on

Memory has 4 windows where you can see the contents at a specified address.

This way you don't necessarily need to "print" values to a window or file you just display them in a watch window when you reach a breakpoint, or if you hover the mouse over a variable inthe source file then its vale or values for an array,are displayed as a "tooltip" popup.

Les
0 Kudos
yingwu
Beginner
1,152 Views
Quoting - Les Neilson

When you are debugging using Visual Studio set a breakpoint somewhere in your code then run the program. When it reaches the breakpoint and pausesthen the Debug menu has the following options (among others) :
Debug->Windows->
Watch has 4 watch windows available where you can view the values of your variables.

Locals which shows the variables and their values local to the current routine (where your beakpoint has been set)

Call Stack showsC was called fromB (with the list of arguments) B was called fromA and so on

Memory has 4 windows where you can see the contents at a specified address.

This way you don't necessarily need to "print" values to a window or file you just display them in a watch window when you reach a breakpoint, or if you hover the mouse over a variable inthe source file then its vale or values for an array,are displayed as a "tooltip" popup.

Les

Hi, Les. It is very useful. Then I have a new problem. I find if I compile the project without any optimization, I can see the values of variables. However, if set to maxmize speed plus higher level optimization, I can not see the values. I attach a picture below. Is there any way to solve this? Thanks....



0 Kudos
Les_Neilson
Valued Contributor II
1,152 Views


In this case the optimization has caused the values of some variables to not be stored in memory but in a register instead. You could use the Debug->Windows->Register window to see them but :-

While debugging it is best to have optimization turned off and all run-time checks turned on. You should only need to turn on optimization for your release version once you have fixed any bugs.

Les
0 Kudos
Lorri_M_Intel
Employee
1,152 Views
Quoting - yingwu

Hi, Lorri. When a breakpoint is set, you can call the immediate windows by Ctrl+Alt+i. I tried debug.print a, but the VS returns

debug.print i
Undefined variable debug

So it does not work. But it is OK. Could I ask what you mean 'the Locals window, the Watch window, or the tool-tip better'? What is locals window or the tool-tip? I know the watch window, but could I ask how to use it?

Thanks!

Now that you've discovered the wonderful watch windows, I know you're not using the immediate window anymore but ...

You need the leading ">" character, as:

>debug.print i

That tells the debugger that it should use its own "debug.print" utility.

- Lorri
0 Kudos
Reply