Pretty Printers
Pretty printers allow debuggers to display uint128_t and int128_t values in human-readable format instead of showing the raw struct members.
The library contains pretty printers for LLDB, GDB, and Visual Studio in the extra/ folder.
LLDB
To use this, add the following line to your ~/.lldbinit file:
command script import /path/to/int128/extra/int128_printer_lldb.py
If this is successful, you should see the following message in your debugger upon startup:
"int128_t and uint128_t pretty printers loaded successfully"
GDB
To load the pretty printer, add the following line to your .gdbinit:
source /path/to/int128/extra/int128_printer_gdb.py
or you can source it manually in GDB.
(gdb) source /path/to/int128/extra/int128_printer_gdb.py
Visual Studio (NATVIS)
The extra/int128.natvis file provides visualization for the Visual Studio debugger.
There are several ways to register it:
Per-Project
Add the .natvis file to your Visual Studio project.
In Solution Explorer, right-click the project, select Add > Existing Item, and choose int128.natvis.
Visual Studio will automatically use it when debugging that project.
Per-User (All Projects)
Copy int128.natvis to your per-user Visualizers directory:
%USERPROFILE%\Documents\Visual Studio 2022\Visualizers\
Replace 2022 with your Visual Studio version.
All projects debugged with that installation will use the visualizer.
CMake Projects
Add the .natvis file as a source file in your CMakeLists.txt:
target_sources(my_target PRIVATE /path/to/int128/extra/int128.natvis)
Display Format
Values that fit in 64 bits are displayed in decimal.
Larger values are displayed as a synthesized hexadecimal value with a ' digit separator between the high and low halves.
| Type | Value | Display |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Full decimal display for values beyond 64 bits is not possible in NATVIS. The NATVIS expression evaluator does not support 128-bit arithmetic, so values that exceed the 64-bit range are shown in hexadecimal. |