From: Luuk van Dijk Date: Sun, 20 Feb 2011 17:53:23 +0000 (+0100) Subject: runtime-gdb.py: gdb pretty printer for go strings properly handles length. X-Git-Tag: weekly.2011-02-24~53 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=db22e236fd1dea780aefbbd90a705bd631934d91;p=gostls13.git runtime-gdb.py: gdb pretty printer for go strings properly handles length. R=rsc, r2 CC=golang-dev https://golang.org/cl/4183060 --- diff --git a/src/pkg/runtime/runtime-gdb.py b/src/pkg/runtime/runtime-gdb.py index 677e9bde4c..68dd8abdc6 100644 --- a/src/pkg/runtime/runtime-gdb.py +++ b/src/pkg/runtime/runtime-gdb.py @@ -13,7 +13,7 @@ path to this file based on the path to the runtime package. # - pretty printing only works for the 'native' strings. E.g. 'type # foo string' will make foo a plain struct in the eyes of gdb, # circumventing the pretty print triggering. -# - + import sys, re @@ -39,7 +39,8 @@ class StringTypePrinter: return 'string' def to_string(self): - return self.val['str'] + l = int(self.val['len']) + return self.val['str'].string("utf-8", "ignore", l) class SliceTypePrinter: