Add C++ demangling to privileged runtime

Cosmo will now print C++ symbols correctly in --ftrace logs and
backtraces. Doing this required reducing the memory requirement
of the __demangle() function by 3x. This was accomplished using
16-bit indices and 16-bit malloc granularity. That puts a limit
on the longest symbol we can successfully decode, which I think
would be around 6553 characters long, given a 65536-byte buffer
This commit is contained in:
Justine Tunney 2024-06-01 19:57:32 -07:00
parent dcd626edf8
commit 165c6b37e2
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
13 changed files with 727 additions and 284 deletions

View file

@ -215,9 +215,9 @@ TEST(ksnprintf, testSymbols) {
hassymbols = GetSymbolTable();
ksnprintf(b[0], 32, "%t", strlen);
if (hassymbols) {
ASSERT_STREQ("&strlen", b[0]);
ASSERT_STREQ("strlen", b[0]);
} else {
ksnprintf(b[1], 32, "&%lx", strlen);
ksnprintf(b[1], 32, "%lx", strlen);
ASSERT_STREQ(b[1], b[0]);
}
}