Statically allocated arrays
Consider the following declaration.
This sequence shows how you might inspect the object: struct point
{
char *name;
int coord[3];
} Set[] = {
{"one", {1,1,1}},
{"two", {2,2,2}},
{"three", {3,3,3}},
{"four", {4,4,4}},
{"five", {5,5,5}},
{"six", {6,6,6}},
};
Set: array
Set: { point point point point ... }
Set: 0: point
1: point
2: point
3: point
...
Set: 0: { ptr array }
1: { ptr array }
2: { ptr array }
3: { ptr array }
...
Set: 0: { ptr array }
1: name: ptr
coord: array
2: { ptr array }
3: { ptr array }
...
Set: 0: { ptr array }
1: name: ptr
coord: { 2 2 2 }
2: { ptr array }
3: { ptr array }
...
Dynamically
allocated arrays
In the previous section, the array dimensions were defined at compile time and known to the debugger. But for arrays with runtime defined dimensions, the outer array dimension is unknown to Xcdb, so it assumes a value of 1 until you tell it otherwise. Consider the following declaration:
To format main()
{
char **stuff = malloc(3 * sizeof(char *));
stuff[0] = "abc";
stuff[1] = "def";
stuff[2] = "ghi";
return 0;
}
stuff
as an array of character pointers, step the program until the array has been completely initialized, and then:
stuff: ->->0x61
stuff: ->"abc"
stuff: { "abc" "def" NULL }
stuff: 0: "abc"
1: "def"
2: "ghi"
Subrange selection
Select specific subranges of array elements by clicking on the array and choosing Select
subrange
from the menu. Then, type the subscript or range of subscripts of the element(s) you wish to see. Use an expression of the form:
The count of subrangeSpecifier ::= sectionSpecifier { ',' sectionSpecifier }...
sectionSpecifier ::= '[' subdimensionSpecifier { ',' subdimensionSpecifier }... ']'
subdimensionSpecifier ::= lo '..' hi// subdim elements between lo and hi, inclusive
| lo '..' '*'// all elements of subdimension, starting at 'lo'
| '*' '..' hi// all elements of subdimension, ending at 'hi'
| '*' '..' '*'// all elements of subdimension
| '*' // all elements of subdimension
| n // nth element of subdimension
subdimensionSpecifier
items must match the count of array dimensions. Here are some examples:
If a subrange specifier would display more than 1,000 elements, then the remainder would display as "...". Change this limit by specifying a different value using - char array[4][2]; // a 4 by 2 array
[0, *] // matches elements: [0,0]
[0,1]
[1..2, 1], [ 3, 0..1] // matches elements: [1,1]
[2,1]
[3,0]
[3,1]
e
or the xcdb.ArrayLimits
item in .Xdefaults
.
[Contents]
[Previous]
[Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.