aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Muldoon <pmuldoon@redhat.com>2009-09-21 09:39:53 +0000
committerPhil Muldoon <pmuldoon@redhat.com>2009-09-21 09:39:53 +0000
commit7a9fe1016c6b3caf22ca50926331e6baca47ef9d (patch)
treef25d218b3253d782d80f7281244b9f18332baa61
parent2e4d963fb27e10835c44564788b9c3d25bc21119 (diff)
downloadgdb-7a9fe1016c6b3caf22ca50926331e6baca47ef9d.zip
gdb-7a9fe1016c6b3caf22ca50926331e6baca47ef9d.tar.gz
gdb-7a9fe1016c6b3caf22ca50926331e6baca47ef9d.tar.bz2
2009-09-21 Phil Muldoon <pmuldoon@redhat.com>
PR python/10633 * c-lang.c (c_printstr): Do not loop past options->print_max when iterating with wchar_iterate. 2009-09-21 Phil Muldoon <pmuldoon@redhat.com> PR python/10633 * gdb.python/py-prettyprint.exp (gdb_py_test_silent_cmd): New Function. (run_lang_tests): Add print elements test.
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/c-lang.c2
-rw-r--r--gdb/testsuite/ChangeLog8
-rw-r--r--gdb/testsuite/gdb.python/py-prettyprint.exp16
4 files changed, 32 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 54cae78..5b5c08d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
2009-09-21 Phil Muldoon <pmuldoon@redhat.com>
+ PR python/10633
+
+ * c-lang.c (c_printstr): Do not loop past options->print_max when
+ iterating with wchar_iterate.
+
+2009-09-21 Phil Muldoon <pmuldoon@redhat.com>
+
* python/py-value.c (valpy_getitem): Test value before allowing
subscript operation.
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 4ba81ba..d01490c 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -459,7 +459,7 @@ c_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string,
single character in isolation. This makes the code simpler
and probably does the sensible thing in the majority of
cases. */
- while (num_chars == 1)
+ while (num_chars == 1 && things_printed < options->print_max)
{
/* Count the number of repetitions. */
unsigned int reps = 0;
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index defe02c..833fdcd 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,13 @@
2009-09-21 Phil Muldoon <pmuldoon@redhat.com>
+ PR python/10633
+
+ * gdb.python/py-prettyprint.exp (gdb_py_test_silent_cmd): New
+ Function.
+ (run_lang_tests): Add print elements test.
+
+2009-09-21 Phil Muldoon <pmuldoon@redhat.com>
+
* gdb.python/py-value.exp (test_subscript_regression): New
function. Test for invalid subscripts.
* gdb.python/py-value.c (main): Add test array, and pointer to it.
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp
index d2db5bc..b4b3776 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.exp
+++ b/gdb/testsuite/gdb.python/py-prettyprint.exp
@@ -35,6 +35,17 @@ gdb_test_multiple "python print 'hello, world!'" "verify python support" {
-re "$gdb_prompt $" {}
}
+# Run a command in GDB, and report a failure if a Python exception is thrown.
+# If report_pass is true, report a pass if no exception is thrown.
+proc gdb_py_test_silent_cmd {cmd name report_pass} {
+ global gdb_prompt
+
+ gdb_test_multiple $cmd $name {
+ -re "Traceback.*$gdb_prompt $" { fail $name }
+ -re "$gdb_prompt $" { if $report_pass { pass $name } }
+ }
+}
+
proc run_lang_tests {lang} {
global srcdir subdir srcfile binfile testfile hex
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "debug $lang"] != "" } {
@@ -79,6 +90,11 @@ proc run_lang_tests {lang} {
gdb_test "print derived" \
" = \{.*<Vbase1> = pp class name: Vbase1.*<Vbase2> = \{.*<VirtualTest> = pp value variable is: 1,.*members of Vbase2:.*_vptr.Vbase2 = $hex.*<Vbase3> = \{.*members of Vbase3.*members of Derived:.*value = 2.*"
gdb_test "print ns " "\"embedded\\\\000null\\\\000string\""
+ gdb_py_test_silent_cmd "set print elements 3" "" 1
+ gdb_test "print ns" "emb\.\.\.."
+ gdb_py_test_silent_cmd "set print elements 10" "" 1
+ gdb_test "print ns" "embedded\\\\000n\.\.\.."
+ gdb_py_test_silent_cmd "set print elements 200" "" 1
}
gdb_test "print x" " = $hex \"this is x\""