typedef ompd_rc_t (*ompd_callback_symbol_addr_fn_t) (
ompd_address_space_context_t *address_space_context,
ompd_thread_context_t *thread_context,
const char *symbol_name,
ompd_address_t *symbol_addr,
const char *file_name
);
The OMPD library cannot directly read from or write to memory of the OpenMP program. Instead the OMPD library must use callbacks that the third-party tool provides so that the third-party tool performs the operation.
Summary The ompd_callback_symbol_addr_fn_t type is the type signature of the callback that the third-party tool provides to look up the addresses of symbols in an OpenMP program.
Description The ompd_callback_symbol_addr_fn_t is the type signature of the symbol-address query callback routine that the third-party tool provides. This callback looks up addresses of symbols within a specified address space.
Description of Arguments This callback looks up the symbol provided in the symbol_name argument.
The address_space_context argument is the third-party tool’s representation of the address space of the process, core file, or device.
The thread_context argument is NULL for global memory accesses. If thread_context is not NULL, thread_context gives the thread-specific context for the symbol lookup for the purpose of calculating thread local storage addresses. In this case, the thread to which thread_context refers must be associated with either the process or the device that corresponds to the address_space_context argument.
The third-party tool uses the symbol_name argument that the OMPD library supplies verbatim. In particular, no name mangling, demangling or other transformations are performed prior to the lookup. The symbol_name parameter must correspond to a statically allocated symbol within the specified address space. The symbol can correspond to any type of object, such as a variable, thread local storage variable, function, or untyped label. The symbol can have a local, global, or weak binding.
The file_name argument is an optional input parameter that indicates the name of the shared library in which the symbol is defined, and it is intended to help the third-party tool disambiguate symbols that are defined multiple times across the executable or shared library files. The shared library name may not be an exact match for the name seen by the third-party tool. If file_name is NULL then the third-party tool first tries to find the symbol in the executable file, and, if the symbol is not found, the third-party tool tries to find the symbol in the shared libraries in the order in which the shared libraries are loaded into the address space. If file_name is non-null then the third-party tool first tries to find the symbol in the libraries that match the name in the file_name argument, and, if the symbol is not found, the third-party tool then uses the same procedure as when file_name is NULL.
The callback does not support finding either symbols that are dynamically allocated on the call stack or statically allocated symbols that are defined within the scope of a function or subroutine.
The callback returns the address of the symbol in the location to which symbol_addr points.
Description of Return Codes In addition to the general return codes listed at the beginning of Section 5.4, routines that use the ompd_callback_symbol_addr_fn_t type may also return the following return codes:
Restrictions Restrictions on routines that use the ompd_callback_symbol_addr_fn_t type are as follows:
Summary The ompd_callback_memory_read_fn_t type is the type signature of the callback that the third-party tool provides to read data (read_memory) or a string (read_string) from an OpenMP program.
Description The ompd_callback_memory_read_fn_t is the type signature of the read callback routines that the third-party tool provides.
The read_memory callback copies a block of data from addr within the address space given by address_space_context to the third-party tool buffer.
The read_string callback copies a string to which addr points, including the terminating null byte (’\0’), to the third-party tool buffer. At most nbytes bytes are copied. If a null byte is not among the first nbytes bytes, the string placed in buffer is not null-terminated.
Description of Arguments The address from which the data are to be read in the OpenMP program that address_space_context specifies is given by addr. The nbytes argument is the number of bytes to be transferred. The thread_context argument is optional for global memory access, and in that case should be NULL. If it is non-null, thread_context identifies the thread-specific context for the memory access for the purpose of accessing thread local storage.
The data are returned through buffer, which is allocated and owned by the OMPD library. The contents of the buffer are unstructured, raw bytes. The OMPD library must arrange for any transformations such as byte-swapping that may be necessary (see Section 5.4.4) to interpret the data.
Description of Return Codes In addition to the general return codes listed at the beginning of Section 5.4, routines that use the ompd_callback_memory_read_fn_t type may also return the following return codes:
Summary The ompd_callback_memory_write_fn_t type is the type signature of the callback that the third-party tool provides to write data to an OpenMP program.
Description The ompd_callback_memory_write_fn_t is the type signature of the write callback routine that the third-party tool provides. The OMPD library may call this callback to have the third-party tool write a block of data to a location within an address space from a provided buffer.
Description of Arguments The address to which the data are to be written in the OpenMP program that address_space_context specifies is given by addr. The nbytes argument is the number of bytes to be transferred. The thread_context argument is optional for global memory access, and in that case should be NULL. If it is non-null then thread_context identifies the thread-specific context for the memory access for the purpose of accessing thread local storage.
The data to be written are passed through buffer, which is allocated and owned by the OMPD library. The contents of the buffer are unstructured, raw bytes. The OMPD library must arrange for any transformations such as byte-swapping that may be necessary (see Section 5.4.4) to render the data into a form that is compatible with the OpenMP runtime.
Description of Return Codes Routines that use the ompd_callback_memory_write_fn_t type may return the general return codes listed at the beginning of Section 5.4.