[haiku-development] Re: Paladin crashes when making project

  • From: Stephan Assmus <superstippi@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 25 Mar 2009 15:39:54 +0100

Hi Stephan,


On 2009-03-25 at 15:28:37 [+0100], Stephan Lichtenauer 
<fbsdlists@xxxxxxxxxxxxxx> wrote:
> just to quickly introduce myself: I am - quite impressed by the 
> dedication with which you are driving this project - watching Haiku for 
> several years now and also lurking on IRC and the mailing lists for some 
> time. Finally I have decided now that it is time to have a closer look at 
> it and begin to seriously try some things out.

Seems like we can slowly begin to pick the fruits now, can't we? :-)

> I am running Haiku VMWare pre alpha download R29625 running on VMWare 
> Fusion 2.0.2. I have downloaded & installed Paladin 1.0rc4 from 
> haikuware.com and created a simple project called "Hello" with one file 
> "test.c" which is containing the classical "Hello world" code.
> 
> Now when I click on the "Make" (Alt-M) menu item, Paladin crashes with 
> this stack trace:
> 
> [Switching to team /boot/apps/Paladin/Paladin (6588) thread build thread 
> (6618)]
> 0x00452614 in BString::_IsShareable () from /boot/beos/system/lib/ 
> libbe.so
> (gdb) bt
> #0  0x00452614 in BString::_IsShareable () from /boot/beos/system/lib/ 
> libbe.so
> #1  0x0044ccf6 in BString::BString () from /boot/beos/system/lib/ libbe.so
> #2  0x00236d5a in Project::CompileFile ()
> #3  0x0023c327 in ProjectBuilder::BuildThread ()
> #4  0x0050ac98 in thread_entry () from /boot/beos/system/lib/libroot.so 
> #5  0x70080fec in ?? ()
> 
> When googling I have found some information about RC2 crashing with gcc4 
> hybrid builds but I the stack trace looked differently...
> 
> Does somebody have any idea what is going wrong here? Is there additional 
> information I could obtain?

Your best bet would be to look a the Paladin source code. I assume it's 
available, but I don't know. The Haiku BString implementation has grown 
"copy on write" capabilities, which the BeOS version didn't have. This is 
the constructor which is used by Paladin:

BString::BString(const BString& string)
        : fPrivateData(NULL)
{
        // check if source is sharable - if so, share else clone
        if (string._IsShareable()) {
                fPrivateData = string.fPrivateData;
                atomic_add(&_ReferenceCount(), 1);
                        // string cannot go away right now
        } else
                _Init(string.String(), string.Length());
}

Looking at BString::IsShareable():

inline bool
BString::_IsShareable() const
{
        return fPrivateData != NULL && _ReferenceCount() >= 0;
}

Pretty much the only explaination is that Paladin passes an invalid BString 
to the copy constructor of another string. Or there is a bug in Haiku's 
BString implementation, but that is rather unlikely, since it's had lots of 
exposure already.

Best regards,
-Stephan


Other related posts: