]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/embedded-visualizer-point.py
Add 'src/tools/rust-analyzer/' from commit '977e12a0bdc3e329af179ef3a9d466af9eb613bb'
[rust.git] / src / test / debuginfo / embedded-visualizer-point.py
1 import gdb
2
3 class PointPrinter:
4     "Print a Point"
5
6     def __init__(self, val):
7         self.val = val
8         self.x = int(val["x"])
9         self.y = int(val["y"])
10
11     def to_string(self):
12         return "({}, {})".format(self.x, self.y)
13
14 def lookup(val):
15     lookup_tag = val.type.tag
16     if lookup_tag is None:
17         return None
18     if "embedded_visualizer::point::Point" == lookup_tag:
19         return PointPrinter(val)
20
21     return None
22
23 gdb.current_objfile().pretty_printers.append(lookup)