How to add debug codes in the application executable



Last updated on December 21st, 2015 at 03:53 am

It often happens the executable are either coredumping or not behaving exactly.We need to debug the executable.

Here are the General steps on How to add debug codes in the application executable.

Infact these are steps even followed  by adpatch to replace lib files in the product executables

Let’s say that you need to link the object file “invir.o” into the
INVLIBR executable.

Before doing anything make sure the concurrent managers are shut down.

First lets check the versions:
adident Header $INV_TOP/lib/invir.o
$Header: invir.opp 115.6 2001/04/11 16:14:32 pkm ship $

adident Header /u00/to/debug/file/invir.o
$Header: invir.opp 115.6.debug 2001/04/11 21:19:07 aeisber ship $

adident Header $INV_TOP/bin/INVLIBR |grep invir
$Header: invir.op 115.6 2001/04/11 16:14:32 pkm ship $

So we currently have version 115.6 on our system, and need to link in 115.6.debug
The first step is to back up the current version:
cd $INV_TOP/lib; cp invir.o invir.o.save

Copy in the debug version:
cp /u00/to/debug/file/invir.o .

Take backup of files
cp libinv.a libinv.a.save

Now add the debug version to libinv.a (Do not forget this step)
ar rv libinv.a invir.o

Now you can relink INVLIBR: (you can also use adadmin)
adrelink.sh force=y “inv INVLIBR”

Checking the version now shows:
adident Header $INV_TOP/bin/INVLIBR |grep invir.o
$Header: invir.opp 115.6.debug 2001/04/11 21:19:07 aweisber ship $

Our debug code is linked in and ready to be run. Start the managers back up,
and debugging stuff would be available


Leave a Reply