diff options
author | JSDurand <mmemmew@gmail.com> | 2023-07-22 11:37:03 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2023-07-22 11:37:03 +0800 |
commit | ca1a2fa607a3ce95d8cf68f1a7a481d62b0ecf72 (patch) | |
tree | 1ac71beef7f62c36dfc1add612e10dfe6944eaa2 /chain/src | |
parent | 0bf1d3d9d883d0b63792c68541b23404aae0ec8f (diff) |
Add experimental python scripts for debugging
* chain/src/item/default/printer.lldb:
* chain/src/item/default/printer.py: These are for experimenting with
debugger supports.
Diffstat (limited to 'chain/src')
-rw-r--r-- | chain/src/item/default/printer.lldb | 1 | ||||
-rw-r--r-- | chain/src/item/default/printer.py | 33 |
2 files changed, 34 insertions, 0 deletions
diff --git a/chain/src/item/default/printer.lldb b/chain/src/item/default/printer.lldb new file mode 100644 index 0000000..eb0032a --- /dev/null +++ b/chain/src/item/default/printer.lldb @@ -0,0 +1 @@ +type summary add -x "DefaultForest" -e -F ForestPrinter
\ No newline at end of file diff --git a/chain/src/item/default/printer.py b/chain/src/item/default/printer.py new file mode 100644 index 0000000..5670545 --- /dev/null +++ b/chain/src/item/default/printer.py @@ -0,0 +1,33 @@ +import lldb + +class ForestPrinter: + "Print a Forest" + + def __init__(self, val): + self.forest = val + self.root = val["root"] + self.graph = val["graph"] + + def to_string(self): + return "a forest with root {} and graph {}".format(self.root, self.graph) + +def lookup(val): + lookup_tag = val.type.tag + if lookup_tag is None: + return None + if lookup_tag.startswith("chain::item::default::DefaultForest"): + return ForestPrinter(val) + + return None + + +def ForestPrint(valobj, dict): + objtype = valobj.type + + print(dir(valobj)) + print(valobj.GetValue()) + + return "hihi" + +# co sc i -r ../chain/src/item/default/printer.py +# type summary add -x "DefaultForest" -e -F printer.ForestPrint --category Rust |