From: Yao Qi <yao@codesourcery.com>
To: <gdb-patches@sourceware.org>
Subject: [PATCH 2/4] Test case of conditional dprintf
Date: Thu, 28 Feb 2013 13:17:00 -0000 [thread overview]
Message-ID: <1362057362-25324-2-git-send-email-yao@codesourcery.com> (raw)
In-Reply-To: <1362057362-25324-1-git-send-email-yao@codesourcery.com>
This is to test that dprintf works well with condition. Since print
stuff in dprintf is implemented as commands, so there should be no
FAIL without patch 1/5 applied.
Note that this case is similar to
PR 15179 - Dprintf interrupts execution when condition is false
but I am still unable to reproduce this PR. dprintf-cond.exp can easily
extended to reproduce PR 15180 in next step.
gdb/testsuite:
2013-02-28 Yao Qi <yao@codesourcery.com>
* gdb.base/dprintf-cond.exp: New.
---
gdb/testsuite/gdb.base/dprintf-cond.exp | 75 +++++++++++++++++++++++++++++++
1 files changed, 75 insertions(+), 0 deletions(-)
create mode 100644 gdb/testsuite/gdb.base/dprintf-cond.exp
diff --git a/gdb/testsuite/gdb.base/dprintf-cond.exp b/gdb/testsuite/gdb.base/dprintf-cond.exp
new file mode 100644
index 0000000..b692124
--- /dev/null
+++ b/gdb/testsuite/gdb.base/dprintf-cond.exp
@@ -0,0 +1,75 @@
+# Copyright 2013 Free Software Foundation, Inc.
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+standard_testfile pr15075.c
+
+set executable $testfile
+set expfile $testfile.exp
+
+set dp_location [gdb_get_line_number "set dprintf here"]
+set bp_location [expr $dp_location + 1]
+
+if [prepare_for_testing $expfile $executable $srcfile {debug}] {
+ untested "failed to prepare for trace tests"
+ return -1
+}
+
+proc test_dprintf { style } { with_test_prefix "$style" {
+
+ global executable
+ global dp_location bp_location
+
+ # Start with a fresh gdb.
+ clean_restart ${executable}
+ if ![runto_main] {
+ fail "Can't run to main"
+ return -1
+ }
+
+ gdb_test_no_output "set dprintf-style ${style}" \
+ "Set dprintf style"
+ gdb_test "dprintf $dp_location, \"false, %d\\n\", x" \
+ "Dprintf 2 at .*" "dprintf 1"
+ gdb_test "cond 2 x == 5"
+
+ gdb_test "dprintf $dp_location, \"true, %d\\n\", x" \
+ "Dprintf 3 at .*" "dprintf 2"
+ gdb_test "cond 3 x > 5"
+
+ gdb_test "break $bp_location" "Breakpoint .*"
+
+ gdb_test "continue" "true, 6\\r\\n\\r\\n.*" "continue"
+
+ # Test program stops on the right breakpoint.
+ gdb_test "p x" ".* = 7"
+
+ # Test the hit count of dprintf breakpoints.
+ gdb_test_sequence "info breakpoints" "dprintf info" {
+ "\[\r\n\]Num Type Disp Enb Address +What"
+ "\[\r\n\]1 breakpoint"
+ "\[\r\n\]2 dprintf"
+ "\[\r\n\]\tstop only if x == 5"
+ "\[\r\n\]"
+ "\[\r\n\]3 dprintf"
+ "\[\r\n\]\tstop only if x > 5"
+ "\[\r\n\]\tbreakpoint already hit 1 time"
+ "\[\r\n\]"
+ }
+}}
+
+test_dprintf "gdb"
+
+if ![target_info exists gdb,noinferiorio] {
+ test_dprintf "call"
+}
--
1.7.7.6
next prev parent reply other threads:[~2013-02-28 13:17 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-18 13:09 [RFC] PR 15075 dprintf interferes with "next" Yao Qi
2013-02-18 21:36 ` Joel Brobecker
2013-02-21 16:36 ` Tom Tromey
2013-04-24 1:24 ` Hui Zhu
2013-04-24 6:06 ` Keith Seitz
2013-04-24 13:30 ` Hui Zhu
2013-04-24 14:03 ` Yao Qi
2013-04-24 14:09 ` Hui Zhu
2013-05-16 7:29 ` Hui Zhu
2013-05-17 21:01 ` Pedro Alves
2013-05-22 10:22 ` Hui Zhu
2013-05-22 12:46 ` Pedro Alves
2013-05-28 0:02 ` Hui Zhu
2013-05-28 3:36 ` Yao Qi
2013-05-29 10:08 ` Hui Zhu
2013-06-03 4:07 ` Hui Zhu
2013-06-03 17:48 ` Pedro Alves
2013-06-07 3:16 ` Hui Zhu
2013-06-17 7:36 ` Hui Zhu
2013-06-18 18:16 ` Pedro Alves
2013-06-24 8:36 ` Hui Zhu
2013-06-24 22:06 ` Pedro Alves
2013-06-25 9:14 ` Hui Zhu
2013-06-25 11:47 ` Pedro Alves
2013-06-25 13:02 ` Hui Zhu
2013-06-25 14:06 ` Pedro Alves
2013-06-26 2:54 ` Hui Zhu
2013-05-22 14:04 ` Tom Tromey
2013-02-22 17:39 ` DPrintf feedback (was: [RFC] PR 15075 dprintf interferes with "next") Marc Khouzam
2013-02-22 19:32 ` DPrintf feedback Tom Tromey
2013-02-22 20:37 ` Marc Khouzam
2013-02-26 21:12 ` Marc Khouzam
2013-02-28 15:32 ` [PATCH 1/4] Fix dprintf bugs Yao Qi
2013-02-28 13:17 ` Yao Qi [this message]
2013-02-28 13:17 ` [PATCH 3/4] Test dprintf breakpoint works correctly with other breakpoints Yao Qi
2013-02-28 14:48 ` [PATCH 4/4] Test case on setting dprintf commands Yao Qi
2013-02-28 16:30 ` [PATCH 1/4] Fix dprintf bugs Eli Zaretskii
2013-03-07 7:45 ` Yao Qi
2013-03-03 2:21 ` Marc Khouzam
2013-03-07 6:47 ` Yao Qi
2013-03-07 14:06 ` Marc Khouzam
2013-03-07 14:36 ` Yao Qi
2013-03-07 14:49 ` Marc Khouzam
2013-03-07 14:59 ` Yao Qi
2013-03-08 15:49 ` Marc Khouzam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1362057362-25324-2-git-send-email-yao@codesourcery.com \
--to=yao@codesourcery.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox