From: Andrew Cagney <ac131313@redhat.com>
To: Joel Brobecker <brobecker@gnat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] Add some code in observer.c to allow unit-testing
Date: Tue, 18 Mar 2003 15:38:00 -0000 [thread overview]
Message-ID: <3E773D7F.2010003@redhat.com> (raw)
In-Reply-To: <20030318020905.GL16507@gnat.com>
> Hello again,
>
> Following a small discussion in gdb@, I have written a small regression
> test for observer.c.
>
> http://sources.redhat.com/ml/gdb/2003-03/msg00147.html
>
> The test is done by doing inferior function calls to the normal_stop
> observer routines. The sticky point is that the attach routine needs
> to be provided with a function pointer (callback). This patch adds
> 3 static counters and 3 static functions that simply increment these
> counters. These functions will be provided to the attach routine during
> the test (See upcoming testsuite patch for more details)
>
> 2003-03-17 J. Brobecker <brobecker@gnat.com>
>
> * observer.c (observer_test_first_observer): New static variable.
> (observer_test_second_observer): Likewise.
> (observer_test_third_observer): Likewise.
> (observer_test_first_notification_function): New static function.
> (observer_test_second_notification_function): Likewise.
> (observer_test_third_notification_function): Likewise.
>
> Ok to apply?
Long term, it's going to run into -Wunused-function. Suggest adding a
disclaimer pointing out this limitation :-)
Otherwize (for want of any beter idea :-), ok.
Andrew
> Index: observer.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/observer.c,v
> retrieving revision 1.2
> diff -c -3 -p -r1.2 observer.c
> *** observer.c 28 Feb 2003 07:19:32 -0000 1.2
> --- observer.c 18 Mar 2003 01:51:47 -0000
> *************** observer_notify_normal_stop (void)
> *** 190,192 ****
> --- 190,218 ----
> {
> generic_observer_notify (normal_stop_subject, NULL);
> }
> +
> + /* The following code is only used to unit-test the observers from
> + our testsuite. DO NOT USE IT within observer.c! */
> +
> + static int observer_test_first_observer = 0;
> + static int observer_test_second_observer = 0;
> + static int observer_test_third_observer = 0;
> +
> + static void
> + observer_test_first_notification_function (void)
> + {
> + observer_test_first_observer++;
> + }
> +
> + static void
> + observer_test_second_notification_function (void)
> + {
> + observer_test_second_observer++;
> + }
> +
> + static void
> + observer_test_third_notification_function (void)
> + {
> + observer_test_third_observer++;
> + }
> +
next prev parent reply other threads:[~2003-03-18 15:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-18 2:09 Joel Brobecker
2003-03-18 15:38 ` Andrew Cagney [this message]
2003-03-18 18:07 ` Joel Brobecker
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=3E773D7F.2010003@redhat.com \
--to=ac131313@redhat.com \
--cc=brobecker@gnat.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