[Glacier][Zion] Add a fix sized string builder to allow non-alloc debug.
This commit is contained in:
parent
601f29c324
commit
8d10f19312
5 changed files with 62 additions and 3 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <glacier/string/str_format.h>
|
||||
#include <glacier/string/string_builder.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "include/ztypes.h"
|
||||
|
|
@ -21,13 +22,22 @@ void dbgln(const glcr::StringView& str);
|
|||
|
||||
template <typename... Args>
|
||||
void dbgln(const char* str, Args... args) {
|
||||
char buffer[256];
|
||||
glcr::FixedStringBuilder builder(buffer, 256);
|
||||
glcr::StrFormatIntoBuffer(builder, str, args...);
|
||||
dbgln(builder);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
void dbgln_large(const char* str, Args... args) {
|
||||
dbgln(glcr::StrFormat(str, args...));
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
void panic(const char* str, Args... args) {
|
||||
dbgln(glcr::StrFormat(str, args...));
|
||||
dbgln(str, args...);
|
||||
dbgln("PANIC");
|
||||
asm volatile("hlt;");
|
||||
}
|
||||
|
||||
#define UNREACHABLE \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue