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

Tracepoint syntax for printing array

abhimodak
New Contributor I
891 Views
Hi

Does anyone know how to print an array or array section using a tracepoint? If I just put the name of the array, the output window would show {...}. I can see the individual elements by using {a(3)}, {a(7)} etc.

I am wondering if a C++ style FOR loop work; or if one one use VB macro. If VB macro works how to pass the variables and arrays?

Abhi
0 Kudos
6 Replies
jimdempseyatthecove
Honored Contributor III
891 Views

real :: array(1000)
...
write(*,*) array(100:200) ! section of array
write(*,*) (array(I), I=100,200) ! same section with implied do list

Jim

0 Kudos
abhimodak
New Contributor I
891 Views
Hi Jim

Putting array(1:10) or using implied do loop in the print message window of the debugger tracepoint (or when hit of a breakpoint) does not work.

Abhi
0 Kudos
jimdempseyatthecove
Honored Contributor III
891 Views
Quoting abhimodak
Hi Jim

Putting array(1:10) or using implied do loop in the print message window of the debugger tracepoint (or when hit of a breakpoint) does not work.

Abhi


Use the Watch window Debug | Windows | Watch (select Watch 1, 2, 3, 4)

enter in the range of the array subscripts. Example:

array(5:10)

On each break point the watch window is updated
Note, you will see

[+] array(5:10)

values not displayed,
Click on [+] to expand array listing, shows [-] followed by expansion
Click again on [-] to collapse array expansion.

Jim

0 Kudos
abhimodak
New Contributor I
891 Views
Hi Jim

May be I am not getting this right.. apologies in advance.

I do know how to watch array sections at breakpoint in the watch window. I have been doing that for a long time. What I am wondering is at a "tracepoint" (and not a break-point) I can continue without breaking and print the variables in the "output" window. I can print the scalar variables to the output window using {variable}; I don't know how to do it for arrays.

Abhi
0 Kudos
Les_Neilson
Valued Contributor II
891 Views

From the help it would appear that "tracepoints" were MS targetting C++/C# debugging facility.
Again according to the help:

(a) "You can create a tracepoint from scratch with the New Tracepoint command."

(b) "In a source window, click a line where you want to set a tracepoint and choose Insert Tracepoint from Breakpoints in the shortcut menu."

In VS2008 I cannot findeither of these tracepoint menu options. But it does allow me to convert an existing breakpoint to a tracepoint byclicking onthe breakpoint and selecting "When hit"

Unfortunately the help talks about printing variables (which appears to mean scalars) but doesn't mention arrays.
Howeverit also allows you to run a macro which may be a wayto printarrays. But I don't use macros so can't help you there - sorry.

Les

0 Kudos
abhimodak
New Contributor I
891 Views
Hi Les

In VS2005 (and in a Fortran project), I right click the line where I want to insert the breakpoint. Then from the breakpoint dropdown I can select between a breakpoint and a tracepoint. Alternatively, as you mentioned, I use the existing breakpoint and then select "when hit" to get a tracepoint facility.

The print in tracepoint does seem to understand that variable is an array for it prints a {...} when a is an array. I am trying to build a macro but the access to locals has to come through DTE.Debugger.StackFrame.Locals. I haven't fully figured it out yet.

Sincerely
Abhi
0 Kudos
Reply