mirror of
https://github.com/genodelabs/genode.git
synced 2025-05-30 22:24:24 +00:00
parent
146fd54f2d
commit
fd5172e1f3
@ -305,23 +305,6 @@ void Genode::destroy(auto && dealloc, T *obj)
|
||||
|
||||
namespace Genode {
|
||||
|
||||
void static inline print(Output &out, Allocator::Alloc_error error)
|
||||
{
|
||||
using Error = Allocator::Alloc_error;
|
||||
|
||||
auto name = [] (Error error)
|
||||
{
|
||||
switch (error) {
|
||||
case Error::OUT_OF_RAM: return "OUT_OF_RAM";
|
||||
case Error::OUT_OF_CAPS: return "OUT_OF_CAPS";
|
||||
case Error::DENIED: return "DENIED";
|
||||
}
|
||||
return "<unknown>";
|
||||
};
|
||||
|
||||
Genode::print(out, name(error));
|
||||
}
|
||||
|
||||
void static inline print(Output &out, Allocator::Alloc_result result)
|
||||
{
|
||||
result.with_result(
|
||||
|
@ -15,6 +15,7 @@
|
||||
#define _INCLUDE__BASE__OUTPUT_H_
|
||||
|
||||
#include <base/stdint.h>
|
||||
#include <base/error.h>
|
||||
#include <util/interface.h>
|
||||
|
||||
namespace Genode { struct Output; }
|
||||
@ -210,6 +211,11 @@ namespace Genode {
|
||||
void print(Output &output) const { output.out_char(c); }
|
||||
};
|
||||
|
||||
/**
|
||||
* Print error codes defined at base/error.h
|
||||
*/
|
||||
void print(Output &, Alloc_error);
|
||||
|
||||
/**
|
||||
* Print information about object 'obj'
|
||||
*
|
||||
|
@ -244,6 +244,7 @@ _ZN6Genode5Trace6Logger17_evaluate_controlEv T
|
||||
_ZN6Genode5Trace6Logger3logEPKcm T
|
||||
_ZN6Genode5Trace6LoggerC1Ev T
|
||||
_ZN6Genode5Trace6LoggerC2Ev T
|
||||
_ZN6Genode5printERNS_6OutputENS_11Alloc_errorE T
|
||||
_ZN6Genode5printERNS_6OutputEPKc T
|
||||
_ZN6Genode5printERNS_6OutputEPKv T
|
||||
_ZN6Genode5printERNS_6OutputEd T
|
||||
|
@ -8,6 +8,7 @@
|
||||
[init -> test-log] invalid hex range: [f8,08) (overflow!)
|
||||
[init -> test-log] negative hex char: 0xfe
|
||||
[init -> test-log] positive hex char: 0x02
|
||||
[init -> test-log] Alloc_error value: OUT_OF_RAM
|
||||
[init -> test-log] floating point: 1.70
|
||||
[init -> test-log] multiarg string: "parent -> child.7"
|
||||
[init -> test-log] String(Hex(3)): 0x3
|
||||
|
@ -33,6 +33,7 @@ compare_output_to {
|
||||
[init -> test-log] invalid hex range: [f8,08) (overflow!)
|
||||
[init -> test-log] negative hex char: 0xfe
|
||||
[init -> test-log] positive hex char: 0x02
|
||||
[init -> test-log] Alloc_error value: OUT_OF_RAM
|
||||
[init -> test-log] floating point: 1.70
|
||||
[init -> test-log] multiarg string: "parent -> child.7"
|
||||
[init -> test-log] String(Hex(3)): 0x3
|
||||
|
@ -100,3 +100,16 @@ void Genode::Hex::print(Output &output) const
|
||||
[&] (char c) { output.out_char(c); });
|
||||
}
|
||||
|
||||
|
||||
void Genode::print(Output &out, Alloc_error e)
|
||||
{
|
||||
auto name = [] (Alloc_error e)
|
||||
{
|
||||
switch (e) {
|
||||
case Alloc_error::OUT_OF_RAM: return "OUT_OF_RAM";
|
||||
case Alloc_error::OUT_OF_CAPS: return "OUT_OF_CAPS";
|
||||
case Alloc_error::DENIED: return "DENIED"; }
|
||||
return "<unknown>";
|
||||
};
|
||||
print(out, name(e));
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ void Component::construct(Genode::Env &env)
|
||||
log("invalid hex range: ", Hex_range<uint8_t>(0xf8, 0x10));
|
||||
log("negative hex char: ", Hex((char)-2LL, Hex::PREFIX, Hex::PAD));
|
||||
log("positive hex char: ", Hex((char) 2LL, Hex::PREFIX, Hex::PAD));
|
||||
log("Alloc_error value: ", Alloc_error::OUT_OF_RAM);
|
||||
|
||||
log("floating point: ", 1700.0 / 1000);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user