EXAMINE

Examine the contents of a variable

WSupported on Windows
USupported on Unix
VSupported on OpenVMS

 

EXAMINE [/PAGE] variable [/X] [display_option] [object_option] [variable ...]
EXAMINE [/PAGE] /OBJECT_ID object_id [object_option] [object_id ...]
EXAMINE [/PAGE] /STATIC class_name [class_name ...]

Arguments

/PAGE

(optional) Stops the output every 24 lines and waits for input (CR to get the next page and <EOF> to terminate input). On Windows, the output will vary based on the values of DBG_HEIGHT and DBG_WIDTH. (/PAGE can alternatively be placed at the end of the line.)

variable

A variable specification whose contents will be displayed. See Specifying variables for more information about variable specifications. Variable can also be a ^M(struct_fld, handle) specification.

display_option

(optional) These qualifiers display the contents of the variable as the specified data type.

/[n]I[size]

Integer or integer of length size, where size is 1, 2, 4, or 8 and n is the number of I[size] fields.

/Dsize[.prec]

Decimal or implied-decimal of size bytes and the specified precision.

/Asize

Alphanumeric of size bytes.

/HEX or /H

Hexadecimal. (This does not apply to handles.)

object_option

(optional) One or more of the following options:

/INFORMATION

Display detailed information.

/LINES

Display the first referencing source line.

/REFERENCES

Display all other references to the object.

/SCOPE

Display all accessed (active) handles within the object’s scope. (This does not apply to object IDs, only handles.)

/OBJECT_ID object_id

Specifies an object identifier obtained from the SHOW CLASSES /OBJECTS command.

/STATIC class_name

Display all static fields within the specified class name path.

Discussion

The EXAMINE command displays the contents of a variable, object, or class, depending on which syntax is used. You can specify more than one variable, object, or class by separating them (along with their options) with commas or spaces.

Depending on what is being examined, the debugger displays the name of each “outer” field in the record, group, or structure, along with its data type, size, and contents. For example, if rec is examined below, the fields rfld1, grp, and rfld2 will be displayed. None of the fields inside grp (fld1, fld2, or fld3) will be displayed.

record rec
    rfld1       ,a4
    group grp
        fld1    ,a4
        fld2    ,a4
        fld3    ,a4
    endgroup
    rfld2       ,a4

For records, groups, structures, and object instances, any arrayed fields display the data for each element of the array. Any group fields display the data in the format of the data type of the group. If variable is an object instance, the debugger displays each field in the object instance with its data. The class name is displayed first, followed by the data in alpha format if an object has been instantiated, or the word “^NULL” if an object has not been instantiated.

Unnamed fields will not be displayed.

If you examine a variable whose contents are longer than one line (80 characters), the variable’s contents are displayed on multiple lines. Any nonprinting characters are displayed as periods (.). On Windows, the output will vary based on the values of DBG_HEIGHT and DBG_WIDTH.

An array list is an array of System.Object, and since every object inherits from System.Object, an array list can hold any type of object. When an array list variable is examined, the count and capacity are displayed. When an array list cell is examined, the class of the object is displayed along with the object value(s). To examine the elements of the contents of an array list, you must cast the array list variable to the correct class of the array list cell contents, because the object’s fields are not members of the array list. Only one cast is permitted per EXAMINE command, but the object path can be enclosed in parentheses to clarify the object being cast. (See Examples for an example of examining an array list variable.)

To examine an argument, use

@-argnum

Arguments are displayed as their passed data type unless overridden.

When specified in conjunction with an object variable, the /INFORMATION option displays the following information about the specified object variable:

When specified in conjunction with an object_id, the /INFORMATION option displays the following information about the specified object:

Examples

The following example displays the contents of the variable ab.

EXAMINE ab

Given the following definition:

class c1
    c1_fld1     ,a4
    c1_fld2     ,a4
    c1_fld3     ,a4
endclass
class c2
    record crec
        c2_fld1         ,a4
        c2_fld2         ,a4
        c2_fld3         ,a4
endclass
record
        hnd1    ,@c1
        hnd2    ,@c2

The command

DBG> examine hnd1

displays the fields c1_fld1, c1_fld2, and c1_fld3, while

DBG> examine hnd2

displays only crec.

The example below examines an object ID.

DBG> examine /object_id 1
  Object id 1, class objid.car, refs 1
DBG> examine /object_id 1 /REFERENCES
  Object id 1, class objid.car, refs 1
  Other referencing handles:
    Handle id 2, class objid.car
DBG> examine /object_id 1 /LINES
  Object id 1, class objid.car, refs 1, def at line 45 in CD_MAIN (exam_objid.dbl)
DBG> examine /object_id 1 /INFORMATION
  Object id 1, class objid.car, refs 1

The example below examines an object variable.

DBG> examine ford
cartyp, a22, "Mustang b...0400000000"
price, d6.2, 8800.00
limit, i4, 600
DBG> examine ford /lines
  Handle id 2, class objid.car, set at line 45 in CD_MAIN (exam_objid.dbl)
   Object id 1, class objid.car, refs 1, def at line 45 in CD_MAIN (exam_objid.dbl)
DBG> examine ford /ref
  Handle id 2, class objid.car
   Object id 1, class objid.car, refs 1
DBG> examine ford /scope
  Handle id 2, class objid.car
   Object id 1, class objid.car, refs 1
   No active handles within object’s scope
DBG> examine ford /info
  Handle id 2, class objid.car
   Object id 1, class objid.car, refs 1

The example below examines an array list variable.

DBG> examine m_collection
  <system.collections.arraylist>
    Count = 2, Capacity = 16
DBG> examine m_collection[0]
  <testing.leaf>
     m_value, @system.string, "Value 1"
DBG> examine (testing.leaf)(m_collection[0]).m_value 
  "Value 1"