33# https://www.boost.org/LICENSE_1_0.txt
44
55from detail .decode_decimal32 import decode_decimal32
6+ from detail .decode_decimal64 import decode_decimal64
67import lldb
78
89def decimal32_summary (valobj , internal_dict ):
@@ -19,8 +20,23 @@ def decimal32_summary(valobj, internal_dict):
1920 except Exception as e :
2021 return f"<invalid decimal32_t: { e } >"
2122
23+ def decimal64_summary (valobj , internal_dict ):
24+ """
25+ Custom summary for decimal64_t type
26+ Displays in scientific notation with cohort preservation
27+ """
28+
29+ try :
30+ val = valobj .GetNonSyntheticValue ()
31+ bits = val .GetChildMemberWithName ("bits_" ).GetValueAsUnsigned ()
32+ return decode_decimal64 (bits )
33+
34+ except Exception as e :
35+ return f"<invalid decimal64_t: { e } >"
36+
2237def __lldb_init_module (debugger , internal_dict ):
2338 decimal32_pattern = r"^(const )?(boost::decimal::decimal32_t|(\w+::)*decimal32_t)( &| \*)?$"
39+ decimal64_pattern = r"^(const )?(boost::decimal::decimal32_t|(\w+::)*decimal32_t)( &| \*)?$"
2440
2541 debugger .HandleCommand (
2642 f'type summary add -x "{ decimal32_pattern } " -e -F decimal_printer.decimal32_summary'
@@ -31,6 +47,15 @@ def __lldb_init_module(debugger, internal_dict):
3147
3248 print ("decimal32_t printer loaded successfully" )
3349
50+ debugger .HandleCommand (
51+ f'type summary add -x "{ decimal64_pattern } " -e -F decimal_printer.decimal64_summary'
52+ )
53+ debugger .HandleCommand (
54+ f'type synthetic add -x "{ decimal64_pattern } " -l decimal_printer.DecimalSyntheticProvider'
55+ )
56+
57+ print ("decimal64_t printer loaded successfully" )
58+
3459class DecimalSyntheticProvider :
3560 def __init__ (self , valobj , internal_dict ):
3661 self .valobj = valobj
0 commit comments