How to exclude shared library from instrumentalization with purify?

1.8k views Asked by At

Instrumentalizing C Code that is linked against Oracle's libclntsh leads to crashes when running the resulting program. The program is terminated with a 'Illegal Instruction' signal.

The bug is present for at least some versions of Oracle 11g and Purify.

This is a known bug and IBM has published a workaround. Unfortunately, the workaround does not help in my work environment.

I am using

$ purify -version
Version 7.0.1.0-002.U 120210 Solaris SPARC

under Solaris 10 on Sun SPARC hardware. I compile the C source with Sun CC 11.

Like described in the workaround I've tried excluding libclntsh from instrumentalization like this:

$ purify -verbose -cache-dir=purify_cache -always-use-cache-dir \
     -selective -exclude-libs=/oracle/app/rdbms/ora11203/lib/libclntsh.so.11.1 \
     cc -o myprogram ... -lclntsh

This does not work. Purify just says that it is instrumenting libclntsh.so.11.1, and surely enough I get a corresponding _pp3_ file and not a _pp0_ one.

I tried variations of the exclude pattern:

-exclude-libs=libclntsh.so.11.1
-exclude-libs=clntsh.so

Without any success.

Being able to exclude libclntsh would also greatly the instrumentalization time. On this SPARC machine it takes several minutes to instrumentalize libclntsh.so.

Looking at the workaround, it just mentions HPUX - but I hope it is also applicable under Solaris ... somehow.

1

There are 1 answers

2
maxschlepzig On BEST ANSWER

With that version of Purify (7.0.1-ish on Solaris SPARC) following option syntax works:

$ purify -cache-dir=purify_cache -always-use-cache-dir \
    -enable-exclude -exclude-libs=libclntsh.so.11.1 cc ...

Purify then still prints something about instrumentalizing libclntsh.so.11.1 but it is finished way faster and creates a _p0_ file:

$ find purify_cache -name '*_pp0_*'
purify_cache/.../lib/libclntsh.so.11.1_pure_pp0_pc0_0_0_1009171813_510_64

Advantages:

  • exclude yields faster instrumentalization times if you just need to instrumentalize other parts of the code
  • works around Illegal Instruction crashes with Purify and Oracle libraries

Disadvantage:

  • memory errors inside the excluded library (because of wrong input data to those library functions) are not detected any more.

Purify uses : as delimiter in values supplied to the -exclude-libs option, i.e. you can specify multiple libraries for exclusion (e.g. -exclude-libs=foo.so:bar.so).