Skip to content

Commit

Permalink
Update GDB pretty printer
Browse files Browse the repository at this point in the history
  • Loading branch information
falbrechtskirchinger committed Aug 9, 2022
1 parent 3977d66 commit aaca005
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/gdb_pretty_printer/nlohmann-json.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import gdb
import re

ns_pattern = re.compile(r'nlohmann::json_v(?P<v_major>\d+)_(?P<v_minor>\d+)_(?P<v_patch>\d+)(?P<tags>\w*)::(?P<name>.+)')
ns_pattern = re.compile(r'nlohmann(::json_abi(?P<tags>\w*)(_v(?P<v_major>\d+)_(?P<v_minor>\d+)_(?P<v_patch>\d+))?)?::(?P<name>.+)')
class JsonValuePrinter:
"Print a json-value"

Expand All @@ -26,7 +26,7 @@ def json_lookup_function(val):
return gdb.default_visualizer(union_val.dereference())
else:
return JsonValuePrinter(union_val)
except:
except Exception:
return JsonValuePrinter(val['m_type'])

gdb.pretty_printers.append(json_lookup_function)

0 comments on commit aaca005

Please sign in to comment.