summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-03-31 22:35:46 +0000
committerGeorg Brandl <georg@python.org>2009-03-31 22:35:46 +0000
commit44fb2a93140269612090e237d87cd301643bda3d (patch)
tree484086678d46189ac6971b95bf2ca7b6329d5af1
parent9e47ce49a06075adbc391e04b4457707fa3892a7 (diff)
downloadcpython-git-44fb2a93140269612090e237d87cd301643bda3d.tar.gz
#5617: add a handy function to print a unicode string to gdbinit.
-rw-r--r--Misc/gdbinit13
1 files changed, 13 insertions, 0 deletions
diff --git a/Misc/gdbinit b/Misc/gdbinit
index f3cb2ead06..e648f1647b 100644
--- a/Misc/gdbinit
+++ b/Misc/gdbinit
@@ -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