]> granicus.if.org Git - python/commitdiff
#5617: add a handy function to print a unicode string to gdbinit.
authorGeorg Brandl <georg@python.org>
Tue, 31 Mar 2009 22:35:46 +0000 (22:35 +0000)
committerGeorg Brandl <georg@python.org>
Tue, 31 Mar 2009 22:35:46 +0000 (22:35 +0000)
Misc/gdbinit

index f3cb2ead060b3b847ec9e2bdb340f8159c11e515..e648f1647bc266c1856a327fdddea01ede156cce 100644 (file)
@@ -138,3 +138,16 @@ define pystackv
     end
     select-frame 0
 end
+
+# generally useful macro to print a Unicode string
+def pu
+  set $uni = $arg0 
+  set $i = 0
+  while (*$uni && $i++<100)
+    if (*$uni < 0x80) 
+      print *(char*)$uni++
+    else
+      print /x *(short*)$uni++
+    end
+  end
+end