From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29434 invoked by alias); 17 Feb 2009 19:20:00 -0000 Received: (qmail 29419 invoked by uid 22791); 17 Feb 2009 19:19:59 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_14,J_CHICKENPOX_84,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 Feb 2009 19:19:53 +0000 Received: (qmail 16221 invoked from network); 17 Feb 2009 19:19:51 -0000 Received: from unknown (HELO wind.local) (vladimir@127.0.0.2) by mail.codesourcery.com with ESMTPA; 17 Feb 2009 19:19:51 -0000 From: Vladimir Prus To: Pedro Alves Subject: Re: [RFA] fix *stopped for CLI commands Date: Tue, 17 Feb 2009 19:25:00 -0000 User-Agent: KMail/1.9.10 Cc: gdb-patches@sourceware.org References: <200902061045.18508.vladimir@codesourcery.com> <200902142222.31325.vladimir@codesourcery.com> <200902151547.28642.pedro@codesourcery.com> In-Reply-To: <200902151547.28642.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_V3wmJXu/QnLf7yh" Message-Id: <200902172219.49218.vladimir@codesourcery.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-02/txt/msg00357.txt.bz2 --Boundary-00=_V3wmJXu/QnLf7yh Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 738 On Sunday 15 February 2009 18:47:28 Pedro Alves wrote: > Oops, I'm seeing this: > > Running ../../../src/gdb/testsuite/gdb.gdb/observer.exp ... > FAIL: gdb.gdb/observer.exp: second observer attached; check second observer counter value Apologies, I've shortcutted the testing by running on MI tests, since "obviously" that was a MI-only change. > Alternatively, we could use a safer and more future proof test specific > notification in doc/observer.texi, instead of reusing the normal_stop > notification. Say, > > @deftypefun void test_notification (int @var{somearg}) > For internal testing. Do not use. See testsuite/gdb.gdb/observer.exp. > @end deftypefun Here's a patch implementing this approach. OK? - Volodya --Boundary-00=_V3wmJXu/QnLf7yh Content-Type: text/x-diff; charset="iso 8859-15"; name="test_observer.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="test_observer.diff" Content-length: 7705 commit 1160d59db83b2a172c980bb7fa5c9dc9961d1b18 Author: Vladimir Prus Date: Tue Feb 17 22:19:34 2009 +0300 Unbreak observer tests. gdb/ * observer.c (observer_test_first_notification_function) (observer_test_second_notification_function) (observer_test_third_notification_function): Adjust prototype. gdb/doc/ * observer.texi (test_notification): New observer. gdb/testsuite/ * gdb.gdb/observer.exp: Use test_notification observer, not normal_stop, everywhere. (test_normal_stop_notifications): Rename to... (test_notifications): ...this. (test_observer_normal_stop): Rename to... (test_observer): ...this. diff --git a/gdb/doc/observer.texi b/gdb/doc/observer.texi index c8e8b96..04f5034 100644 --- a/gdb/doc/observer.texi +++ b/gdb/doc/observer.texi @@ -200,3 +200,8 @@ Either @value{GDBN} detached from the inferior, or the inferior exited. The argument @var{pid} identifies the inferior. @end deftypefun + @deftypefun void test_notification (int @var{somearg}) +This observer is used for internal testing. Do not use. +See testsuite/gdb.gdb/observer.exp. + @end deftypefun + diff --git a/gdb/observer.c b/gdb/observer.c index 8a059c1..106bfcd 100644 --- a/gdb/observer.c +++ b/gdb/observer.c @@ -181,19 +181,19 @@ int observer_test_second_observer = 0; int observer_test_third_observer = 0; void -observer_test_first_notification_function (struct bpstats *bs) +observer_test_first_notification_function (int arg) { observer_test_first_observer++; } void -observer_test_second_notification_function (struct bpstats *bs) +observer_test_second_notification_function (int arg) { observer_test_second_observer++; } void -observer_test_third_notification_function (struct bpstats *bs) +observer_test_third_notification_function (int arg) { observer_test_third_observer++; } diff --git a/gdb/testsuite/gdb.gdb/observer.exp b/gdb/testsuite/gdb.gdb/observer.exp index afc6909..e57b91b 100644 --- a/gdb/testsuite/gdb.gdb/observer.exp +++ b/gdb/testsuite/gdb.gdb/observer.exp @@ -101,32 +101,32 @@ proc setup_test { executable } { } proc attach_first_observer { message } { - gdb_test "set \$first_obs = observer_attach_normal_stop (&observer_test_first_notification_function)" \ + gdb_test "set \$first_obs = observer_attach_test_notification (&observer_test_first_notification_function)" \ "" "$message; attach first observer" } proc attach_second_observer { message } { - gdb_test "set \$second_obs = observer_attach_normal_stop (&observer_test_second_notification_function)" \ + gdb_test "set \$second_obs = observer_attach_test_notification (&observer_test_second_notification_function)" \ "" "$message; attach second observer" } proc attach_third_observer { message } { - gdb_test "set \$third_obs = observer_attach_normal_stop (&observer_test_third_notification_function)" \ + gdb_test "set \$third_obs = observer_attach_test_notification (&observer_test_third_notification_function)" \ "" "$message; attach third observer" } proc detach_first_observer { message } { - gdb_test "call observer_detach_normal_stop (\$first_obs)" \ + gdb_test "call observer_detach_test_notification (\$first_obs)" \ "" "$message; detach first observer" } proc detach_second_observer { message } { - gdb_test "call observer_detach_normal_stop (\$second_obs)" \ + gdb_test "call observer_detach_test_notification (\$second_obs)" \ "" "$message; detach second observer" } proc detach_third_observer { message } { - gdb_test "call observer_detach_normal_stop (\$third_obs)" \ + gdb_test "call observer_detach_test_notification (\$third_obs)" \ "" "$message; detach third observer" } @@ -151,21 +151,21 @@ proc reset_counters { message } { "$message; reset third observer counter" } -proc test_normal_stop_notifications { first second third message args } { +proc test_notifications { first second third message args } { # Do any initialization for {set i 0} {$i < [llength $args]} {incr i} { [lindex $args $i] $message } reset_counters $message - # Call observer_notify_normal_stop. Note that this procedure + # Call observer_notify_test_notification. Note that this procedure # takes one argument, but this argument is ignored by the observer # callbacks we have installed. So we just pass an arbitrary value. - gdb_test "call observer_notify_normal_stop (0)" "" \ + gdb_test "call observer_notify_test_notification (0)" "" \ "$message; sending notification" check_counters $first $second $third $message } -proc test_observer_normal_stop { executable } { +proc test_observer { executable } { set setup_result [setup_test $executable] if {$setup_result <0} then { @@ -173,56 +173,56 @@ proc test_observer_normal_stop { executable } { } # First, try sending a notification without any observer attached. - test_normal_stop_notifications 0 0 0 "no observer attached" + test_notifications 0 0 0 "no observer attached" # Now, attach one observer, and send a notification. - test_normal_stop_notifications 0 1 0 "second observer attached" \ + test_notifications 0 1 0 "second observer attached" \ attach_second_observer # Remove the observer, and send a notification. - test_normal_stop_notifications 0 0 0 "second observer detached" \ + test_notifications 0 0 0 "second observer detached" \ detach_second_observer # With a new observer. - test_normal_stop_notifications 1 0 0 "1st observer added" \ + test_notifications 1 0 0 "1st observer added" \ attach_first_observer # With 2 observers. - test_normal_stop_notifications 1 1 0 "2nd observer added" \ + test_notifications 1 1 0 "2nd observer added" \ attach_second_observer # With 3 observers. - test_normal_stop_notifications 1 1 1 "3rd observer added" \ + test_notifications 1 1 1 "3rd observer added" \ attach_third_observer # Remove middle observer. - test_normal_stop_notifications 1 0 1 "2nd observer removed" \ + test_notifications 1 0 1 "2nd observer removed" \ detach_second_observer # Remove first observer. - test_normal_stop_notifications 0 0 1 "1st observer removed" \ + test_notifications 0 0 1 "1st observer removed" \ detach_first_observer # Remove last observer. - test_normal_stop_notifications 0 0 0 "3rd observer removed" \ + test_notifications 0 0 0 "3rd observer removed" \ detach_third_observer # Go back to 3 observers, and remove them in a different order... - test_normal_stop_notifications 1 1 1 "three observers added" \ + test_notifications 1 1 1 "three observers added" \ attach_first_observer \ attach_second_observer \ attach_third_observer # Remove the third observer. - test_normal_stop_notifications 1 1 0 "third observer removed" \ + test_notifications 1 1 0 "third observer removed" \ detach_third_observer # Remove the second observer. - test_normal_stop_notifications 1 0 0 "second observer removed" \ + test_notifications 1 0 0 "second observer removed" \ detach_second_observer # Remove the first observer, no more observers. - test_normal_stop_notifications 0 0 0 "first observer removed" \ + test_notifications 0 0 0 "first observer removed" \ detach_first_observer return 0 @@ -262,7 +262,7 @@ remote_file host delete x$tool gdb_start set file [remote_download host $GDB_FULLPATH x$tool] -set result [test_observer_normal_stop $file]; +set result [test_observer $file]; gdb_exit; catch "remote_file host delete $file"; --Boundary-00=_V3wmJXu/QnLf7yh--