summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/py-prettyprint.py
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2015-05-26 16:13:04 -0700
committerDoug Evans <dje@google.com>2015-05-26 16:13:04 -0700
commit4ea6efe9365f8a87723fe01a2dd8ddf5cdec1498 (patch)
tree4b7f62a729813fe82e914f2144df6815ddecb4aa /gdb/testsuite/gdb.python/py-prettyprint.py
parentb93fd21dccc2cfa9a335ddba7435a341b49330ae (diff)
downloadbinutils-gdb-4ea6efe9365f8a87723fe01a2dd8ddf5cdec1498.tar.gz
PR python/18438
gdb/ChangeLog: * python/py-lazy-string.c (stpy_convert_to_value): Use gdbpy_gdb_memory_error not PyExc_MemoryError. (gdbpy_create_lazy_string_object): Ditto. gdb/testsuite/ChangeLog: * gdb.python/py-lazy-string.c: New file. * gdb.python/py-lazy-string.exp: New file. * gdb.python/py-prettyprint.c (lazystring) <len>: New member. (main): Update. Add estring3. * gdb.python/py-prettyprint.exp: Add tests for strings at address 0. * gdb.python/py-prettyprint.py (pp_ls): Handle length.
Diffstat (limited to 'gdb/testsuite/gdb.python/py-prettyprint.py')
-rw-r--r--gdb/testsuite/gdb.python/py-prettyprint.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.py b/gdb/testsuite/gdb.python/py-prettyprint.py
index c350bfe9cad..442813b5e7c 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.py
+++ b/gdb/testsuite/gdb.python/py-prettyprint.py
@@ -152,10 +152,20 @@ class pp_ls (object):
self.val = val
def to_string(self):
+ length = self.val['len']
if pp_ls_encoding is not None:
- return self.val['lazy_str'].lazy_string(encoding = pp_ls_encoding)
+ if length >= 0:
+ return self.val['lazy_str'].lazy_string(
+ encoding = pp_ls_encoding,
+ length = length)
+ else:
+ return self.val['lazy_str'].lazy_string(
+ encoding = pp_ls_encoding)
else:
- return self.val['lazy_str'].lazy_string()
+ if length >= 0:
+ return self.val['lazy_str'].lazy_string(length = length)
+ else:
+ return self.val['lazy_str'].lazy_string()
def display_hint (self):
return 'string'