Skip to content

Commit

Permalink
Enable printing function pointers using debug::log.
Browse files Browse the repository at this point in the history
This requires a reinterpret_cast rather than a static cast.
  • Loading branch information
rmn30 authored and nwf committed Feb 21, 2025
1 parent 092a41b commit fafa7aa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sdk/include/debug.hh
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ struct DebugFormatArgumentAdaptor<T>
__always_inline static DebugFormatArgument construct(T value)
{
return {reinterpret_cast<uintptr_t>(
static_cast<const volatile void *>(value)),
reinterpret_cast<const volatile void *>(value)),
DebugFormatArgumentKind::DebugFormatArgumentPointer};
}
};
Expand Down
1 change: 1 addition & 0 deletions tests/test-runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ int __cheri_compartment("test_runner") run_tests()
debug_log("Trying to print unsigned 32-bit integer: {}", 0x12345U);
debug_log("Trying to print unsigned 64-bit integer: {}",
0x123456789012345ULL);
debug_log("Trying to print function pointer {}", compartment_error_handler);
const char *testString = "Hello, world! with some trailing characters";
// Make sure that we don't print the trailing characters
debug_log("Trying to print std::string_view: {}",
Expand Down

0 comments on commit fafa7aa

Please sign in to comment.