aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2010-10-18 19:14:03 +0000
committerTom Tromey <tromey@redhat.com>2010-10-18 19:14:03 +0000
commit3a772aa44dcb36507c4a4ed13a0d161d808beed9 (patch)
tree3f62aaa287dce7d374a66fff8c02ff48ab40ff4a /gdb
parentca346ede183f75655d287f355ea811f34b600d0c (diff)
downloadfsf-binutils-gdb-3a772aa44dcb36507c4a4ed13a0d161d808beed9.zip
fsf-binutils-gdb-3a772aa44dcb36507c4a4ed13a0d161d808beed9.tar.gz
fsf-binutils-gdb-3a772aa44dcb36507c4a4ed13a0d161d808beed9.tar.bz2
gdb
* valprint.c (val_print_string): Pass 'encoding' to LA_PRINT_STRING. gdb/testsuite * 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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/testsuite/ChangeLog9
-rw-r--r--gdb/testsuite/gdb.python/py-prettyprint.c8
-rw-r--r--gdb/testsuite/gdb.python/py-prettyprint.exp4
-rw-r--r--gdb/testsuite/gdb.python/py-prettyprint.py7
-rw-r--r--gdb/valprint.c2
6 files changed, 31 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d1f4477..a98fde1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+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.
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 9254c5d..9208bb4 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+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.
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.c b/gdb/testsuite/gdb.python/py-prettyprint.c
index 66a9014..b633111 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.c
+++ b/gdb/testsuite/gdb.python/py-prettyprint.c
@@ -213,6 +213,9 @@ main ()
/* 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;
@@ -225,13 +228,14 @@ main ()
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;
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp
index 057443e..b8f37d3 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.exp
+++ b/gdb/testsuite/gdb.python/py-prettyprint.exp
@@ -91,6 +91,10 @@ proc run_lang_tests {lang} {
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}"
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.py b/gdb/testsuite/gdb.python/py-prettyprint.py
index 23d8271..e7a0feb 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.py
+++ b/gdb/testsuite/gdb.python/py-prettyprint.py
@@ -139,6 +139,8 @@ class pp_ns:
def display_hint (self):
return 'string'
+pp_ls_encoding = None
+
class pp_ls:
"Print a std::basic_string of some kind"
@@ -146,7 +148,10 @@ class pp_ls:
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'
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 4b3789e..09da426 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -1489,7 +1489,7 @@ val_print_string (struct type *elttype, const char *encoding,
fputs_filtered (" ", stream);
}
LA_PRINT_STRING (stream, elttype, buffer, bytes_read / width,
- NULL, force_ellipsis, options);
+ encoding, force_ellipsis, options);
}
if (errcode != 0)