about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/etc/debugger_pretty_printers_common.py5
-rwxr-xr-xsrc/etc/gdb_rust_pretty_printing.py2
2 files changed, 6 insertions, 1 deletions
diff --git a/src/etc/debugger_pretty_printers_common.py b/src/etc/debugger_pretty_printers_common.py
index 7eb008a05f6..4a38d4be083 100644
--- a/src/etc/debugger_pretty_printers_common.py
+++ b/src/etc/debugger_pretty_printers_common.py
@@ -354,3 +354,8 @@ def extract_type_name(qualified_type_name):
         return qualified_type_name
     else:
         return qualified_type_name[index + 2:]
+
+try:
+    compat_str = unicode  # Python 2
+except NameError:
+    compat_str = str
diff --git a/src/etc/gdb_rust_pretty_printing.py b/src/etc/gdb_rust_pretty_printing.py
index aab15d9ed1e..822dc581404 100755
--- a/src/etc/gdb_rust_pretty_printing.py
+++ b/src/etc/gdb_rust_pretty_printing.py
@@ -78,7 +78,7 @@ class GdbValue(rustpp.Value):
 
     def as_integer(self):
         if self.gdb_val.type.code == gdb.TYPE_CODE_PTR:
-            as_str = unicode(self.gdb_val).split()[0]
+            as_str = rustpp.compat_str(self.gdb_val).split()[0]
             return int(as_str, 0)
         return int(self.gdb_val)