Odump is an unsupported, undocumented internal utility created by




Yüklə 24.56 Kb.
tarix28.02.2016
ölçüsü24.56 Kb.
Using odump

odump is an unsupported, undocumented internal utility created by

the linker lab. The utility is provided "as is" in linker tools

patches (after PHSS_10436 on 10.x and after PHSS_19866 on 11.x),

and is installed in /usr/contrib/bin.
odump can be run on 32-bit and 64-bit native code (object files,

shared and archive libraries, executables).

To list all options that odump supports:

$ odump -u


To see what compiler options and version an executable was compiled with:

$ odump -compunit a.out

-Oq00 = no optimization

-Oq02 = -O or +O2


To check if an object file (.o) contains valid debug information:

The '-verifyall' option checks pointers and tables containing symbolic

debug information. We send the output to the lab for analysis.

(3 CTTI defects are fixed in DART 43 odump - SR 1653282004)

$ odump -verifyall mypgm.o
Note: if 'odump -verifyall' is run on an executable, the

unsatisified symbols in the executable will be flagged

as follows (JAGac40288 - fixed in DART 49 B.11.17):
Verifying Symbol Records from a.out: ...

*** Symbol info field out of range for symbol _start at 168

*** Symbol info field out of range for symbol _main at 169
Note: if 'odump -verifyall' is run on an executable, you

may see warnings like this for some extra relocation entries

which can be ignored (JAGad01939 - fixed in B.11.18):
Verifying Dynamic Relocation Table from a.out: ...

record 0 = -1, not in the range of 1 1

record 0 = -1, not in the range of 0 21

record 0 = 2, not in the range of 5 5


If you see this error with the latest odump, rebuild with the latest

linker:
Verifying DL Header Ext from a.out: ...

Warning: expected size of dl_header_ext was 40, got 28

This usually is the result of either outdated odump,ld or dld.sl

To look at module names in a shared library (A5807007):

$ odump -slexportlist lib1.sl

$ nm -x lib1.sl | grep 'extern|code'

$ nm++ -x lib1.sl | grep 'extern|code' # for C++ code


To see symbols in an archive library:

nm looks directly at each .o file's symbol table.

$ nm -x lib1.a | grep 'extern|entry'

The linker of course looks at the archive library symbol table.


odump -lstexp lists the symbols from the archive library symbol table ie

those symbols as seen by the linker:

$ odump -lstexportlist lib1.a # Print LST exportlist
Thus if ar is broken we could see a symbol with nm but not with ld or

odump -lstexp


To list the shared libraries (.sl) called by a program:

$ odump -sllib a.out

$ odump -slliblist a.out # also works

$ chatr a.out


To list the shared libraries (.sl) that will be loaded by a program, even

if SHLIB_PATH is set:

$ odump -sllibload a.out
To see if an object file was compiled as PIC (+z, +Z), look for a 'pc-rel'

fixup:


$ odump -fixups a.o | grep pc-rel

15 0 00000018 3602 pc-rel call(rbits=10001, (sym=printf)


To see how much space a program needs in Quadrant 2 to hold the data,

bss, stack etc., look at the values in the som_exec_auxhdr (A5915162):

$ odump -auxheader a.out

Auxiliary Header Record (HP-UX) for a.out:

mandatory = 0 copy = 0

append = 0 ignore = 1

type = 4 length = 40

exec_tsize = 0x000023ec exec_tmem = 0x00001000

exec_tfile = 0x00002000 exec_dsize = 0x00001000

exec_dmem = 0x40001000 exec_dfile = 0x00005000

exec_bsize = 0x3bfff120 exec_entry = 0x000029c8

exec_flags = 0x00000004 exec_bfill = 0x00000000


To see which linker version was used to build an a.out:

$ odump -auxheader average

...

Auxiliary Header Record (Linker) for average:


mandatory = 1 copy = 0

append = 0 ignore = 0

type = 1 length = 32

product_id = 92453-07B version_id = 11.06

when_linked = Tue Feb 08 2000 12:01:19.000000000 PST
To see how large each subspace of an executable is:

$ odump -sommap a.out

Map of SOM structures for a.out: ...
Start Size % Area

-------- ------ ----- ----

...

00003000 00085f 7.5% subspace 0 ($SHLIB_INFO$)



00003860 000550 4.7% subspace 1 ($MILLICODE$)

00003db0 0000d8 0.8% subspace 2 ($LIT$)

00003e88 001190 15.6% subspace 3 ($CODE$)

00005018 000250 2.1% subspace 4 ($UNWIND_START$)

00005268 000060 0.3% subspace 5 ($UNWIND_END$) ...
To see how much space a program allocates for the hash table

(hash_table) or strings (string_table) or Thread Local Storage

(tdsize), look at the values in the shared lib DL header:

$ odump -sldlheader a.out


Shared Library DL Header for a.out:
version: 93092112

LTptr_offset: 0x00000000

highwater_mark: 0000000000

embedded_path: 0000000000

flags: 0x00000020
Name Location/Value Size

---- -------------- ----

library_list 0x00000110 0x00000002

import_list 0x00000330 0x00000008

export_list 0x000001dc 0x00000011

export_ext 0x00000000 0x00000011

hash_table 0x00000120 0x0000002f

string_table 0x00000398 0x000000d0

dyn. reloc 0x00000370 0x00000002

module_list 0xffffffff 0x00000000

data_lnk_tbl 0x00000208 0x00000004

proc_lnk_tbl 0x000001e8 0x00000004

elaborator 0x00000070

initializer 0xffffffff 0x00000000

tdsize 0x00000000

fastbind_list 0x00000000


To see if a program was built for debugging (-g) and not for

optimization (-O), look for a $DEBUG$ space (programs built for

both will show $PINFO$ instead of $DEBUG$):

$ odump -spaces a.out

Space dictionary for a.out:

Ind LDPIT Sort Space Subspaces Ldr Fixups Init Ptrs Name

0 LD... 8 1 0 8 -1 0 0 1 $TEXT$

1 LDP.. 16 0 8 9 -1 0 1 1 $PRIVATE$

2 .DP.. 80 2 17 5 -1 0 -1 0 $DEBUG$
To see if an object file was compiled with +objdebug, look for a $OBJDEBUG$

space:


$ odump -space average.o

Space dictionary for average.o:

Ind LDPIT Sort Space Subspaces Ldr Fixups Init Ptrs Name

0 LD... 8 0 0 3 -1 0 -1 0 $TEXT$

1 LD... 16 1 3 2 -1 0 -1 0 $PRIVATE$

2 .DP.. 80 2 5 5 -1 0 -1 0 $DEBUG$

3 .DP.. 79 2 10 3 -1 0 -1 0 $OBJDEBUG$

To see if an object was compiled with +O4 optimization, look for

a $OPT$ space or check the compiler options for -Oq04:

$ odump -spaces f1.o

Ind LDPI Sort Space Subspaces Ldr Fixups Init Ptrs Name

0 .D.I 0 0 0 1 -1 0 -1 0 $OPT$

$ odump -compunit f1.o

3 0 HPC f1

ccom options = -Oq04,al,ag,cn,Lm,sz,Ic,vo,lc,Mf,Po,es,rs,sp,In,vc,

Pi,Fa,Pe,Rr,Fl,pv,pa,nf,cp,Lx,st,ap,Pg,ug,Lu,dp,Fs,bp,wp! -Ac


To see the stubs in a shared library:

$ odump -sym libx.sl | grep -e 'Stub Ext' -e 'Code Unsat'


To see the stubs, symbols and stack unwind table in a shared library:

$ odump -sym -sub -unwind x.sl > out1


To see the implementation libraries for a filter library:

$ odump -filtertable libfilt.sl

Filtered Shared Library List Table for libfilt.sl:
Index String Table Offset Name
0 11 ./libsuba.sl

1 24 ./libsubd.sl

See also the "Using Odump" section in Troubleshooting chapter of the

HP aC++ Skill Builder Exercises.
Symbolic Debug Information Terminology

COMD comdat section - for expanding C++ inline functions

CTTI C++ compile-time template instantiation

DOC debugging optimized code ?


DNTT Debug Name and Type Tables (applies to both GNTT and LNTT info)

GNTT Global Name and Type Table - variables, types, constants

LNTT Local Name and Type Table - local symbols, scoping info

LST Library Symbol Table - for archive (and shared?) libraries

SLT Source Line Table - relates source lines to code addresses

VT Value Table - ascii strings and named constants


DLT Data Linkage Table - contains an entry for each data or

procedure symbol that is accessed indirectly



PLT Procedure Linkage Table - contains an entry for each

unresolved procedure symbol referenced within the object


Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azrefs.org 2016
rəhbərliyinə müraciət

    Ana səhifə