[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Segfaults & ld.so wierditude
On Tue, 25 Apr 2000, it was written:
> On Tue, 25 Apr 2000, Will Newton wrote:
>
> > If it's definitely your code I'll have a look at it, but I would be more
> > inclined to think it was a library problem. (Update ld.so and glibc and see
> > if it persists?)
> I'll have another play and put the code up.
Well, I had another play. The problem was that I had a function that
was trying to return the address of an array element, only it was using
a negative subscript at times. Goodness what what gdb was doing,
reporting backtraces in only __libc_start_main(), considering the
function was about three calls deep :/
Anyway, that problem solved, and another one reared it ugly head again.
It's a different program, but the code is part of the same project. The
problem is in malloc(). Strangely, malloc() segfaults (on the second
call of two seccusive ones in the backtrace; can't think why that is)
but it only does so after the the function has run through once already.
It's strdup() that is called from my code, but I changed it to a
malloc() call to see if it made a difference, and it didn't.
Strangely, having putting a call to malloc() (using exactly the
same size) infront of the offending one, and then free()ing that
straight afterwards, it works. Now, malloc() segfaults later in the
code. It is most most strange. A tarball is here:
http://www.dcs.shef.ac.uk/~u9rah/gcb-2000-04-27-0044.tar.bz2 (123 Kb)
The offending code is in the gcb/ircfe/irc_msg.c file, in the function
buf2irc_msg, which calls a strdup_inc() function in
gcb/common/gcb_string.c which then calls strdup(). The point at which
it used to segfault (without the surrounding malloc() and free() calls)
is in irc_msg.c, line ~215 (can't remember exactly.)
Many thanks,
Bob
--
Bob Ham: bob [at] timecity.org http://flux.mentaltempt.org/~node/
IRC: 'Bob' on irc.openprojects.net: #Slashdot #TimeCity
ICQ: 4396425 'The Tek' & 27699423 'The Tek.'
Time City Level Designer
Time City: http://www.timecity.org/
My work: http://flux.mentaltempt.org/~node/tc/
This email is Copyright (C) 2000 Robert Ham. Copyright is protected in law
in the UK and by treaty in other countries. Permission to reproduce is
strictly forbidden. If you wish to reproduce this email's content, please
apply by email to bob [at] timecity.org.
---------------------------------------------------------------------
Sheffield Linux User's Group - http://www.sheflug.co.uk
To unsubscribe from this list send mail to
- <sheflug-request [at] vuw.ac.nz> - with the word
"unsubscribe" in the body of the message.
GNU the choice of a complete generation.