Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: Pedro Alves <alves.ped@gmail.com>
Cc: Pedro Alves <palves@redhat.com>, <gdb-patches@sourceware.org>
Subject: Re: [PATCH 5/6] Test tracepoints are installed or not
Date: Wed, 12 Dec 2012 02:59:00 -0000	[thread overview]
Message-ID: <50C7F30C.1050906@codesourcery.com> (raw)
In-Reply-To: <50C7731A.7040007@gmail.com>

On 12/12/2012 01:53 AM, Pedro Alves wrote:
> Actually, sorry for not thinking of this before, but, it seems to me

Never mind, your comments are always welcome :)

> this use of pass+exp_continue is fragile.  Say a GDB bug is
> introduced, and the second =breakpoint-modified fails to be output.  In
> that case, this will result in:
> 
>       PASS: tracepoint on pendfunc2 resolved
>       FAIL: tracepoint on pendfunc2 resolved
> 
> instead of
>       PASS: tracepoint on pendfunc2 resolved
>       FAIL: tracepoint on pendfunc2 installed
> 

My intention of using exp_coutine here is to handle the situation that
notifications may arrive in different orders.  The fail message is not
clear, but not a big deal, to me.  It is important to catch a fail and
then we can check gdb.log and test case to fix it.

> You could fix that by doing:
> 
>   +	    # Pending tracepoint is resolved.
>    	    pass "$test"
>   +	    set test "tracepoint on pendfunc2 installed"
>   +	    exp_continue
> 
> But then, if the order of the notifications changes (IOW, due to a bug,
> we end up with the tracepoint not installed), this won't catch it.

Looks the fix is worse than the original one, at least no fail is
missing in the original one.

> It seems best to me to only use exp_continue in cases we won't to
> consume/skip output, and in the case of this patch, split the two
> tests into two consecutive gdb_expects.

If this way, we can't handle that two notifications arrive in a
reversed order (which is also correct).  If we don't have to worry
about the order (after all, the order of MI notifications are still
deterministic nowadays), I am OK with your suggestion.

-- 
Yao (齐尧)

gdb/testsuite:

2012-12-12  Yao Qi  <yao@codesourcery.com>

	* gdb.trace/mi-tracepoint-changed.exp (test_pending_resolved): Check
	'installed' field in '=breakpoint-modified'.
	(test_reconnect): Check 'installed' field in
	'=breakpoint-modified' and '=breakpoint-created'.
---
 gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp |   27 ++++++++++++++-------
 1 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp b/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp
index 2913b12..0073d4b 100644
--- a/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp
+++ b/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp
@@ -133,13 +133,18 @@ proc test_reconnect { } { with_test_prefix "reconnect" {
 	    fail "$test: 2"
 	    exp_continue
 	}
-	-re "=breakpoint-created,bkpt=\{number=\"3\",type=\"tracepoint\",disp=\"keep\",enabled=\"y\",.*,func=\"main\".*${mi_gdb_prompt}" {
+	-re "=breakpoint-created,bkpt=\{number=\"3\",type=\"tracepoint\",disp=\"keep\",enabled=\"y\",.*,func=\"main\".*installed=\"y\"" {
 	    # A tracepoint on main was defined in the stub, not in GDB,
 	    # so we should see a =breakpoint-created notification.
 	    pass $test
 	}
-	timeout {
-	    fail $test
+    }
+    # Tracepoint on marker is defined.  After the sync, we know that
+    # the tracepoint is in remote stub.  Mark it 'installed'.
+    set test "tracepoint on marker is installed"
+    gdb_expect {
+	-re "=breakpoint-modified,bkpt=\{number=\"2\".*,func=\"marker\".*installed=\"y\".*${mi_gdb_prompt}$" {
+	    pass "$test"
 	}
     }
     # Check that tracepoint 1 is still pending.
@@ -188,18 +193,22 @@ proc test_pending_resolved { } { with_test_prefix "pending resolved" {
 
     mi_send_resuming_command "exec-continue" "continuing execution to marker 1"
 
+    # It is expected to get two "=breakpoint-modified" notifications.
+    # Pending tracepoint is resolved.
     set test "tracepoint on pendfunc2 resolved"
     gdb_expect {
-	-re ".*=breakpoint-modified,bkpt=\{number=\"1\",type=\"tracepoint\".*.*times=\"0\"" {
+	-re "=breakpoint-modified,bkpt=\{number=\"1\",type=\"tracepoint\".*.*times=\"0\".*installed=\"n\"" {
 	    pass "$test"
 	}
-	-re ".*${mi_gdb_prompt}$" {
-	    fail $test
-	}
-	timeout {
-	    fail "$test (timeout)"
+    }
+    # Resolved tracepoint is installed.
+    set test "tracepoint on pendfunc2 installed"
+    gdb_expect {
+	-re "=breakpoint-modified,bkpt=\{number=\"1\",type=\"tracepoint\".*.*times=\"0\".*installed=\"y\"" {
+	    pass "$test"
 	}
     }
+
     mi_expect_stop "breakpoint-hit" "marker" ".*" ".*" ".*" \
 	{"" "disp=\"keep\""} "continue to marker"
 
-- 
1.7.7.6


  reply	other threads:[~2012-12-12  2:59 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-04  4:45 [PATCH 0/6] Add a new field 'installed' when reporting tracepoint Yao Qi
2012-12-04  4:45 ` [PATCH 3/6] Notify breakpoint-modified when tracepoints are downloaded Yao Qi
2012-12-06 20:56   ` Pedro Alves
2012-12-04  4:45 ` [PATCH 2/6] Iterate over ALL_TRACEPOINTS first Yao Qi
2012-12-06 20:56   ` Pedro Alves
2012-12-04  4:45 ` [PATCH 6/6] Update test cases for 'installed' field Yao Qi
2012-12-07 12:42   ` Pedro Alves
2012-12-13 12:07     ` Yao Qi
2012-12-13 17:13       ` Pedro Alves
2012-12-04  4:45 ` [PATCH 5/6] Test tracepoints are installed or not Yao Qi
2012-12-07 12:39   ` Pedro Alves
2012-12-07 13:55     ` Yao Qi
2012-12-07 14:20       ` Pedro Alves
2012-12-09 12:53         ` Yao Qi
2012-12-11 17:53           ` Pedro Alves
2012-12-12  2:59             ` Yao Qi [this message]
2012-12-12 12:24               ` Pedro Alves
2012-12-12 15:00                 ` Yao Qi
2012-12-04  4:45 ` [PATCH 4/6] Notify breakpoint-modified when uploaded tracepoints are merged Yao Qi
2012-12-06 20:57   ` Pedro Alves
2012-12-04  4:45 ` [PATCH 1/6] Add a field 'installed' for each location of tracepoint Yao Qi
2012-12-06 20:56   ` Pedro Alves
2012-12-07 13:49     ` Yao Qi
2012-12-09 12:49     ` Yao Qi
2012-12-09 16:57       ` Eli Zaretskii
2012-12-11 17:26       ` Pedro Alves
2012-12-12  1:54         ` Yao Qi
2012-12-12 12:03           ` Pedro Alves
2012-12-06 20:55 ` [PATCH 0/6] Add a new field 'installed' when reporting tracepoint Pedro Alves

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=50C7F30C.1050906@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=alves.ped@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@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