Strange behaviour of member addresses

Steffen Liebergeld steffen at ...37...
Mon May 31 15:51:22 CEST 2010


Hi,

I am experiencing some strange behaviour in genode.

In base/include/base/heap.h
I placed debug output in the Heap::Heap constructor:

            Heap(Ram_session *ram_session,
                 Rm_session  *rm_session,
                 size_t       quota_limit = UNLIMITED,
                 void        *static_addr = 0,
                 size_t       static_size = 0)
            :
                _ds_pool(ram_session, rm_session),
                _quota_limit(quota_limit), _quota_used(0),
                _chunk_size(MIN_CHUNK_SIZE)
            {
                PDBG("quota_limit=%d this=0x%p &_quota_limit=0x%p",
_quota_limit, (void*)this, &_quota_limit);
                enter_kdebug("quota_limit");
                if (static_addr)
                    _alloc.add_range((addr_t)static_addr, static_size);
            }

This prints the following:
quota_limit=-1 this=0x1851d8 &_quota_limit=0x185630

Then I placed some debug output in base/src/base/heap/heap.cc:alloc
bool Heap::alloc(size_t size, void **out_addr)
{
    /* serialize access of heap functions */
    Lock::Guard lock_guard(_lock);
    PDBG("size=%d _quota_used=%d _quota_limit=%d *this=0x%p
&_quota_limit=0x%p", size, _quota_used, _quota_limit, (void*)this,
&_quota_limit);

And this prints the following:
_quota_limit=0 *this=0x1851d8 &_quota_limit=0x18563c

Seems to me like the compiler did not correctly calculate the member
addresses (this problem appears to be the same that caused the previous
error I posted). Do you have an idea why that happened and how to fix it?

Mand thanks in advance,
Steffen Liebergeld
-- 
Dipl.-Inf. Steffen Liebergeld <steffen at ...37...>
Security in Telecommunications
TU Berlin/ Deutsche Telekom Laboratories
Ernst-Reuter-Platz 7, 10587 Berlin
Phone: +30 8353 58 263
Web: http://www.t-labs.tu-berlin.de/sect




More information about the users mailing list