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.

4.5 INFORMATION ABOUT APPLICATIONS 91<br />

Example 4.63 Example of Searching for the Command Line for a Compiler<br />

Using Sun Studio 10<br />

$ cc -fast -o test test.c<br />

$ dumpstabs test | grep test.c<br />

36: test.c 00000000 00000000 LOCAL FILE ABS<br />

0: .stabs "test.c",N_UNDF,0x0,0x3,0xb8<br />

2: .stabs "/export/home; /opt/SUNWspro/prod/bin/cc -fast -c test.c",N_CMD-<br />

LINE,0x0,0x0,0x0<br />

A similar set of actions for Sun Studio 11 and dwarfdump is shown in<br />

Example 4.64.<br />

Example 4.64 Example of Searching for the Command Line for a Compiler<br />

Using Sun Studio 11<br />

$ cc -fast -o test test.c<br />

$ dwarfdump test | grep command_line<br />

DW_AT_SUN_command_line /opt/SUNWspro/prod/bin/cc -fast -c test.c<br />

< 13> DW_AT_SUN_command_line DW_FORM_string<br />

It is also possible to use the dump command with the -sv option to extract most<br />

of the information from an executable. This will dump all the sections in an executable,<br />

printing those that are text in text format and the other sections as hexadecimal.<br />

An example of the output from dump is shown in Example 4.65. The actual<br />

output from the command runs to a number of pages, and Example 4.65 shows<br />

only a small part of this output.<br />

$ dump -sv a.out<br />

a.out:<br />

Example 4.65 Example of Output from dump<br />

.interp:<br />

2f 75 73 72 2f 6c 69 62 2f 6c 64 2e 73 6f 2e 31 00<br />

.hash:<br />

00 00 00 95 00 00 00 8e 00 00 00 00 00 00 00 00 00 00 00<br />

....<br />

**** STRING TABLE INFORMATION ****<br />

continues

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

Saved successfully!

Ooh no, something went wrong!