Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFC] Replace deprecated_target_new_objfile_hook by observer?
@ 2006-10-17 23:32 Joel Brobecker
  2006-10-17 23:35 ` Daniel Jacobowitz
  0 siblings, 1 reply; 13+ messages in thread
From: Joel Brobecker @ 2006-10-17 23:32 UTC (permalink / raw)
  To: gdb-patches

Hello,

While working on the problem described in

        http://www.sourceware.org/ml/gdb/2006-09/msg00065.html

one of the things I noticed was that we're using a hook where
each client that wants to be notified inserts himself. The way
it is done is through cooperation, like so:

  1. Declare a static variable:
  
        static void (*target_new_objfile_chain)(struct objfile *);

  2. During the module initialization, store the current value
     of that hook into our static variable, and replace its
     value with our own callback.

        /* Notice when object files get loaded and unloaded.  */
          target_new_objfile_chain = deprecated_target_new_objfile_hook;
          deprecated_target_new_objfile_hook = new_objfile;

  3. At the end of our callback code, check our static variable
     and call the previous client:

        /* deprecated_target_new_objfile_hook callback.
           [snip]  */
        
        static void
        new_objfile (struct objfile *objfile)
        {
          [snip]

          if (target_new_objfile_chain)
            target_new_objfile_chain (objfile);
        }

I propose to replace this with an observer. Would that be OK?

Assuming that it is, there are several platforms that use that
mechanism. It's going to be hard to test all of them. But the changes
themselves should be pretty mechanical. So what I can propose is
to make all the necessary changes to replace that hook model with
an approach using observers and test on x86-linux. And then rely
on the mechanical aspect of the change together with the review of
another pair of eyes. Would that be OK?

The alternative is to have the two approaches coexist for a while.
I just don't think this is necessary, because I don't think the change
is that risky.

-- 
Joel


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2007-03-28 18:42 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-17 23:32 [RFC] Replace deprecated_target_new_objfile_hook by observer? Joel Brobecker
2006-10-17 23:35 ` Daniel Jacobowitz
2006-10-18  0:20   ` Joel Brobecker
2006-10-18  1:38     ` Daniel Jacobowitz
     [not found]       ` <535BF17A-E776-4DE4-979B-7E6FBA505E31@apple.com>
2006-10-18 17:11         ` Daniel Jacobowitz
2006-10-18 16:29   ` Ulrich Weigand
2006-10-18 16:43     ` Daniel Jacobowitz
2006-10-19 14:30     ` Joel Brobecker
2006-10-20  0:41       ` [PATCH] " Ulrich Weigand
2006-10-20  0:46         ` Daniel Jacobowitz
2006-10-20  1:09           ` Ulrich Weigand
2007-03-28 18:34       ` Ulrich Weigand
2007-03-28 18:42         ` Joel Brobecker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox