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 ... | -all ]
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 use ddlopen without arguments or use the -list option without a DLL ID list (ddlopen -list), TotalView displays information about all DLL IDs.
dll-ids
A list of one or more DLL IDs. DLL IDs are the return values when you use the ddlopen command to load DLLs.
Description
The
ddlopen command dynamically loads shared object libraries, or lists the shared object libraries loaded using this or the
Tools > Debugger Loaded 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-ldloption if you want to use the ddlopen command.
Also, the ddlopen command operates by calling dlopen(3). This can alter the string returned by dlerror(3). Thus, issuing a ddlopen command can change the values returned to the application by any of its subsequent dlerror(3) calls.
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 IDfor 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 represents 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.
To obtain a listing of all objects loaded using ddlopen, enter just ddlopen without a filespec argument, or ddlopen -list.
The ddlopen command prints its output directly to the console.
Examples
ddlopen "mpistat.so"
1
Loads the mpistat.so library file. The return value (1) indicates the process into which TotalView loaded the library.
dfocus g ddlopen "mpistat.so(mpistat.o)"
2
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
dll-id susp-eval-id [Switches] DLL name p.t dlopen handle (TV::expr get p.t status)
1 2 -lazy tx_shared_lib.so 1.1 3
Prints the list of shared objects dynamically loaded by the ddlopen command.
ddlopen prints its output directly to the console. Type “help output” for more information.
Related Topics