Prism 6.0 User's Guide

Printing Pointers as Array Sections

Prism allows you to print simple arrays by section. For example, assuming the following declarations and code,


double da[]={0.1,1.1,2.1,3.1,4.1,5.1,6.1,7.1,8.1,9.1,10.1};
double *pd=da;
int a[]={0,1,2,3,4,5,6,7,8,9,10};
int *pa=a;
int *par[10];
int **ppi=par;
void *ptr=(void*)da;
...
for(i=0;i<10;i++)
   par[i]=&a[9-i];
<------ assume that the program is stopped here ------
...

you can print array a by section:

print a[1:5:2]
a[1:5:2] = 
(1:3) 1 3 5

Prism allows you to view a pointer as a one-dimensional array, by specifying a section when printing the pointer. For example:

print pa[1:5:2]
pa[1:5:2] = 
(1:3) 1 3 5

Prism allows you to dereference an array of pointers if you specify the elements to be dereferenced by using sections. If the array element is a pointer, then Prism allows you to the dereference the section:

*par[1:5:2] =
(1:3) 8 6 4

Prism allows you to cast pointers:

print ((double*)ptr)[1:4:2]
((double*)ptr)[1:4:2] = 
(1:2) 1.100000000000000      3.100000000000000

Currently, Prism supports only one level of dereferencing. Assuming this declaration:

int **appi[2]; 

Prism does not support:

print **(appi[0:1])

Although Prism allows one level of dereference for sections, Prism does not support indexing. Thus, Prism allows:

print *par[1:5:2]

but Prism does not allow:

print par[1:5:2][0]