• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: otool
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: otool


  • Subject: Re: otool
  • From: Chris Espinosa <email@hidden>
  • Date: Thu, 28 Jul 2005 10:30:32 -0700

On Jul 28, 2005, at 10:08 AM, D. Walsh wrote:

is there a way with otool to display the functions in a shared library?


for example, I know that libz.dylib contains inflateEnd so how do I get otool to show me it and other functions?


If you just want to see the entry points, you can just use nm instead of otool:

$ nm -gfj /usr/lib/libz.dylib
___error
_adler32
_clearerr
_compress
_compress2
_compressBound
_crc32
_deflate
_deflateBound
_deflateCopy
_deflateEnd
_deflateInit2_
_deflateInit_
_deflateParams
_deflatePrime
_deflateReset
_deflateSetDictionary
...

For C++ libraries you can pipe the results through c++filt to demangle them:

nm -gfj /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/libstdc++.dylib  | c++filt --format=gnu-v3
__DefaultRuneLocale
__Unwind_DeleteException
__Unwind_GetDataRelBase
__Unwind_GetIP
__Unwind_GetLanguageSpecificData
__Unwind_GetRegionStart
__Unwind_GetTextRelBase
__Unwind_RaiseException
__Unwind_Resume
__Unwind_Resume_or_Rethrow
__Unwind_SetGR
__Unwind_SetIP
guard variable for __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true>::_S_get_pool()::_S_pool
guard variable for __gnu_cxx::free_list::_M_get_mutex()::_S_mutex
guard variable for __gnu_cxx::free_list::_M_get_free_list()::_S_free_list
__cxxabiv1::__terminate(void (*)())
...

If you want to see the disassembled object code for a function, you will have to use otool:

$otool -Vt /usr/lib/libz.dylib
/usr/lib/libz.dylib:
(__TEXT,__text) section
_gzopen:
910665b4        li      r5,0xffff
910665b8        b       _gz_open
_gz_open:
910665bc        stmw    r24,0xffe0(r1)
910665c0        or.     r27,r3,r3
910665c4        mfspr   r0,lr
910665c8        bcl     20,31,0x910665cc
910665cc        stw     r0,0x8(r1)
...

The -p flag to otool lets you start at a given symbol (e.g. $otool -Vt -p _inflateEnd /usr/lib/libz.dylib ) but dumps to the end of the text section, not just the given routine.

Chris
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >otool (From: "D. Walsh" <email@hidden>)

  • Prev by Date: Re: otool
  • Next by Date: Re: Newbie Q: how to make XCode generate Headers in frameworks?
  • Previous by thread: Re: otool
  • Next by thread: Three x-code 2.1 bugs?
  • Index(es):
    • Date
    • Thread