Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Vladimir Prus <vladimir@codesourcery.com>
To: gdb-patches@sources.redhat.com
Subject: [RFA] Fix -break-insert -i.
Date: Tue, 22 Jan 2008 19:27:00 -0000	[thread overview]
Message-ID: <200801222226.35445.vladimir@codesourcery.com> (raw)


It appears my breakpoint refactoring broke the -i parameter (ignore count)
for -break-insert. This patch fixes that, as well as adding a test for
that feature. OK?

- Volodya

	gdb/
	* breakpoint.c (break_command_really): New parameter
	ignore_count.
        (break_command_1): Pass 0 as
	ignore_count to break_command_really.
	(gdb_breakpoint): Pass ignore_count to
	break_command_really.

	gdb/testsuite
	* gdb.mi/basics.c: Setup for testing breakpoints
	ignore count.
	* gdb.mi/mi-break.exp: Test for breakpoint ignore count.
	* gdb.mi/mi-cli.exp: Adjust.
	* gdb.mi/mi2-cli.exp: Adjust.
---
 gdb/breakpoint.c                  |   12 +++++++-----
 gdb/testsuite/gdb.mi/basics.c     |    8 ++++++++
 gdb/testsuite/gdb.mi/mi-break.exp |   24 ++++++++++++++++++++++++
 gdb/testsuite/gdb.mi/mi-cli.exp   |    2 +-
 gdb/testsuite/gdb.mi/mi2-cli.exp  |    2 +-
 5 files changed, 41 insertions(+), 7 deletions(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 60fbbe5..9551bd5 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -5237,10 +5237,11 @@ find_condition_and_thread (char *tok, CORE_ADDR pc,
 
 static int
 break_command_really (char *arg, char *cond_string, int thread,
-                      int parse_condition_and_thread,
-                      int tempflag, int hardwareflag, 
-                      enum auto_boolean pending_break_support,
-                      int from_tty)
+		      int parse_condition_and_thread,
+		      int tempflag, int hardwareflag, 
+		      int ignore_count,
+		      enum auto_boolean pending_break_support,
+		      int from_tty)
 {
   struct gdb_exception e;
   struct symtabs_and_lines sals;
@@ -5254,7 +5255,6 @@ break_command_really (char *arg, char *cond_string, int thread,
   struct captured_parse_breakpoint_args parse_args;
   int i;
   int pending = 0;
-  int ignore_count = 0;
   int not_found = 0;
 
   sals.sals = NULL;
@@ -5427,6 +5427,7 @@ break_command_1 (char *arg, int flag, int from_tty)
   return break_command_really (arg, 
 			       NULL, 0, 1 /* parse arg */,
 			       tempflag, hardwareflag,
+			       0 /* Ignore count */,
 			       pending_break_support, from_tty);
 }
 
@@ -5441,6 +5442,7 @@ gdb_breakpoint (char *address, char *condition,
   return break_command_really (address, condition, thread,
 			       0 /* condition and thread are valid.  */,
 			       tempflag, hardwareflag,
+			       ignore_count,
 			       pending 
 			       ? AUTO_BOOLEAN_TRUE : AUTO_BOOLEAN_FALSE,
 			       0);
diff --git a/gdb/testsuite/gdb.mi/basics.c b/gdb/testsuite/gdb.mi/basics.c
index d56bf9d..5b52112 100644
--- a/gdb/testsuite/gdb.mi/basics.c
+++ b/gdb/testsuite/gdb.mi/basics.c
@@ -46,6 +46,11 @@ callee1 (int intarg, char *strarg, double fltarg)
   callee2 (intarg, strarg);
 }
 
+void callme (int i)
+{
+  printf ("callme\n");
+}
+
 main ()
 {
   callee1 (2, "A string argument.", 3.5);
@@ -53,6 +58,9 @@ main ()
 
   printf ("Hello, World!");
 
+  callme (1);
+  callme (2);
+
   return 0;
 }
 
diff --git a/gdb/testsuite/gdb.mi/mi-break.exp b/gdb/testsuite/gdb.mi/mi-break.exp
index b51fd18..af438b9 100644
--- a/gdb/testsuite/gdb.mi/mi-break.exp
+++ b/gdb/testsuite/gdb.mi/mi-break.exp
@@ -153,8 +153,32 @@ proc test_rbreak_creation_and_listing {} {
 	    "delete temp breakpoints"
 }
 
+proc test_ignore_count {} {
+    global mi_gdb_prompt
+
+    mi_gdb_test "-break-insert -i 1 callme" \
+        "\\^done.*ignore=\"1\".*" \
+        "insert breakpoint with ignore count at callme"
+
+    mi_run_cmd
+
+    gdb_expect {
+        -re ".*func=\"callme\".*args=\\\[\{name=\"i\",value=\"2\"\}\\\].*\r\n$mi_gdb_prompt$" {
+            pass "run to breakpoint with ignore count"
+        }
+        -re ".*$mi_gdb_prompt$" {
+            fail "run to breakpoint with ignore count"
+        }
+        timeout {
+            fail "run to breakpoint with ignore count (timeout)"
+        }
+    }  
+}
+
 test_tbreak_creation_and_listing
 test_rbreak_creation_and_listing
 
+test_ignore_count
+
 mi_gdb_exit
 return 0
diff --git a/gdb/testsuite/gdb.mi/mi-cli.exp b/gdb/testsuite/gdb.mi/mi-cli.exp
index 64789b5..ef674b0 100644
--- a/gdb/testsuite/gdb.mi/mi-cli.exp
+++ b/gdb/testsuite/gdb.mi/mi-cli.exp
@@ -186,7 +186,7 @@ gdb_expect {
 }
 
 mi_gdb_test "-interpreter-exec console \"list\"" \
-  "\~\"$line_main_return\[\\\\t ]*return 0;\\\\n\".*\\^done" \
+  "\~\"$line_main_return\[\\\\t ]*callme \\(1\\);\\\\n\".*\\^done" \
   "-interpreter-exec console \"list\" at basics.c:\$line_main_return"
 
 mi_gdb_test "-interpreter-exec console \"help set args\"" \
diff --git a/gdb/testsuite/gdb.mi/mi2-cli.exp b/gdb/testsuite/gdb.mi/mi2-cli.exp
index ee8d47d..7879bd7 100644
--- a/gdb/testsuite/gdb.mi/mi2-cli.exp
+++ b/gdb/testsuite/gdb.mi/mi2-cli.exp
@@ -186,7 +186,7 @@ gdb_expect {
 }
 
 mi_gdb_test "-interpreter-exec console \"list\"" \
-  "\~\"$line_main_return\[\\\\t ]*return 0;\\\\n\".*\\^done" \
+  "\~\"$line_main_return\[\\\\t ]*callme \\(1\\);\\\\n\".*\\^done" \
   "-interpreter-exec console \"list\" at basics.c:\$line_main_return"
 
 mi_gdb_test "-interpreter-exec console \"help set args\"" \
-- 
1.5.3.5


             reply	other threads:[~2008-01-22 19:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-22 19:27 Vladimir Prus [this message]
2008-01-22 19:30 ` Daniel Jacobowitz

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=200801222226.35445.vladimir@codesourcery.com \
    --to=vladimir@codesourcery.com \
    --cc=gdb-patches@sources.redhat.com \
    /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