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

Using ifort (9.1) and the visual studio (2005) debugger

carlls
Beginner
537 Views
I am trying to use these tools from the command line (actually a cygwin command line) and am having issues.

Using the samples from the Intel documentation (heading: Creating, Running, and Debugging an Executable Program) :

Starting in a single directory I am using the following:

main.f90:

! File: main.f90
! This program calculates the average of five numbers
PROGRAM MAIN
USE ARRAY_CALCULATOR
REAL, DIMENSION(5) :: A = 0
REAL :: AVERAGE

print *, 'Main.f90'

PRINT *, 'Type five numbers: '
READ (*,'(F10.3)') A

AVERAGE = CALC_AVERAGE(A)
PRINT *, 'Average of the five numbers is: ', AVERAGE
END PROGRAM MAIN

array_calc.f90:

! File: array_calc.f90.
! Module containing various calculations on arrays.
MODULE ARRAY_CALCULATOR
INTERFACE
FUNCTION CALC_AVERAGE(D)
REAL :: CALC_AVERAGE
REAL, INTENT(IN) :: D(:)
END FUNCTION CALC_AVERAGE
END INTERFACE
! Other subprogram interfaces...
END MODULE ARRAY_CALCULATOR

calc_aver.f90:
! File: calc_aver.f90.
! External function returning average of array.
FUNCTION CALC_AVERAGE(D)
REAL :: CALC_AVERAGE
REAL, INTENT(IN) :: D(:)

print *, ' calc_aver.f90'
CALC_AVERAGE = SUM(D) / UBOUND(D, DIM = 1)
END FUNCTION CALC_AVERAGE

I compile these using:

ifort -c -debug:full array_calc.f90

ifort -c -debug:full calc_aver.f90

ifort -c -debug:full main.f90

ifort -debug:full -exe:calc main.obj array_calc.obj calc_aver.obj

So at this stage the contents of the directory are:
array_calc.f90 calc.exe calc_aver.f90 main.f90
array_calc.obj calc.ilk calc_aver.obj main.obj
array_calculator.mod calc.pdb

Then I start the visual studio debugger using:

devenv -debugexe calc.exe

I then open up my source file using:

File/Open/File main.f90

I see the file loaded correctly.

I then move my cursor to the line:

" PRINT *, 'Type five numbers: '"

and right click, breakpoint/insert breakpoint .... and I get a nice red dot.

So when I run the debgger, I expect to see a console window showing "Main.f90" and the cursor waiting at the break point before executing

" PRINT *, 'Type five numbers: '"

So now I hit Debug/Start Debugging (F5) ... and what do I see but a console window waiting for my input. Ignoring my breakpoint completely.

I enter in data 3. 4. 5. 6. 7. (one per line) and the code correctly gives Average of 5. then stops at the line
" END PROGRAM MAIN" with a yellow arrow pointing to the line.


Not wanting this to be a RYFFM (Read your fact filled manual) question, I also tried the -Quse-vcdebug flag but it did not seem to make a diffence.

By the way I am doing this to see if the debugger is able to follow Steve's earlier tip:

http://software.intel.com/en-us/forums/showthread.php?t=63285

Thanks
Carl
0 Kudos
0 Replies
Reply