Description

The dlmodadd routine registers information about a dynamically-generated function, which can be retrieved through the dlmodinfo routine. The dlmodremove interface can be used to remove the registered information.

When dlmodadd is invoked to register information about a dynamically-generated function, the dynamic loader creates an unwind header and a single-entry unwind table for the function. The unwind header is associated with the address range occupied by the dynamically-generated function. The dlmodadd() routine returns a handle as identification of the newly-added function. Handles returned by dlmodadd() share the same namespace as handles returned by dlopen() and dlget(), but they may not be used in calls to dlclose(). A handle returned by dlmodadd() is treated by dlsym() as if the associated handle had been used instead. If dlmodinfo() is called with an ip_value that belongs to a function that has been registered with dlmodadd(), it returns the handle of the dynamically-generated function, as originally returned by dlmodadd(), along with a load_module_desc structure describing the function. A load_module_desc for a dynamically-generated function always has a 0 value in the phdr_base field.

The text_base, text_size, data_base, and data_sizefields may be used for converting segment-relative offsets to virtual addresses, but they may not be relied on to identify a range of memory belonging exclusively to the function. The unwind_base field will contain the address of the unwind header built for the function. If a library is unloaded by dlclose(), the unwind info for all dynamically-generated functions associated with the library being unloaded will also be removed.

The dlmodremove Routine

The dlmodremove removes information registered using dlmodadd.

Syntax

 

int dlmodremove(void* handle);

Table 32 Parameters

Parameter

Definition

handle

Value returned by a previous invocation of dlmodremove.

Return Values

The dlmodremove routine returns 0 on success. If handle does not refer to a valid handle, dlmodremove returns a non-0 value.

Description

The dlmodremove routine removes the registered information of individual dynamically-generated functions. It removes the registration of the indicated function and frees the space used by the unwind header and unwind table created by dlmodadd(). It does not free the space used by the unwind info block or by the generated code, which was allocated by the user and must be freed by the user.

The dlgetmodinfo Routine

The dlgetmodinfo retrieves information about a loaded module (program or shared library).

Syntax

uint64_t dlgetmodinfo(int index,

struct load_module_desc *desc, size_t desc_size,

166 Shared Library Management Routines

Page 166
Image 166
HP UX Software Transition Kit (STK) manual Dlmodremove Routine, Dlgetmodinfo Routine