mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
#5617: add a handy function to print a unicode string to gdbinit.
This commit is contained in:
parent
9e47ce49a0
commit
44fb2a9314
1 changed files with 13 additions and 0 deletions
13
Misc/gdbinit
13
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue