+2010-10-18 Tom Tromey <tromey@redhat.com>
+
+ * valprint.c (val_print_string): Pass 'encoding' to
+ LA_PRINT_STRING.
+
2010-10-17 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix the `stopped language detection' testcase for gcc-4.5.
+2010-10-18 Tom Tromey <tromey@redhat.com>
+
+ * gdb.python/py-prettyprint.exp (run_lang_tests): Test encoding
+ argument to lazy_string.
+ * gdb.python/py-prettyprint.py (pp_ls_encoding): New global.
+ (pp_ls.to_string): Use it.
+ * gdb.python/py-prettyprint.c (main): Move declarations to top.
+ Add "estring2" local.
+
2010-10-17 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix s390x compatibility.
/* Clearing by being `static' could invoke an other GDB C++ bug. */
struct nullstr nullstr;
nostring_type nstype;
+ struct ns ns;
+ struct lazystring estring, estring2;
+
nstype.elements = narray;
nstype.len = 0;
init_s (&arraystruct.x[0], 23);
init_s (&arraystruct.x[1], 24);
- struct ns ns;
ns.null_str = "embedded\0null\0string";
ns.length = 20;
- struct lazystring estring;
estring.lazy_str = "embedded x\201\202\203\204" ;
+ /* Incomplete UTF-8, but ok Latin-1. */
+ estring2.lazy_str = "embedded x\302";
+
#ifdef __cplusplus
S cps;
gdb_test "print cstring" " = \"const string\""
gdb_test "print estring" "\"embedded x\\\\201\\\\202\\\\203\\\\204\""
+
+ gdb_test_no_output "python pp_ls_encoding = 'UTF-8'"
+ gdb_test "print estring2" "\"embedded \", <incomplete sequence \\\\302>"
+
gdb_test "print c" " = container \"container\" with 2 elements = {$nl *.0. = 23,$nl *.1. = 72$nl}"
gdb_test "print nstype" " = {$nl *.0. = 7,$nl *.1. = 42$nl}"
def display_hint (self):
return 'string'
+pp_ls_encoding = None
+
class pp_ls:
"Print a std::basic_string of some kind"
self.val = val
def to_string(self):
- return self.val['lazy_str'].lazy_string()
+ if pp_ls_encoding is not None:
+ return self.val['lazy_str'].lazy_string(encoding = pp_ls_encoding)
+ else:
+ return self.val['lazy_str'].lazy_string()
def display_hint (self):
return 'string'
fputs_filtered (" ", stream);
}
LA_PRINT_STRING (stream, elttype, buffer, bytes_read / width,
- NULL, force_ellipsis, options);
+ encoding, force_ellipsis, options);
}
if (errcode != 0)