Totalview® Reference Guide : PART I CLI Commands : Chapter 2 CLI Commands : ddlopen
ddlopen
Dynamically loads shared object libraries
Format 
Dynamically loads a shared object library
ddlopen [ -now | -lazy ] [ -local | -global ] [ -mode int ] filespec
Displays information about shared object libraries
ddlopen [ -list { dll-ids...} ]
Arguments 
-now
Includes RTLD_NOW in the dlopen command’s mode argument. (Now immediately resolves all undefined symbols.)
-lazy
Includes RTLD_LAZY in the dlopen command’s mode argument. (Lazy tries to resolve unresolved symbols as code is executed, rather than now.)
-local
Includes RTLD_GLOBAL in the dlopen command’s mode argument. (Local makes library symbols unavailable to libraries that the program subsequently loads.) This argument is the default.
-global
Includes RTLD_LOCAL in the dlopen command’s mode argument. (Global makes library symbols available to libraries that the program subsequently loads.)
-mode int
The integer arguments are ORed into the other mode flags passed to the dlopen() function. (See your operating system’s documentation for information on these flags.)
filespec
The shared library to load.
-list
Displays information about the listed DLL IDs. If you omit this option or use the -list without a DLL ID list, TotalView displays information about all DLL IDs.
dll-ids
A list of one or more DLL IDs.
Description 
The ddlopen command dynamically loads shared object libraries, or lists the shared object libraries loaded using this or the Tools > Dynamic Libraries command.
For a filespec argument, TotalView performs a dlopen operation on this file in each process in the current P/T set. On the IBM AIX operating system, you can add a parenthesized library module name to the end of the filespec argument.
NOTE >> dlopen(3), dlerror(3), and other related routines are not part of the default runtime libraries on AIX, Solaris, and Red Hat Linux. Instead, they are in the libdl system library. Consequently, you must link your program using the -ldl option if you want to use the ddlopen command.
The -now and -lazy options indicate whether dlopen immediately resolves unresolved symbol references or defers resolving them until the target program references them. If you don’t use either option, TotalView uses your operating system’s default. (Not all platforms support both alternatives. For example, AIX treats RTLD_LAZY the same as RTLD_NOW).
The -local and -global options determine if symbols from the newly loaded library are available to resolve references. If you don’t use either option, TotalView uses the target operating system's default. (Linux supports only the -global option; if you don’t specify an option, the default is the -local option.)
After entering this command, the CLI waits until all dlopen calls complete across the current focus. The CLI then returns a unique dll-id and displays its prompt, which means that you can enter additional CLI commands. However, if an event occurs (for example, a $stop, a breakpoint in user function called by static object constructors, a SEGV, and so on), the ddlopen command throws an exception that describes the event. The first exception subcode in the errorCode variable is the DLL ID for the suspended dlopen() function call.
If an error occurs while executing the dlopen() function, TotalView calls the dlerror() function in the target process, and then prints the returned string.
A DLL ID describes a shareable object that was dynamically loaded by the ddlopen command. Use the TV:dll command to obtain information about and delete these objects. If all dlopen() calls return immediately, the ddlopen command returns a unique DLL ID that you can also use with the TV::dll command.
Every DLL ID is also a valid breakpoint ID, representing the expressions used to load and unload DLLs; you can manipulate these breakpoints using the TV::expr command.
If you do not use a filespec argument or if you use the -list option without using a DLL ID argument, TotalView prints information about objects loaded using ddlopen. If you do use a DLL ID argument, TotalView prints information about DLLs loaded into all processes in the focus set; otherwise, TotalView prints information about just those DLLs. The ddlopen command prints its output directly to the console.
The ddlopen command calls the dlopen() function and it can change the string returned by the dlerror() function. It can also change the values returned to the application by any subsequent dlerror() call.
Examples 
ddlopen "mpistat.so"
Loads mpistat.so library file. The returned argument lists the process into which TotalView loaded the library.
dfocus g ddlopen "mpistat.so(mpistat.o)"
Loads the module mpistat.o in the AIX DLL library mpistat.so into all members of the current process’s control group.
ddlopen -lazy -global "mpistat.so"
Loads mpistat.so into process 1, and does not resolve outstanding application symbol requests to point to mpistat. However, TotalView uses the symbols in this library if it needs them.
ddlopen
Prints the list of shared objects dynamically loaded by the ddlopen command.
 
Related Topics
Preloading Shared Libraries
Tools > Debugger Loaded Libraries Command
TV::dll Command