05.08.2013 Views

Solaris Application Programming, 1/e - Chapter 4 - Parent Directory

Solaris Application Programming, 1/e - Chapter 4 - Parent Directory

Solaris Application Programming, 1/e - Chapter 4 - Parent Directory

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

84 <strong>Chapter</strong> 4 Informational Tools<br />

Example 4.49 Call Stack for malloc Requests Made by the Compiler (continued )<br />

malloc<br />

value ------------- Distribution ------------- count<br />

0 | 0<br />

1 | 2<br />

2 |@@@ 21<br />

4 |@@@@@@ 52<br />

8 |@@@@@@@@@@@ 88<br />

16 |@@@@@@@@ 65<br />

32 |@@@@@@ 52<br />

64 |@@@@@ 44<br />

128 |@ 5<br />

256 | 2<br />

512 | 1<br />

1024 | 0<br />

4.5 Information about <strong>Application</strong>s<br />

4.5.1 Reporting Library Linkage (ldd)<br />

The ldd utility reports the shared libraries that are linked into an application.<br />

This is useful for acquiring information, but it should not have any effect on performance<br />

(unless the wrong version of a library is selected somehow).<br />

The output in Example 4.50 shows the library the application is searching for on<br />

the left, and the library that has been located on the right.<br />

Example 4.50 Output from ldd Showing the Linking of a Particular <strong>Application</strong><br />

$ ldd ap27<br />

libm.so.1 => /usr/lib/libm.so.1<br />

libc.so.1 => /usr/lib/libc.so.1<br />

/usr/platform/SUNW,Sun-Blade-2500/lib/libc_psr.so.1<br />

Passing the -r option to ldd will cause it to check both the objects that are<br />

linked into the application and the particular function calls that are required. It<br />

will report whether the application is missing a library, and it will report the functions<br />

that are missing.<br />

The output shown in Example 4.51 is from the -r option passed to ldd. There<br />

are two items of interest. First, ldd reports that it is unable to locate the libsunmath<br />

library, which is Sun’s library of additional mathematical functions. Under<br />

this option, ldd reports the two function calls that it is unable to locate, and these<br />

function calls correspond to square root calls for single-precision floating-point,<br />

and for long integers.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!