Inspect Manual
Using Inspect With C
Inspect Manual—429164-006
8-9
Self-Referential Structures
Self-Referential Structures
This example displays two elements in a self-referential structure, using the C
declarations:
struct tnode { /* the basic node */
char *word; /* points to text */
struct tnode *left; /* left child */
struct tnode *right; /* right child */
};
struct tnode s, *sp;
This example displays the structure s:
This example displays the data to which sp points, using tnode as a template.
Note that if you display sp instead of *sp, Inspect displays the address of sp instead of
the data to which it points.
Unions
To access a particular union member, you must explicitly qualify that member. This
qualification determines which field of the union Inspect accesses (which field type is
actually accessed). In a display item, if you do not explicitly define the union member,
Inspect displays the first member.
This examples show how to display union members, using the C declaration:
union u_tag {
int ival;
float fval;
char *pval;
} uval;
-COBJ-DISPLAY s
S =
WORD = the value of word
LEFT = pointer value
RIGHT = pointer value
-COBJ-DISPLAY *sp
WORD = value of word
LEFT = pointer value
RIGHT = pointer value