2009-09-21 Phil Muldoon <pmuldoon@redhat.com>
authorPhil Muldoon <pmuldoon@redhat.com>
Mon, 21 Sep 2009 09:39:53 +0000 (09:39 +0000)
committerPhil Muldoon <pmuldoon@redhat.com>
Mon, 21 Sep 2009 09:39:53 +0000 (09:39 +0000)
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.

gdb/ChangeLog
gdb/c-lang.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.python/py-prettyprint.exp

index 54cae78c62183cc8b4b7608bd8a934b80f64c7b4..5b5c08dfb26e2786e11c374cad87e60399ae31d6 100644 (file)
@@ -1,3 +1,10 @@
+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
index 4ba81ba86aa637bfa643d0da31766e4dce44da65..d01490cdce0a89b01bd75e2cf2e36398844105d8 100644 (file)
@@ -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;
index defe02c8f9cbdbeefeb9c15a0862901797befed6..833fdcd486e2ea297656d8eb787699cc1085430c 100644 (file)
@@ -1,3 +1,11 @@
+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
index d2db5bc20646bfbb0e6f97964d8cb1e483e973ac..b4b3776bf7d29cf0f84a8bc1593de60d100dc52a 100644 (file)
@@ -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\""
This page took 0.045968 seconds and 4 git commands to generate.