Debugger Pretty Printers
Description
The library ships with pretty printer scripts for GDB and LLDB in the extra/ directory.
When loaded, these scripts display safe number types as human-readable decimal values instead of showing the internal class layout.
Loading the Printers
Supported Types
Unsigned Integers (u8, u16, u32, u64, u128)
All unsigned integer types are displayed as comma-separated decimal values.
using namespace boost::safe_numbers;
auto a = u8{255};
auto b = u32{1'000'000};
auto c = u128{18'446'744'073'709'551'616};
Debugger output:
a = 255 b = 1,000,000 c = 18,446,744,073,709,551,616
Bounded Unsigned Integers (bounded_uint)
Bounded unsigned integers display both the compile-time bounds and the current runtime value in the format [Min, Max] Current:
using namespace boost::safe_numbers;
bounded_uint<0u, 100u> percentage {u8{42}};
bounded_uint<1u, 65535u> port {u16{8080}};
Debugger output:
percentage = [0, 100] 42 port = [1, 65535] 8,080
Verified Unsigned Integers (verified_u8, verified_u16, verified_u32, verified_u64, verified_u128)
Verified unsigned integer types display identically to their underlying type as comma-separated decimal values.
using namespace boost::safe_numbers;
constexpr auto rate = verified_u32{u32{20}};
constexpr auto limit = verified_u64{u64{1'000'000}};
Debugger output:
rate = 20 limit = 1,000,000
Verified Bounded Integers (verified_bounded_integer)
Verified bounded integers display identically to bounded_uint — showing the compile-time bounds and the current value in the format [Min, Max] Current:
using namespace boost::safe_numbers;
constexpr auto offset = verified_bounded_integer<0u, 100u>{10u};
Debugger output:
offset = [0, 100] 10