]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/auxiliary/dependency-with-embedded-visualizers.py
Rollup merge of #107819 - clubby789:x-py-root, r=jyn514
[rust.git] / tests / debuginfo / auxiliary / dependency-with-embedded-visualizers.py
1 import gdb
2
3 class PersonPrinter:
4     "Print a Person"
5
6     def __init__(self, val):
7         self.val = val
8         self.name = val["name"]
9         self.age = int(val["age"])
10
11     def to_string(self):
12         return "{} is {} years old.".format(self.name, self.age)
13
14 def lookup(val):
15     lookup_tag = val.type.tag
16     if lookup_tag is None:
17         return None
18     if "dependency_with_embedded_visualizers::Person" == lookup_tag:
19         return PersonPrinter(val)
20
21     return None
22
23 gdb.current_objfile().pretty_printers.append(lookup)