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 may need to read from or to write to the OpenMP program. It cannot do this directly. Instead the OMPD library must use callbacks that the tool provides so that the tool performs the operation.
SummaryThe ompd_callback_symbol_addr_fn_t type is the type signature of the callback that the tool provides to look up the addresses of symbols in an OpenMP program.
DescriptionThe ompd_callback_symbol_addr_fn_t is the type signature of the symbol-address query callback routine that the tool provides. This callback looks up addresses of symbols within a specified address space.
Description of ArgumentsThis callback looks up the symbol provided in the symbol_name argument. The address_space_context argument is the tool’s representation of the address space of the process, core file, or device.
The thread_context argument is NULL for global memory access. 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. If thread_context is non-null then 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 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 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 tool. If file_name is NULL then the tool first tries to find the symbol in the executable file, and, if the symbol is not found, the 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 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 tool then uses the same procedure as when file_name is NULL.
The callback does not support finding 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 symbol’s address in the location to which symbol_addr points.
RestrictionsRoutines that use the ompd_callback_symbol_addr_fn_t type have the following restrictions:
SummaryThe ompd_callback_memory_read_fn_t type is the type signature of the callback that the tool provides to read data from an OpenMP program.
DescriptionThe ompd_callback_memory_read_fn_t is the type signature of the read callback routines that the tool provides. The read_memory callback copies a block of data from addr within the address space to the tool buffer.
The read_string callback copies a string to which addr points, including the terminating null byte (’\0’), to the 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 ArgumentsThe address from which the data are to be read from the OpenMP program specified by address_space_context is given by addr. while nbytes gives the number of bytes to be transferred. The thread_context argument is optional for global memory access, and in this 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 on page 1534) to interpret the data.
SummaryThe ompd_callback_memory_write_fn_t type is the type signature of the callback that the tool provides to write data to an OpenMP program.
DescriptionThe ompd_callback_memory_write_fn_t is the type signature of the write callback routine that the tool provides. The OMPD library may call this callback to have the tool write a block of data to a location within an address space from a provided buffer.
Description of ArgumentsThe 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 this 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 on page 1534) to render the data into a form that is compatible with the OpenMP runtime.