summaryrefslogtreecommitdiff
path: root/solenv/gdb/libreoffice/util/string.py
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2017-09-29 16:53:35 +0200
committerMichael Stahl <Michael.Stahl@cib.de>2018-09-12 10:38:46 +0200
commit8ebdb3ad07d953ed90363562cd3f966af3fa78d9 (patch)
tree210e4b5f6334a1476a036118eade7c655ff74b53 /solenv/gdb/libreoffice/util/string.py
parentd61ab7e75369985f640496ebae3b56f18fbd4d2b (diff)
gdb pretty-printers: fix StringPrinterHelper for gdb 8.0
Latest gdb release "lazy_string" validates the array size: Traceback (most recent call last): File "/work/lo/master/solenv/gdb/libreoffice/util/string.py", line 29, in to_string return self.make_string(data, self.encoding, len) File "/work/lo/master/solenv/gdb/libreoffice/util/string.py", line 66, in make_string return data.lazy_string(encoding, length) gdb.error: Length is larger than array size. rtl_uString has "sal_Unicode buffer[1];", which is a lie as the real size is the same as "length". Taking the address of "buffer" appears to avoid the exception. Change-Id: I85710b1adfae584ba09c8d517e9b49b290e79d8a (cherry picked from commit 205677c88cb01e2bbee278443867baed2c89e5fe)
Diffstat (limited to 'solenv/gdb/libreoffice/util/string.py')
-rw-r--r--solenv/gdb/libreoffice/util/string.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/solenv/gdb/libreoffice/util/string.py b/solenv/gdb/libreoffice/util/string.py
index 4583f5960ae1..9f7cb70028b5 100644
--- a/solenv/gdb/libreoffice/util/string.py
+++ b/solenv/gdb/libreoffice/util/string.py
@@ -52,15 +52,15 @@ class StringPrinterHelper(object):
if not encoding:
encoding = ''
- if use_lazy_string:
- return data.lazy_string(encoding, length)
-
# we need to determine length, if not given (for sal_Unicode*)
if length < 0:
length = 0
while data[length] != 0 and length <= 512: # arbitrary limit
length += 1
+ if use_lazy_string:
+ return data.lazy_string(encoding, length)
+
# The gdb.Value.string() conversion works on array of bytes, but
# the length we have is the length of the string. So we must
# multiply it by width of character if the string is Unicode.