[DOCO/PING] Re: [patch] Replace deprecated_memory_changed_hook with an observer.

Joel Brobecker brobecker@adacore.com
Wed Dec 2 17:38:00 GMT 2009


Hi Eli,

Just wondering if you are away or just missed this patch where your
feedback would be much appreciated :). If you're not around (no answer
for another couple of days), then I'll approve the doco part since the
change is small and has been waiting for a week now, and will personally
make sure that either Paul or myself immediately address any comment
you might have.

Paul,

please wait for another couple of days for Eli's feedback. If he's away,
then just go ahead and commit. We will address any comment when he gets
back.


On Wed, Nov 25, 2009 at 01:13:53PM -0800, Paul Pluzhnikov wrote:
> On Wed, Nov 25, 2009 at 12:48 PM, Joel Brobecker <brobecker@adacore.com> wrote:
> 
> > It looks like you forgot to remove the definition in top.c.
> 
> Indeed. Fixed patch attached.
> 
> Thanks,
> -- 
> Paul Pluzhnikov
> 
> gdb/ChangeLog:
> 
> 2009-11-25  Paul Pluzhnikov  <ppluzhnikov@google.com>
> 
>        * ada-lang.c (ada_value_assign): Use observer_notify_memory_changed.
>        * valops.c (value_assign): Likewise.
>        * defs.h (deprecated_memory_changed_hook): Remove.
>        * top.c (deprecated_memory_changed_hook): Likewise.
>        * interps.c (clear_interpreter_hooks): Adjust.
> 
> gdb/doc/ChangeLog:
> 
> 2009-11-25  Paul Pluzhnikov  <ppluzhnikov@google.com>
> 
>        * observer.texi: New memory_changed observer.
> 
> gdb/gdbtk/ChangeLog:
> 
> 2009-11-25  Paul Pluzhnikov  <ppluzhnikov@google.com>
> 
>        * generic/gdbtk-hooks.c (gdbtk_memory_changed): Adjust.
>        (gdbtk_add_hooks): Adjust.

> Index: ada-lang.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/ada-lang.c,v
> retrieving revision 1.234
> diff -u -p -u -r1.234 ada-lang.c
> --- ada-lang.c	19 Nov 2009 22:45:56 -0000	1.234
> +++ ada-lang.c	25 Nov 2009 21:10:03 -0000
> @@ -2289,9 +2289,8 @@ ada_value_assign (struct value *toval, s
>          move_bits (buffer, value_bitpos (toval),
>  		   value_contents (fromval), 0, bits, 0);
>        write_memory (to_addr, buffer, len);
> -      if (deprecated_memory_changed_hook)
> -	deprecated_memory_changed_hook (to_addr, len);
> -      
> +      observer_notify_memory_changed (to_addr, len, buffer);
> +
>        val = value_copy (toval);
>        memcpy (value_contents_raw (val), value_contents (fromval),
>                TYPE_LENGTH (type));
> Index: defs.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/defs.h,v
> retrieving revision 1.257
> diff -u -p -u -r1.257 defs.h
> --- defs.h	21 Oct 2009 18:02:25 -0000	1.257
> +++ defs.h	25 Nov 2009 21:10:03 -0000
> @@ -1108,7 +1108,6 @@ extern void (*deprecated_readline_begin_
>  extern char *(*deprecated_readline_hook) (char *);
>  extern void (*deprecated_readline_end_hook) (void);
>  extern void (*deprecated_register_changed_hook) (int regno);
> -extern void (*deprecated_memory_changed_hook) (CORE_ADDR addr, int len);
>  extern void (*deprecated_context_hook) (int);
>  extern ptid_t (*deprecated_target_wait_hook) (ptid_t ptid,
>  					      struct target_waitstatus *status,
> Index: interps.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/interps.c,v
> retrieving revision 1.32
> diff -u -p -u -r1.32 interps.c
> --- interps.c	6 Feb 2009 21:33:58 -0000	1.32
> +++ interps.c	25 Nov 2009 21:10:03 -0000
> @@ -343,7 +343,6 @@ clear_interpreter_hooks (void)
>    deprecated_readline_hook = 0;
>    deprecated_readline_end_hook = 0;
>    deprecated_register_changed_hook = 0;
> -  deprecated_memory_changed_hook = 0;
>    deprecated_context_hook = 0;
>    deprecated_target_wait_hook = 0;
>    deprecated_call_command_hook = 0;
> Index: top.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/top.c,v
> retrieving revision 1.173
> diff -u -p -u -r1.173 top.c
> --- top.c	5 Nov 2009 20:43:52 -0000	1.173
> +++ top.c	25 Nov 2009 21:10:03 -0000
> @@ -259,9 +259,6 @@ void (*deprecated_interactive_hook) (voi
>     that several registers have changed (see value_assign). */
>  void (*deprecated_register_changed_hook) (int regno);
>  
> -/* Tell the GUI someone changed LEN bytes of memory at ADDR */
> -void (*deprecated_memory_changed_hook) (CORE_ADDR addr, int len);
> -
>  /* Called when going to wait for the target.  Usually allows the GUI to run
>     while waiting for target events.  */
>  
> Index: valops.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/valops.c,v
> retrieving revision 1.227
> diff -u -p -u -r1.227 valops.c
> --- valops.c	10 Nov 2009 22:17:58 -0000	1.227
> +++ valops.c	25 Nov 2009 21:10:03 -0000
> @@ -861,8 +861,8 @@ value_assign (struct value *toval, struc
>  	  }
>  
>  	write_memory (changed_addr, dest_buffer, changed_len);
> -	if (deprecated_memory_changed_hook)
> -	  deprecated_memory_changed_hook (changed_addr, changed_len);
> +	observer_notify_memory_changed (changed_addr, changed_len,
> +					dest_buffer);
>        }
>        break;
>  
> Index: doc/observer.texi
> ===================================================================
> RCS file: /cvs/src/src/gdb/doc/observer.texi,v
> retrieving revision 1.27
> diff -u -p -u -r1.27 observer.texi
> --- doc/observer.texi	19 Oct 2009 09:51:42 -0000	1.27
> +++ doc/observer.texi	25 Nov 2009 21:10:03 -0000
> @@ -208,6 +208,11 @@ Either @value{GDBN} detached from the in
>  exited.  The argument @var{pid} identifies the inferior.
>  @end deftypefun
>  
> +@deftypefun void memory_changed (CORE_ADDR @var{addr}, int @var{len}, const bfd_byte *@var{data})
> +Bytes from @var{data} to @var{data} + @var{len} have been written
> +to the current inferior at @var{addr}.
> +@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.
> Index: gdbtk/generic/gdbtk-hooks.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-hooks.c,v
> retrieving revision 1.49
> diff -u -p -u -r1.49 gdbtk-hooks.c
> --- gdbtk/generic/gdbtk-hooks.c	24 May 2009 08:38:27 -0000	1.49
> +++ gdbtk/generic/gdbtk-hooks.c	25 Nov 2009 21:10:03 -0000
> @@ -94,7 +94,8 @@ static void gdbtk_pre_add_symbol (const 
>  static void gdbtk_print_frame_info (struct symtab *, int, int, int);
>  static void gdbtk_post_add_symbol (void);
>  static void gdbtk_register_changed (int regno);
> -static void gdbtk_memory_changed (CORE_ADDR addr, int len);
> +static void gdbtk_memory_changed (CORE_ADDR addr, int len,
> +				  const bfd_byte *data);
>  static void gdbtk_selected_frame_changed (int);
>  static void gdbtk_context_change (int);
>  static void gdbtk_error_begin (void);
> @@ -129,6 +130,7 @@ gdbtk_add_hooks (void)
>    observer_attach_tracepoint_modified (gdbtk_modify_tracepoint);
>    observer_attach_tracepoint_deleted (gdbtk_delete_tracepoint);
>    observer_attach_architecture_changed (gdbtk_architecture_changed);
> +  observer_attach_memory_changed (gdbtk_memory_changed);
>  
>    /* Hooks */
>    deprecated_call_command_hook = gdbtk_call_command;
> @@ -158,7 +160,6 @@ gdbtk_add_hooks (void)
>    deprecated_detach_hook            = gdbtk_detach;
>  
>    deprecated_register_changed_hook = gdbtk_register_changed;
> -  deprecated_memory_changed_hook = gdbtk_memory_changed;
>    deprecated_selected_frame_level_changed_hook = gdbtk_selected_frame_changed;
>    deprecated_context_hook = gdbtk_context_change;
>  
> @@ -393,7 +394,7 @@ gdbtk_register_changed (int regno)
>  }
>  
>  static void
> -gdbtk_memory_changed (CORE_ADDR addr, int len)
> +gdbtk_memory_changed (CORE_ADDR addr, int len, const bfd_byte *data)
>  {
>    if (Tcl_Eval (gdbtk_interp, "gdbtk_memory_changed") != TCL_OK)
>      report_error ();


-- 
Joel



More information about the Gdb-patches mailing list