Dynamic Probe Class Library

DPCL Class Reference


Chapter 14. Class ProbeType

Objects of the ProbeType class represent the data type of an object within a target application process. This data type may refer to an application object (that is, it may be part of the target application), or it may refer to a probe object (an object allocated by the analysis tool for use in a probe). Member functions of this class enable the analysis tool to:


Supporting data types

DataExpNodeType

Description

Values of type ProbeType are expression trees that represent the data type of an object within an application process. The object may be an application object (part of the application program), or it may be a probe object (an object allocated and used by the instrumentation system). This data structure reflects all of the possible enumeration values used by the expression tree to represent the data type of the object. It is a combination of the enumeration value of each node, and the placement of nodes within the tree, that describes the data type of the object.

The following are members of the enumerated type of ProbeType. Refer to DPCL Programming Guide for a full description of each status code.

Table 13. ProbeType Enumeration Types
Enumeration Type Description
DEN_actual_param_type actual parameter
DEN_default_type default constructor type
DEN_error_type result of failed operation
DEN_float32_type float32 type decl
DEN_float64_type float64 type decl
DEN_function_type user-defined function
DEN_int16_type int16 type declaration
DEN_int32_type int32 type declaration
DEN_int64_type int64 type declaration
DEN_int8_type int8 type declaration
DEN_pointer_type pointer type exp -- * x
DEN_reference_type reference type -- & x
DEN_uint16_type uint16 type declaration
DEN_uint32_type uint32 type declaration
DEN_uint64_type uint64 type declaration
DEN_uint8_type uint8 type declaration
DEN_unspecified_type has size but no structure
DEN_void_type void data type

Constructors

Synopsis

#include <ProbeType.h>
ProbeType(void);

Description

The default constructor creates an object with data type of DEN_default_type.

child

Synopsis

#include <ProbeType.h>
ProbeType child(int index) const;

Parameters

index
index of the sub-type, which must be greater than or equal to zero, and less than child_count()

Description

Returns the sub-type of a data type. For example, if the invoking object represents a pointer to an object, child(0) returns the data type of the pointee. For data types representing functions, child(0) returns the data type of the return value, child(1) returns the data type of the first argument, if any, child(2) returns the data type of the second argument, if any, etc. If the index is less than 0 or greater than or equal to child_count(), a data type of DEN_error_type is returned.

Return Values

Returns the data type of the indicated sub-type or an undefined data type.

See Also

child_count

child_count

Synopsis

#include <ProbeType.h>
int child_count(void) const;

Description

Returns the number of sub-types associated with this data type. Undefined data types, created by the default constructor, return 0. Children can be the data type of a pointee, function return types, function argument data types, and so on.

Return Values

Returns the number of child sub-types associated with this data type.

See Also

child

function_type

Synopsis

#include <ProbeType.h>
friend ProbeType function_type(
     ProbeType return_type,
     int count,
     ProbeType *argv);

Parameters

return_type
data type of the function return value

count
number of function arguments

args
array of argument data types

Description

Creates a data type that represents the prototype or type signature of a function.

Exceptions

ASC_bad_ret
return value specified is not of type DEN_pointer_type, DEN_int32_type, or DEN_void_type.

ASC_bad_arg
argument is not of type DEN_pointer_type or DEN_int32_type.

Return Values

Returns the data type that represents the prototype of a function.

See Also

get_actual

get_actual

Synopsis

#include <ProbeType.h>
ProbeExp get_actual (int index)

Parameters

index
index of the parameter value to be used

Description

When the invoking object represents a function prototype (created by using function_type or obtained from a function in the application's source tree), this function returns a probe expression that represents the value of the ith parameter of a function being called. The context for this actual parameter is determined by the location at which a probe expression, containing this actual parameter, is installed in the application program. As a result, probe expressions that contain actual parameters can be installed only at instrumentation points with type IPT_function_call and location IPL_before, or type IPT_function_entry. An attempt to install a probe expression that contains an actual parameter at any other kind of instrumentation point will fail.

The index parameter must be within the bounds determined by the ProbeType object. For example, if the function prototype defines a function with two arguments, then the index can only have the value 0 or 1.

DPCL allows only 32-bit integer parameters and pointer-valued parameters to be accessed through the get_actual mechanism.

Return Values

Returns a probe expression representing the value of a function parameter.

Exceptions

ASC_bad_index_value
index value is out of range

ASC_bad_parameter_type
prototype contains an unsupported data type

ASC_PT_func_proto
invoking object is not of type DEN_function_type

ASC_proto_few_par
index of actual parameter being sought is greater than the number of parameters defined in the prototype object

ASC_bad_ret
return type of the prototype object is not of type DEN_pointer_type, DEN_int32_type, or DEN_void_type

ASC_bad_arg
argument of the prototype object is not of type DEN_pointer_type or DEN_int32_type

See Also

function_type, ProbeExp::get_data_type, SourceObj::reference,

get_node_type

Synopsis

#include <ProbeType.h>
DataExpNodeType get_node_type(void) const;

Description

Returns the enumeration value, or node type, of this node in the data type expression tree.

Return Values

Returns the node type of this node in the data type expression tree.

See Also

SourceObj::get_data_type

Also, see the table of enumeration types in DataExpNodeType.

int32_type

Synopsis

#include <ProbeType.h>
friend ProbeType int32_type(void);

Description

Creates an object that represents a 32-bit integer data type.

Return Values

Returns the data type that represents a 32-bit integer.

See Also

Application::alloc_mem, Application::balloc_mem, Application::function_type, Application::pointer_type, Application::unspecified_type, Application::void_type, Process::alloc_mem, Process::balloc_mem

operator =

Synopsis

#include <ProbeType.h>
ProbeType &operator = (const ProbeType &copy);

Parameters

copy
probe type to be duplicated

Description

Copies the contents of the copy parameter to the invoking object.

Return Values

Returns a reference to the object.

operator ==

Synopsis

#include <ProbeType.h>
int operator == (const ProbeType &compare);

Parameters

compare
probe type to be compared

Description

Compares two probe types for equivalence. If the two data types are equivalent, this function returns 1. Otherwise it returns 0.

Return Values

Returns 1 if the two data types are equivalent. Otherwise, it returns 0.

operator !=

Synopsis

#include <ProbeType.h>
int operator != (const ProbeType &compare);

Parameters

compare
probe type to be compared

Description

Compares two probe types for equivalence. If the two data types are equivalent, this function returns 0. Otherwise it returns 1.

Return Values

Returns 0 if the two types are equivalent. Otherwise, it returns 1.

pointer_type

Synopsis

#include <ProbeType.h>
friend ProbeType pointer_type(const ProbeType &pointee);

Parameters

pointee
data type to which the pointer points

Description

Creates an object that represents the data type of a pointer to a pointee.

Return Values

Returns the data type that represents a pointer to a pointee.

See Also

Application::alloc_mem, Application::balloc_mem, function_type, int32_type, Process::alloc_mem, Process_balloc_mem, unspecified_type, void_type

unspecified_type

Synopsis

#include <ProbeType.h>
friend ProbeType unspecified_type(int size);

Parameters

size
number of bytes this data type requires

Description

Creates an object that represents an unspecified data type, and has a type value of DEN_unspecified_type. The data type must be given a size greater than 0.

Return Values

Returns the data type that represents an unspecified data type.

See Also

Application::alloc_mem, Application::balloc_mem, function_type, int32_type, pointer_type, Process::alloc_mem, Process_balloc_mem, void_type

void_type

Synopsis

#include <ProbeType.h>
friend ProbeType void_type(void);

Description

Creates an object that represents a void data type. The void data type can only be used when specifying the return type of a function prototype, or as the base type of a pointer data type.

Return Values

Returns the data type that represents a void.

See Also

Application::alloc_mem, Application::balloc_mem, function_type, int32_type, pointer_type, Process::alloc_mem, Process_balloc_mem, unspecified_type


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]