[KLUG Members] Neat trick

Peter Buxton somercet at fastmail.fm
Sun May 1 00:53:46 EDT 2005


Having a problem with shared libs messing with xterm.  How to discover
the problem?

$ LD_PROFILE=libXaw.so.8 /usr/bin/bitmap  #then exits bitmap
$ sprof -p libXaw.so.8
Flat profile:

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total
 time   seconds   seconds    calls  us/call  us/call  name
 50.00      0.01     0.01        0     0.00           XawFormClassInitialize
 50.00      0.02     0.01        0     0.00           XawPanedChangeManaged
  0.00      0.02     0.00       11     0.00           XawInitializeWidgetSet
  0.00      0.02     0.00        8     0.00           _XawImGetShellHeight
  0.00      0.02     0.00        8     0.00           _XawImResizeVendorShell
  0.00      0.02     0.00        7     0.00           XawDialogAddButton
  0.00      0.02     0.00        5     0.00           XawVendorShellExtResize
  0.00      0.02     0.00        5     0.00           _XawImInitialize
  0.00      0.02     0.00        4     0.00           XawAddPixmapLoader
  0.00      0.02     0.00        2     0.00           _XawImRealize
  0.00      0.02     0.00        1     0.00     XawInitializeDefaultConverters
  0.00      0.02     0.00        1     0.00           XawPixmapsInitialize
  0.00      0.02     0.00        1     0.00           XawToggleSetCurrent
$

Since libXaw.so.8 did not cause a problem with the app bitmap(1), which
links to libXaw.so.8, no hangs were detected, and I can move on to the next
suspected cause.  Note that XawFormClassInitialize took a high proportion
of time to complete.  That is because it calls, directly or indirectly,
most of these other functions.

LD_PROFILE works through ld.so, the dynamic linker.  Debug info does not
need to be built into the app or shared lib.  To debug multiple apps with
some shared object, `export LD_PROFILE=libBlahblah.so.56` and run your
apps afterward.  Warning: these file get big fast, so `unset LD_PROFILE`
when you are finished.

See `sprof --help` for a list of options.  sprof is a recent (2.1) but
standard part of GNU libc.  There is no man page.

-- 
<kritical>  you need to learn how to figure out stuff yourself..
<Christin1> how do i do that? -- from bash.org


More information about the Members mailing list