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
Hi Steffen,
Heap::Heap...
This prints the following: quota_limit=-1 this=0x1851d8 &_quota_limit=0x185630
Heap::alloc...
And this prints the following: _quota_limit=0 *this=0x1851d8 &_quota_limit=0x18563c
I added both debug outputs to the current Genode version and both values of &_quota_limit are equal here (tested on Linux).
Which Genode version are you using? Have you upgraded the Genode version in the process of your work? If yes, you should definitedly start with a new build directory. Are you using a copy of the 'heap.h' header file? In the past, we stumbled over a similar problem that occurred when having multiple header files with the same name in the include search path.
Norman
Am 01.06.2010 12:53, schrieb Norman Feske:
Hi Steffen,
Heap::Heap...
This prints the following: quota_limit=-1 this=0x1851d8 &_quota_limit=0x185630
Heap::alloc...
And this prints the following: _quota_limit=0 *this=0x1851d8 &_quota_limit=0x18563c
I added both debug outputs to the current Genode version and both values of &_quota_limit are equal here (tested on Linux).
Which Genode version are you using? Have you upgraded the Genode version in the process of your work? If yes, you should definitedly start with a new build directory. Are you using a copy of the 'heap.h' header file? In the past, we stumbled over a similar problem that occurred when having multiple header files with the same name in the include search path.
Thank you Norman. I have to admit that it was me, who was shooting into my foot. I had two different versions of the Lock-Class, and both were used. That is why the addresses differed. The problem was triggered because the Heap constructor is implemented in the header file, as opposed to the Heap methods, which reside in their own .cc file. I guess the compile inlined the constructor and used a different version of the Lock class than I intended. Coincidentally the file was also named the same in my $(REP_DIR)/include/base/ as in $(BASE_DIR)/include/base.
I guess now I can get productive again;-)
Greetings, Steffen