Kernel: Add formatter for Kernel::Range

This is very useful when debugging memory allocation in the kernel
This commit is contained in:
Andrew Kaster 2021-07-06 20:37:44 -06:00 committed by Andreas Kling
parent f244a25f71
commit ab196b484a

View file

@ -58,3 +58,11 @@ private:
};
}
template<>
struct AK::Formatter<Kernel::Range> : Formatter<FormatString> {
void format(FormatBuilder& builder, Kernel::Range value)
{
return Formatter<FormatString>::format(builder, "{} - {} (size 0x{:08x})", value.base().as_ptr(), value.base().offset(value.size() - 1).as_ptr(), value.size());
}
};