Dynamic Probe Class Library

DPCL Class Reference


Chapter 13. Class ProbeModule

Objects of the ProbeModule class represent probe modules to be loaded into one or more target application processes. Member functions of this class enable an analysis tool to:

Under UNIX, you can write a ProbeModule using C language (neither C++ nor Fortran are not supported). The source file needs to be compiled and only those exported functions are visible from the ProbeModule. In other words, those function names are put in an export file, which is then specified as an argument to the linker's -bE flag.

The export file contains a list of the function names to be exported. You can exclude a function from the list by placing an asterisk (*) in column one on that function's line. An export file would look similar to this:

function_1
function_2

A template for building the export file was installed on your system with PE. It is located in /usr/lpp/ppe.dpcl/samples/probe_module/module.exp

The import file contains a list of the function names to be exported. If the probe module contains the prelinked function Ais_send, then the import file must also contain an entry for Ais_send. You will also need to tell the linker that this function is located in the application. You do this by placing #! . on the first line of the file. An import file would look similar to this:

#! .
Ais_send

A template for building the import file was installed on your system with PE. It is located in /usr/lpp/ppe.dpcl/samples/probe_module/module.imp

The makefile is used to build the load module, using the import and export files. Note that there is no entry point in the load module. A compile command would look similar to this:

cc -o ..... -bE:export_file -bI:import_file -bnoentry

A template for building the makefile was installed on your system with PE. It is located in /usr/lpp/ppe.dpcl/samples/probe_module/Makefile.module

Constructors

Synopsis

#include <ProbeModule.h>
ProbeModule(void);
ProbeModule(const ProbeModule &copy);
ProbeModule(const char *filename);

Parameters

copy
probe module that is duplicated in a copy constructor

filename
name and path of an object file that contains functions to be loaded into the application process

Description

The default constructor creates an empty probe module structure (a structure that contains no objects). The default constructor is invoked when uninitialized probe modules are created, such as in arrays. Objects within the array can be overwritten using an assignment operator (operator =).

The copy constructor is used to transfer the contents of an initialized object (the copy parameter) to an uninitialized object.

The standard constructor reads the object file that contains functions to be loaded into the application process. It reads the file to determine what functions are available and the data type signature of each.

If you create two objects, derived from the same object file, the result will be two unique instances. Calling bload_module with these two objects results in two copies of the same object module being loaded.

Exceptions

ASC_insufficient_memory
a memory allocation routine failed. Insufficient memory to create a new node.

ASC_module_invalid
invalid probe module file

ASC_module_not_found
file representing the probe module cannot be opened

See Also

bload_module, bunload_module, load_module, operator =, unload_module

get_count

Synopsis

#include <ProbeModule.h>
int get_count(void) const;

Description

Returns the number of exported functions in the module. If the module was initialized by a default constructor, or its value was copied from a default constructor, this function returns 0.

Return Values

Returns the number of functions in the module, or 0 if the module was initialized by a default constructor.

See Also

get_name, get_reference

get_name

Synopsis

#include <ProbeModule.h>
char *get_name(
    int index,
    char *buffer,
    unsigned int len) const;

Parameters

index
index of the desired function, equal to or greater than 0, and less than get_count()

buffer
caller-allocated buffer that holds the module name

len
maximum number of bytes the function places in buffer. The len parameter should include enough space for a null-terminating byte.

Description

This function copies into buffer a null-terminated character string representing the name of the desired function. The name may be truncated if the len parameter is smaller than the length of the name. If the index is out of range, that is, if it is less than 0 or equal to or greater than get_count(), it returns 0.

Return Values

Returns a pointer to buffer, which contains, at most, len bytes of the name of the desired function, or 0 if the index is out of range.

See Also

get_count, get_name_length

get_name_length

Synopsis

#include <ProbeModule.h>
unsigned int get_name_length(int index) const;

Parameters

index
index of the desired function, equal to or greater than zero, and less than get_count()

Description

Returns the length, including the null-terminating byte, of the (mangled) name of the desired function. If the index is out of range, in other words, if it is less than 0 or equal to or greater than get_count(), it returns 0.

Return Values

Returns the length of the name of the desired function, or 0 if the index is out of range.

See Also

get_name

get_reference

Synopsis

#include <ProbeModule.h>
ProbeExp get_reference (int index) const;

Parameters

index
index of the desired function, equal to or greater than 0, and less than get_count()

Description

Returns a probe expression that represents a reference to the desired function. The probe expression may be used to form a call to that function. If the index is out of range, in other words, if it is less than 0 or equal to or greater than get_count(), it returns an undefined probe expression.

Return Values

Returns a probe expression that represents a reference to the desired function, or undefined if the index is out of range.

See Also

Application::bload_module, Application::load_module, ProbeExp::call, ProbeExp::get_count, Process::bload_module

operator =

Synopsis

#include <ProbeModule.h>
ProbeModule &operator = (const ProbeModule &rhs);

Parameters

rhs
right operand

Description

Assigns the value of the right operand to the invoking object. The left operand is the invoking object.

For example,

ProbeModule rhs, lhs; ... lhs = rhs;

assigns the value of rhs to lhs. Both values would then refer to the same ProbeModule.

Return Values

Returns a reference to the invoking object (the left operand).

operator ==

Synopsis

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

Parameters

compare
probe module to be compared against the invoking object

Description

Compares two probe modules for equivalence. If the two objects represent the same probe module, this function returns 1. Otherwise it returns 0.

Return Values

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

operator !=

Synopsis

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

Parameters

compare
probe module to be compared against the invoking object

Description

Compares two probe modules for equivalence. If the two objects represent the same probe module, this function returns 0. Otherwise it returns 1.

Return Values

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


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