Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: Michael Elizabeth Chastain <mec@shout.net>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA/c++testsuite] New test for constructor breakpoints
Date: Tue, 19 Feb 2002 15:35:00 -0000	[thread overview]
Message-ID: <20020219183534.A10918@nevyn.them.org> (raw)
In-Reply-To: <200202182025.g1IKPpc04061@duracef.shout.net>

On Mon, Feb 18, 2002 at 02:25:51PM -0600, Michael Elizabeth Chastain wrote:
> This patch is returned for rework.  I like the patch, but there is
> a cascade problem:
> 
>   "set_bp_overloaded foo::foo" tests FAIL
>   the breakpoints are not present
>   continue_to_bp_constructor issues "continue" unconditionally
>   the script loses synchronization with the program-under-test at this point
>   all the tests after that FAIL

Well, I had to file a bug on expect's manual page to get this to work,
but I did.  How's this patch?  The magic is in -notransfer.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

2002-02-19  Daniel Jacobowitz  <drow@mvista.com>

	* gdb.c++/ovldbreak.exp: Test breakpoints on the constructors.

Index: ovldbreak.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/ovldbreak.exp,v
retrieving revision 1.3
diff -u -r1.3 ovldbreak.exp
--- ovldbreak.exp	2001/01/28 23:49:43	1.3
+++ ovldbreak.exp	2002/02/19 23:32:27
@@ -231,8 +231,6 @@
 \[0-9\]+\[\t \]+breakpoint     keep y\[\t \]+$hex in foo::overload1arg\\((void|)\\) at.*$srcfile:110" \
     "breakpoint info (after cancel)"
 
-
-
 # Delete these breakpoints.
 
 send_gdb "delete breakpoints\n"
@@ -309,13 +307,58 @@
     "breakpoint info (after setting on all)"
 
 
+# Set breakpoints on the overloaded constructor.
+set menu_constructor "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::foo\\(foo ?&\\) at.*$srcfile:104\r\n\\\[3\\\] foo::foo\\(int, char const ?\\*\\) at.*$srcfile:103\r\n\\\[4\\\] foo::foo\\(int\\) at.*$srcfile:102\r\n> $"
 
+set_bp_overloaded "foo::foo" "$menu_constructor"	2	26	104
+set_bp_overloaded "foo::foo" "$menu_constructor"	3	27	103
+set_bp_overloaded "foo::foo" "$menu_constructor"	4	28	102
+
 # Run through each breakpoint.
 
-proc continue_to_bp_overloaded {bpnumber argtype actuals} {
+global last_bp_hit
+set last_bp_hit 300
+
+proc continue_to_bp_constructor {bpnumber argtypes args actuals} {
     global gdb_prompt hex decimal srcfile 
+    global last_bp_hit
+
+    if {$last_bp_hit < 26} {
+	fail "continue to bp overloaded constructor : ${argtypes} (overshot)"
+	return
+    }
 
     send_gdb "continue\n"
+    gdb_expect {
+	-re "Continuing.\r\n\r\nBreakpoint ${bpnumber}, (${hex} in )?foo::foo(\\(${argtypes}\\))? \\(this=${hex}(, )?${actuals}\\) at.*${srcfile}:${decimal}\r\n${decimal}\[\t \]+foo::foo  *\\(${args}\\).*\r\n.*$gdb_prompt $" {
+	    pass "continue to bp overloaded constructor : ${argtypes}"
+	}
+	-notransfer -re "Continuing.\r\n\r\nBreakpoint (\[0-9\]*).*$gdb_prompt $" {
+	    set last_bp_hit $expect_out(1,string)
+	    fail "continue to bp overloaded constructor : ${argtypes} (wrong breakpoint)"
+	}
+        -re ".*$gdb_prompt $" {
+	    fail "continue to bp overloaded constructor : ${argtypes}" 
+	}
+        timeout {
+	    fail "continue to bp overloaded constructor : ${argtypes} (timeout)"
+	}
+    }
+}
+
+continue_to_bp_constructor 28 "int" "int i" "i=111"
+continue_to_bp_constructor 27 "int, char const ?\\*" \
+	"int i, const char \\*ccp" "i=222, ccp=$hex \"A\""
+continue_to_bp_constructor 26 "foo ?&" "foo& afoo" "afoo=@$hex"
+
+proc continue_to_bp_overloaded {bpnumber argtype actuals} {
+    global gdb_prompt hex decimal srcfile
+    global last_bp_hit
+
+    if { $last_bp_hit != $bpnumber } {
+	send_gdb "continue\n"
+    }
+
     gdb_expect {
 	-re "Continuing.\r\n\r\nBreakpoint ${bpnumber}, (${hex} in )?foo::overload1arg(\\(${argtype}\\))? \\(this=${hex}(, )?${actuals}\\) at.*${srcfile}:${decimal}\r\n${decimal}\[\t \]+int foo::overload1arg \\(${argtype}( arg)?\\).*\r\n.*$gdb_prompt $" {
 	    pass "continue to bp overloaded : ${argtype}"


  parent reply	other threads:[~2002-02-19 23:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-18 12:26 Michael Elizabeth Chastain
2002-02-18 13:17 ` Daniel Jacobowitz
2002-02-19 15:35 ` Daniel Jacobowitz [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-02-19 16:04 Michael Elizabeth Chastain
2002-02-19 16:12 ` Daniel Jacobowitz
2002-02-16 11:11 Michael Elizabeth Chastain
2002-02-15 16:50 Michael Elizabeth Chastain
2002-02-15 18:28 ` Daniel Jacobowitz
2002-02-14 15:32 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=20020219183534.A10918@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=mec@shout.net \
    /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