Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gdb pretty-printers for simple types #11499

Merged
merged 9 commits into from
Sep 9, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions cpp/scripts/gdb-pretty-printers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@

import gdb


if "HostIterator" not in locals():
raise Exception("This file expects the RMM pretty-printers to be loaded already. "
global_locals = locals()
if not all(name in global_locals for name in ["HostIterator", "DeviceIterator", "is_template_type_not_alias", "template_match"]):
upsj marked this conversation as resolved.
Show resolved Hide resolved
raise NameError("This file expects the RMM pretty-printers to be loaded already. "
"Either load them manually, or use the generated load-pretty-printers "
"script in the build directory")



class CudfHostSpanPrinter(gdb.printing.PrettyPrinter):
"""Print a cudf::host_span"""

Expand All @@ -35,8 +34,7 @@ def children(self):
return HostIterator(self.pointer, self.size)

def to_string(self):
typename = str(self.val.type)
return ("{typename} of length {self.size} at {hex(self.pointer)}")
return ("{self.val.type} of length {self.size} at {hex(self.pointer)}")
upsj marked this conversation as resolved.
Show resolved Hide resolved

def display_hint(self):
return "array"
Expand All @@ -54,8 +52,7 @@ def children(self):
return DeviceIterator(self.pointer, self.size)

def to_string(self):
typename = str(self.val.type)
return ("{typename} of length {self.size} at {hex(self.pointer)}")
return ("{self.val.type} of length {self.size} at {hex(self.pointer)}")
upsj marked this conversation as resolved.
Show resolved Hide resolved

def display_hint(self):
return "array"
Expand Down