[RFA] patch for [Bug gdb/11253]

Hui Zhu teawater@gmail.com
Sun Feb 28 15:38:00 GMT 2010


Hi Jan,

I think your patch is more better.
Thanks.  :)

Best regards,
Hui

On Fri, Feb 26, 2010 at 20:53, Jan Kratochvil <jan.kratochvil@redhat.com> wrote:
> On Fri, 26 Feb 2010 04:25:58 +0100, Hui Zhu wrote:
>> This patch is for bug 11253 http://sourceware.org/bugzilla/show_bug.cgi?id=11253
> [..]
>> --- a/target.c
>> +++ b/target.c
>> @@ -2836,6 +2836,7 @@ init_dummy_target (void)
>>    dummy_target.to_has_stack = (int (*) (struct target_ops *)) return_zero;
>>    dummy_target.to_has_registers = (int (*) (struct target_ops *)) return_zero;
>>    dummy_target.to_has_execution = (int (*) (struct target_ops *)) return_zero;
>> +  dummy_target.to_stopped_by_watchpoint = return_zero;
>>    dummy_target.to_magic = OPS_MAGIC;
>>  }
>
> while there is already:
>
> update_current_target (void)
> ...
>      INHERIT (to_stopped_by_watchpoint, t);
> +
>  de_fault (to_stopped_by_watchpoint,
>            (int (*) (void))
>            return_zero);
>
> and I wanted to propose the attached patch I expect it is because INHERITs are
> deprecated now and current_target.beneath traversal is preferred nowadays.
>
> Just posted when I wrote it, IMo the patch of Hui's is the right one instead.
>
> No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
>
>
> Thanks,
> Jan
>
>
> 2010-02-26  Jan Kratochvil  <jan.kratochvil@redhat.com>
>
>        * record.c (record_open): Initialize tmp_to_insert_breakpoint,
>        tmp_to_remove_breakpoint, tmp_to_stopped_by_watchpoint and
>        tmp_to_stopped_data_address directly from current_target.  Remove their
>        initialization during current_target.beneath chain traversal.
>
> --- a/gdb/record.c
> +++ b/gdb/record.c
> @@ -895,8 +895,10 @@ record_open (char *name, int from_tty)
>   tmp_to_store_registers = NULL;
>   tmp_to_xfer_partial_ops = NULL;
>   tmp_to_xfer_partial = NULL;
> -  tmp_to_insert_breakpoint = NULL;
> -  tmp_to_remove_breakpoint = NULL;
> +  tmp_to_insert_breakpoint = current_target.to_insert_breakpoint;
> +  tmp_to_remove_breakpoint = current_target.to_remove_breakpoint;
> +  tmp_to_stopped_by_watchpoint = current_target.to_stopped_by_watchpoint;
> +  tmp_to_stopped_data_address = current_target.to_stopped_data_address;
>
>   /* Set the beneath function pointers.  */
>   for (t = current_target.beneath; t != NULL; t = t->beneath)
> @@ -921,14 +923,6 @@ record_open (char *name, int from_tty)
>          tmp_to_xfer_partial = t->to_xfer_partial;
>          tmp_to_xfer_partial_ops = t;
>         }
> -      if (!tmp_to_insert_breakpoint)
> -       tmp_to_insert_breakpoint = t->to_insert_breakpoint;
> -      if (!tmp_to_remove_breakpoint)
> -       tmp_to_remove_breakpoint = t->to_remove_breakpoint;
> -      if (!tmp_to_stopped_by_watchpoint)
> -       tmp_to_stopped_by_watchpoint = t->to_stopped_by_watchpoint;
> -      if (!tmp_to_stopped_data_address)
> -       tmp_to_stopped_data_address = t->to_stopped_data_address;
>     }
>   if (!tmp_to_xfer_partial)
>     error (_("Could not find 'to_xfer_partial' method on the target stack."));
>



More information about the Gdb-patches mailing list