1.DBG> EXAMINE COUNT
SUB2\COUNT: 27
DBG>
This command displays the value of the integer variable COUNT
in module SUB2.
2.DBG> EXAMINE PART_NUMBER
INVENTORY\PART_NUMBER: "LP-3592.6-84"
DBG>
This command displays the value of the string variable PART_
NUMBER.
3.DBG> EXAMINE SUB1\ARR3
SUB1\ARR3
(1,1): 27.01000
(1,2): 31.01000
(1,3): 12.48000
(2,1): 15.08000
(2,2): 22.30000
(2,3): 18.73000
DBG>
This command displays the value of all elements in array ARR3
in module SUB1. ARR3 is a 2 by 3 element array of real numbers.
4.DBG> EXAMINE SUB1\ARR3(2,1:3)
SUB1\ARR3
(2,1): 15.08000
(2,2): 22.30000
(2,3): 18.73000
DBG>
This command displays the value of the elements in a slice of
array SUB1\ARR3. The slice includes "columns" 1 to 3 of "row"
2.
5.DBG> EXAMINE VALVES.INTAKE.STATUS
MONITOR\VALVES.INTAKE.STATUS: OFF
DBG>
This command displays the value of the nested record component
VALVES.INTAKE.STATUS in module MONITOR.
6.DBG> EXAMINE/SOURCE SWAP
module MAIN
47: procedure SWAP(X,Y: in out INTEGER) is
DBG>
This command displays the source line in which routine SWAP is
declared (the location of routine SWAP).
7.DBG> EXAMINE /VARIANT=(NAME=m,DIS=4,POS=1) x
This command specifies that, for the first anonymous variant
list encountered, display the variant part containing a field
named "m", for the second anonymous variant list, display
the part with the discriminant value 4, and, for the third
anonymous variant list, display the first variant part.
8.DBG> ex %r9:%r12
TEST\%R9: 0000000000000000
TEST\%R10: 0000000000000000
TEST\%R11: 0000000000000000
TEST\%SP: 000000007AC8FB70
DBG> ex/bin grnat0 <9,4,0>
TEST\%GRNAT0+1: 0110
DBG>
Debugger displays the string "NaT" when the integer register's
NaT bit is set.
9.Use /EXPAND to EXAMINE certain complex structures as below:
typedef struct _A{
int i;
struct {
int j;
int k;
struct _A *p;
} ST;
}A;
void main()
{
A a1,a2;
a1.i = 10;
a1.ST.j=11;
a1.ST.k=12;
a1.ST.p=0;
a2.i = 210;
a2.ST.j=211;
a2.ST.k=212;
a2.ST.p=&a1;
}
The EXAMINE command displays the following output for the above
example.
DBG> EXAMINE a2
TEST\main\a2
i: 210
ST
j: 211
k: 212
p: 2060327712
DBG> EXAMINE *a2.ST.p
*TEST\main\a2.ST.p
i: 10
ST: 51539607563 [cycle found in type definitions]
EXAMINE command does not expand the pointer ST.
Similar behavior happens for unions too.
The EXAMINE/EXPAND command displays the following output:
DBG> EXAMINE/EXPAND *a2.ST.p
%DEBUG-I-EXAMEXPAND, Use examine/expand with caution
*TEST\main\a2.ST.p
i: 10
ST
j: 11
k: 12
p: 0
DBG>
Note: In case of genuine loops in the structure, the EXAMINE/EXPAND
behavior is undefined. The debugger can go into an infinite loop and
in such cases, the use of EXAMINE/EXPAND must be avoided. An example for
this case is given below.
$ type a.cxx
struct B;
struct A {
B &x;
A( B &x );
};
struct B {
A y;
B();
};
A::A( B &xx ) : x(xx) {}
B::B( ) : y( *this ) {}
B b;
void main() {
B b1;
A a1(b1);
}
The EXAMINE/EXPAND command displays the following output:
DBG> EXAMINE/EXPAND *a2.ST.p
%DEBUG-I-EXAMEXPAND, Use examine/expand with caution
*TEST\main\a2.ST.p
i: 10
ST
j: 11
k: 12
p: 0
DBG>
Note: In case of genuine loops in the structure, the EXAMINE/EXPAND
behavior is undefined. The debugger can go into an infinite loop and
in such cases, the use of EXAMINE/EXPAND must be avoided. An example for
this case is given below.
$ type a.cxx
struct B;
struct A {
B &x;
A( B &x );
};
struct B {
A y;
B();
};
A::A( B &xx ) : x(xx) {}
B::B( ) : y( *this ) {}
B b;
void main() {
B b1;
A a1(b1);
}