Add support for embedding pretty printers via the #[debugger_visualizer]
attribute. Add tests for embedding pretty printers and update documentation.
Ensure all error checking for `#[debugger_visualizer]` is done up front and not when the `debugger_visualizer` query is run. Clean up potential ODR violations when embedding pretty printers into the `__rustc_debug_gdb_scripts_section__` section. Respond to PR comments and update documentation.
This commit is contained in:
parent
ee9726cb10
commit
60458b97e7
27 changed files with 455 additions and 200 deletions
23
src/test/debuginfo/embedded-visualizer.py
Normal file
23
src/test/debuginfo/embedded-visualizer.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
import gdb
|
||||
|
||||
class LinePrinter:
|
||||
"Print a Line"
|
||||
|
||||
def __init__(self, val):
|
||||
self.val = val
|
||||
self.a = val["a"]
|
||||
self.b = val["b"]
|
||||
|
||||
def to_string(self):
|
||||
return "({}, {})".format(self.a, self.b)
|
||||
|
||||
def lookup(val):
|
||||
lookup_tag = val.type.tag
|
||||
if lookup_tag is None:
|
||||
return None
|
||||
if "embedded_visualizer::Line" == lookup_tag:
|
||||
return LinePrinter(val)
|
||||
|
||||
return None
|
||||
|
||||
gdb.current_objfile().pretty_printers.append(lookup)
|
Loading…
Add table
Add a link
Reference in a new issue