Skip to content

Commit 01da82e

Browse files
authored
Fix gdb pretty printer (nlohmann#4343)
1 parent 97f0bda commit 01da82e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/gdb_pretty_printer/nlohmann-json.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ def json_lookup_function(val):
1717
if m := ns_pattern.fullmatch(str(val.type.strip_typedefs().name)):
1818
name = m.group('name')
1919
if name and name.startswith('basic_json<') and name.endswith('>'):
20-
m = ns_pattern.fullmatch(str(val['m_type']))
20+
m = ns_pattern.fullmatch(str(val["m_data"]['m_type']))
2121
t = m.group('name')
2222
if t and t.startswith('detail::value_t::'):
2323
try:
24-
union_val = val['m_value'][t.removeprefix('detail::value_t::')]
24+
union_val = val["m_data"]['m_value'][t.removeprefix('detail::value_t::')]
2525
if union_val.type.code == gdb.TYPE_CODE_PTR:
2626
return gdb.default_visualizer(union_val.dereference())
2727
else:
2828
return JsonValuePrinter(union_val)
2929
except Exception:
30-
return JsonValuePrinter(val['m_type'])
30+
return JsonValuePrinter(val["m_data"]['m_type'])
3131

3232
gdb.pretty_printers.append(json_lookup_function)

0 commit comments

Comments
 (0)