]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/embedded-visualizer.py
Rollup merge of #106707 - ehuss:remove-dupe-sha-1, r=Mark-Simulacrum
[rust.git] / tests / debuginfo / embedded-visualizer.py
1 import gdb
2
3 class LinePrinter:
4     "Print a Line"
5
6     def __init__(self, val):
7         self.val = val
8         self.a = val["a"]
9         self.b = val["b"]
10
11     def to_string(self):
12         return "({}, {})".format(self.a, self.b)
13
14 def lookup(val):
15     lookup_tag = val.type.tag
16     if lookup_tag is None:
17         return None
18     if "embedded_visualizer::Line" == lookup_tag:
19         return LinePrinter(val)
20
21     return None
22
23 gdb.current_objfile().pretty_printers.append(lookup)