Re: Using gdb with test programs under Linux

Fons Rademakers (rdm@pcsalo.cern.ch)
Wed, 17 Jun 1998 02:13:03 +0200 (METDST)


Hi Rob,

I use all the time gdb (preferably via ddd) to debug ROOT shared libs
without adding the lib dir to ld.so.conf. First when starting gdb you need
to execute the "shared" command. Also, the ROOT libs coming with the
binary distributions don't contain debug info so gdb might just skip them.

I did not manage to run ROOT successfuly with KCC 3.2. With 3.3 all ROOT
releated problems were solved.

Cheers, Fons.

>
> Hello,
>
> I am attempting to use gdb with any of the test programs under RedHat 5.0
> Linux and Root 2.00/08 (gcc 2.7). ROOTSYS and LD_LIBRARY_PATH are defined, and
> all programs run stand-alone just fine. I would like to run these programs
> under gdb. When I run the Root 2.00/08 (gcc 2.7) test programs, gdb cannot
> find the Root shared libraries.
>
> The only work-around I can see to this is to add the Root library directory
> to the /etc/ld.so.conf file and run /sbin/ldconfig (both actions require
> superuser privilege). All other Linux products I have installed and used take
> this approach or install themselves into /usr/lib and run /sbin/ldconfig.
> Either approach conflicts with our interest in allowing different users to use
> different versions of Root on a single machine, just as they are familiar with
> working with versions of Cernlib in order to preserve analyses.
>
> I have tried this with the latest gdb 4.17, as well as the stock 4.16. I
> tried a number of commands within gdb to force the loading of shared libraries
> in specific locations and made no progress. I have not tried every ELF-related
> environment variable and trick with gdb yet, but....
>
> The problem does not occur under IRIX6, any Root version, any working
> debugger. It appears to be specific to how the Linux run-time linker and gdb
> interact.
>
> Any help would be appreciated,
> Thanks,
> Rob Kennedy
> kennedy@fnal.gov
>
> PS. The exact reason I want to run these programs under gdb is to debug
> run-time failures in Root 2.00/08 compiled under Kai C++ v3.2d on Linux. The
> test programs fail to operate correctly, with most suffering segfaults. While
> allseems to work fine under Kai C++ v3.3b, we cannot make use of v3.3 yet
> since it "de-implements" the ability to use KCC to add a single object to an
> archive library, as we have been doing with automatic template instantiation
> and our build procedures. I know there is more behind this story of Root and
> Kai v3.2/v3.3... but the issue here is really how to use a debugger under
> Linux with Root shared libraries without resorting to root-privilege
> installation procedures.
>

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland          Phone: +41 22 7679248
E-Mail: Fons.Rademakers@cern.ch              Fax:   +41 22 7677910