Subject: Re: Debugging dynamically-linked C++ programs in 1.0
To: None <port-sparc@NetBSD.ORG, earle@isolar.Tujunga.CA.US>
From: Paul Kranenburg <pk@cs.few.eur.nl>
List: port-sparc
Date: 11/30/1994 19:48:01
> I found that I could only debug the program (i.e., set breakpoints and have it
> stop at them (-: ) if I compiled/linked statically.  Is this a Known Problem
> in 1.0 with g++ that I just wasn't aware of?  (Anyone tried gcc/g++ 2.6.2 yet?)
This is an artifact of gdb. There's a special hook in dynamically linked
programs that enables debuggers to to get informed when all shared libraries
have been loaded into the process' address space. Currently, gdb lets the
process "run freely" until this happens. Consequently, if your program
crashes sooner (say, in one of a shared C++ library's global constructor
routines) you loose, and you'll get a "you cannot do that" - or something
equally informative - message.

> 
> Also, given that the program core dumped when linked dynamically, it makes
> me wary of linking any C++ program dynamically under 1.0.
> 
It turned out that, on the sparc, the array of (32 bits) function pointers
representing the initialization functions of global constructors, was being
relocated with `RELOC_8' type records. I have corrected this in netbsd-current.

-pk