allocator avl: exception if metadata assign fails

The Allocator_avl_tpl::metadata method (assigning variant) may fail
silently. Change this to make debugging easier.

Ref #2490
This commit is contained in:
Martin Stein 2017-08-16 17:54:52 +02:00 committed by Christian Helmuth
parent 0778a0f700
commit b2624be2ad
1 changed files with 5 additions and 0 deletions

View File

@ -311,6 +311,8 @@ class Genode::Allocator_avl_tpl : public Allocator_avl_base
public:
struct Assign_metadata_failed : Exception { };
/**
* Constructor
*
@ -335,11 +337,14 @@ class Genode::Allocator_avl_tpl : public Allocator_avl_base
/**
* Assign custom meta data to block at specified address
*
* \throw Assign_metadata_failed
*/
void metadata(void *addr, BMDT bmd) const
{
Block *b = static_cast<Block *>(_find_by_address((addr_t)addr));
if (b) *static_cast<BMDT *>(b) = bmd;
else throw Assign_metadata_failed();
}
/**