Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!husc6!rutgers!rochester!cornell!batcomputer!pyramid!thirdi!peter
From: peter@thirdi.UUCP (Peter Rowell)
Newsgroups: comp.lang.c,comp.unix.questions
Subject: Re: C Programs and sdb
Message-ID: <271@thirdi.UUCP>
Date: Tue, 1-Dec-87 16:10:53 EST
Article-I.D.: thirdi.271
Posted: Tue Dec  1 16:10:53 1987
Date-Received: Fri, 4-Dec-87 23:33:25 EST
References: <161@mccc.UUCP>
Reply-To: peter@thirdi.UUCP (Peter Rowell)
Organization: Third Eye Software, Palo Alto, CA
Lines: 46
Keywords: debug C, sdb, extra symbols
Summary: Extra symbols in your library.
Xref: mnetor comp.lang.c:5678 comp.unix.questions:5164


I suspect (but have no 3b2 to verify on) that one or more of the files
that make up your /lib/libc.a (which contains all of the standard C
library routines) were compiled with the "-g" switch.  When sdb sees
this extra info, it wants to find the named file and display it.

It would seem that there is a bug in sdb (probably not the first you
have seen, and certainly not the last you will see) where they are not
catching that the file is not viewable.  You could test for this by
creating a file called "strncmp.c" with a bunch of random lines in it
(at least as many as the original source file had) and then fire sdb up
again and see what it does.  If it stops blowing up, that's the problem.

Fixing it will require removing "local symbols" from the library
without completely stripping it.  This can be done by doing the
following:

#-------------------------
mkdir /tmp/newlib
cd /tmp/newlib
# get list of .o order in libc
ar -t /lib/libc.a > list
# extract the .o's
ar -x /lib/libc.a
# now we loop through and clean up unwanted symbols
for $file in `cat list`
    ld -x -r $file
    mv a.out $file
done
# finally we rebuild the library
ar -qv libc.a `cat list`
# and put it somewhere safe
mv libc.a /your/home/dir/or/what/ever
#-------------------------

Now you can reload using your new library and see if the problem goes
away.  If it does, save your current /lib/libc.a somewhere and replace
it with your new libc.a.

There is one CAVEAT here: not all implementations of "ld" under
System V implement (or implement correctly) the "-x" switch.  Your
version may do nothing, core dump, or do the correct thing....

Good Luck,
    Peter Rowell
    (415) 321-0967