Prism 6.0 provides limited support for debugging C++ programs.
With few limitations, you can use Prism to debug C++ programs containing the features described in this section.
You can simply type print member to print a data member when in a class method.
You can set breakpoints using the stop in command with functions having either C or C++ linkage (mangled) names.
You can use the Prism stop in, func and list commands with methods of a class.
(prism) stop in class_name::method_name (prism) func class_name::method_name (prism) list class_name::method_name
Prism supports assignment to class member variables.
You can use the Prism whatis and print commands with variables of class type and template classes.
Prism recognizes the this identifier in C++ methods. Its value also appears in stack back-traces.
Prism allows you to set breakpoints in overloaded method names. A list pops up, from which you can select the correct method.
Prism allows you to set breakpoints in template functions. A list pops up, from which you can select the correct function.
Prism's identifier syntax recognizes the C++ scope operator, ::. For example:
(prism) whereis dummy variable: `symbol.x`symbol.cc`Symbol::print:71`dummy
With significant limitations, you can use Prism to debug C++ programs containing the features described in this section.
Prism recognizes casting a class pointer to the class of a base type only for single inheritance relationships. For example, Prism recognizes the following cast syntax when printing variable P:
(prism) print (struct class_name *) P (prism) print (class class_name *) P (prism) print (class_name *) P
You can print static class members when the current scope is a class method. You cannot print static class members when not in class scope. For example, the following command will fail if you issue it outside of the scope of class_name:
(prism) print class_name::var_name
You cannot use a method name that has some forms of non-C identifier syntax to set a breakpoint. For example, this fails with a syntax error:
(prism) stop in class_name::operator+
You must instead use stop at line syntax. These method names are correctly identified in a stack trace, however.
You cannot use Prism to debug C++ programs containing the features described in this section.
Using Prism 6.0, you cannot set a breakpoint in an inlined method that is used in multiple source files. Only one of the several debuggable copies of the inlined function gets the breakpoint.
Prism does not support calling C++ methods, using any syntax.
Prism does not support printing variables of type reference, such as int &xref. Also, variables of type reference appear as (unknown type) in stack traces.
Prism 6.0 provides support for debugging Fortran 90 programs. This chapter describes the degree of support for Fortran 90 provided by Prism commands.
With few limitations, you can use Prism to debug Fortran 90 programs containing the features described in this section.
With the exception of constructors, Prism supports derived types in Fortran 90. For example, given these declarations:
type point3 integer x,y,z; end type point3 type(point3) :: var,var2;
you can use Prism commands with these Fortran 90 variables:
(prism) print var (prism) whatis var (prism) whatis point3 (prism) assign var=var2 (prism) print var%x (prism) assign var%x = 70
Prism fully supports generic functions in Fortran 90. For example, given the generic function fadd, declared as follows:
interface fadd integer function intadd(i, j) integer*4, intent(in) :: i, j end function intadd real function realadd(x, y) real, intent(in) :: x, y end function realadd end interface
you can use Prism commands with these Fortran 90 generic functions:
(prism) p fadd(1,2) (prism) whatis fadd (prism) stop in fadd
In each case, Prism asks you which instance of fadd your command refers to: For example:
(prism) whatis fadd More than one identifier `fadd'. Select one of the following names: 0) Cancel 1) `f90_user_op_generic.exe`f90_user_op_generic.f90`fadd ! real*4 realadd 2) `f90_user_op_generic.exe`f90_user_op_generic.f90`fadd ! integer*4 intadd > 1 real*4 function fadd (x, y) (dummy argument) real*4 x (dummy argument) real*4 y
In addition to the standard assignment operator (=), Prism supports the new Fortran 90 pointer assignment operator =>. For example:
program pnode type node integer x,y type(node), pointer :: next end type node type(node), target :: n1,n2,n3 type(node), pointer :: pn1, pn2 ... pn1 => n1 pn2 => n2 i = 0 end
The following examples assume that a breakpoint has been set at the last statement, i = 0, and show how Prism supports Fortran 90 pointers:
print pn1 - Prints the value pointed to by pn1, in this case n1.
print pn1%x - Prints the value of the member x in the object pointed to by pn1 (in this case n1%x).
assign pn1%x = 3 - Assigns n1%x = 3.
assign pn1=n3 - Assigns n3 to the value pointed to by pn1 (this has the same effect as assign n1=n3).
assign pn1=>n3 - Makes pn1 point to n3.
assign pn1=>pn2 - Makes pn1 point to the same object as pn2.
If pn1 does not point to any value, an attempt to access it will result in an error message:
(prism) p pn1 Fortran variable is not allocated/associated.
You can find the state of a pointer using the whatis command. Assume pn1 has not been associated:
(prism) whatis pn1 node pn1 ! unallocated f90 pointer
Assume pn1 has been associated with a value:
(prism) whatis pn1 node pn1 ! f90 pointer
Prism supports pointers to arrays in the same way that it supports simple pointers. The Fortran 90 language constraints apply. For example, Fortran 90 allows pointer assignment between pointers to arrays. Assignment to arrays having different ranks is not allowed.
For example, given these declarations:
real, dimension(10), target :: r_arr1 real, dimension(20), target :: r_arr2 real, dimension(:), pointer :: p_arr1,p_arr2
you can use Prism commands with these Fortran 90 pointers to arrays:
(prism) print p_arr1 (prism) whatis p_arr2 (prism) assign p_arr1 => r_arr1 (prism) assign p_arr1(1:2) = 7
Prism does not handle Fortran 90 pointers to array sections correctly. For example,
array_ptr => some_array(1:10:3)
Prism will print some elements of the array, although it will not print the correct elements or the correct number of elements.
Prism supports allocatable arrays in the same way that it supports pointers to arrays. Fortran 90 support includes the Prism commands print and whatis. Prism also supports slicing and striding Fortran 90 allocatable arrays. For example, to print a section of allocatable array alloc_array:
(prism) print alloc_array(1:30:2)
Fortran 90 language constraints apply. For example, Fortran 90 allows allocating or deallocating memory for an allocatable array but does not allow making an allocatable array point to another object. Therefore, Prism does not recognize pointer assignment, =>, to allocatable arrays.
Prism supports Fortran 90 operations on arrays or array sections, and assignment to continuous sections of arrays.
(prism) assign a=b+c (prism) assign a(3:7)=b(2:10:2)+c(8:8)
Prism supports Fortran 90 masked print statements:
(prism) where (arr>0) print arr
The Prism whatis command shows variable attributes. These attributes include allocated and associated attributes for pointers, or the (function variable) attribute displayed for a RESULT variable in Fortran 90. For example, given this declaration:
function inc(i) result(j) integer i; integer k; integer j; k = i+1 j = k end function inc
the whatis command displays the function variable attribute of j:
(prism) whatis j (function variable) integer*4 j
With significant limitations, you can use Prism to debug Fortran 90 programs containing the features described in this section.
Prism views user-defined operators as functions. If a new operator . my_op. appears in a Fortran 90 program, then Prism cannot deal with the operator . my_op. as an operator, but it can deal with the function my_op, viewed as a generic function. You cannot use operators named * (or +, or any other keyword operator.), but you can stop in functions that are used to define such operators. For example:
interface operator(.add_op.) integer function int_add(i, j) integer*4, intent(in) :: i, j end function int_add real function real_add(x, y) real, intent(in) :: x, y end function real_add end interface
In this example, Prism does not support debugging the user defined function .add_op.
(prism) print 1 .add_op. 2
However, Prism supports the function add_op:
(prism) print add_op(1,2)
A list pops up, allowing you to choose which add_op to apply.
The following commands can take internal procedure names as arguments:
stop in
whatis
If there are several procedures with the same name, a list pops up from which to select the desired procedure.
Prism supports the same intrinsics in Fortran 90 that it supports in Fortran 77. See " Using Fortran Intrinsic Functions in Expressions".
You cannot use Prism to debug Fortran 90 programs containing the features described in this section.
Prism does not support constructors for derived types.
type point3 integer x,y,z;end type point3 type(point3) :: var,var2;
Prism does support assignment to derived types, however. For example:
(prism) assign var = var2
Although Fortran 90 allows the use of constructors, Prism does not support them. The following example is not supported:
(prism) assign var = point3(1,2,3)
If the generic function is defined in the current module, such as:
interface fadd integer function intadd(i, j) integer*4, intent(in) :: i, j end function intadd real function realadd(x, y) real, intent(in) :: x, y end function realadd end interface
then only references to the fadd are supported, but references to specific functions that define fadd are not. For example:
(prism) whatis intadd prism: "intadd" is not defined in the scope `f90_user_op_generic.exe`f90_user_op_generic.f90`main`
The error checking involved by the semantics of the => operator is not fully supported. If your program causes an illegal pointer assignment, Prism might not issue any error, and the behavior of the program will be undefined.
Prism does not print the result of an array-valued function.