Re: ADDRESS ALIGNMENT/BUS ERROR

From: Ric Klaren (j.klaren@student.utwente.nl)
Date: 06/26/96


Hi,

On Wed, 26 Jun 1996, Jvrgen Zigge Sigvardsson wrote:

> Does anyone have a clue?
> 
> This line of code crashes my mud: free(mob_proto);
> Where mob_proto is a pointer to a char_data structure 
> (struct char_data *mob_proto)

First guess, mob_proto isn't the pointer which was malloced anymore... eg 
you are trying to free something that wasn't malloced.

Second guess, something wrote beyond/before the mob_proto struct in the
memory and damaged some internal struct of malloc/free hard to detect and 
find.....

Try placing a breakpoint in the code with gdb and check out the struct 
you are trying to free up.

> The debugger tells me the following:
> 
> 	signal BUS (invalid address alignment) in free_unlocked at 0xe0714
> 	free_unlocked+0x1c4:	st     	%l1, [%l0 + 4]
> 
> What can I do to make the address correctly aligned?
> BTW I'm on a Sparc Station 5 using Solaris 2.5

If it's none of the above.. (which I don't think it is) Dunno for sure 
about the sparc it may work with even addresses or quad aligned 
addresses. So malloc 1 byte or 3 bytes extra and add 1 until you're on 
the right alignment. (add 1 is impracticle use some addition and some AND 
mask which is appropriate for the case)

If needed send me some code (if you're desperate ;) (if it's lots send it 
to the second email in my sig, that's no phone connection....)

Greetz Ric

-----+++++*****************************************************+++++++++-------
- Ric Klaren - j.klaren@student.utwente.nl - ia_ric@cs.utwente.nl -------------
-----+++++*****************************************************+++++++++-------
``Why don't we just invite them to dinner and massacre them all when
they're drunk?''
``You heard the man. There's seven hundred thousand of them.''
``Ah? So it'd have to be something simple with pasta, then.''
-------------------------------------------------------------------------------
From: Interesting Times by Terry Pratchet
-----+++++*****************************************************+++++++++-------



This archive was generated by hypermail 2b30 : 12/18/00 PST