[PATCH] Remove use of deprecated_frame_register_read

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] Remove use of deprecated_frame_register_read

Andrew Burgess-3
Continuing the theme of removing deprecated_* things, this
patch removes the use of deprecated_frame_register_read,
there's only one of them.

OK to apply?

Thanks,
Andrew

2013-09-18  Andrew Burgess  <[hidden email]>

        * generic/gdbtk-register.c (register_changed_p): Replace use of
        deprecated_frame_register_read with get_frame_register_value.

diff -u -p -r1.49 gdbtk-register.c
--- ./gdb/gdbtk/generic/gdbtk-register.c 6 Sep 2013 09:23:00 -0000 1.49
+++ ./gdb/gdbtk/generic/gdbtk-register.c 18 Sep 2013 13:26:40 -0000
@@ -443,21 +443,25 @@ map_arg_registers (Tcl_Interp *interp, i
 static void
 register_changed_p (int regnum, map_arg arg)
 {
-  gdb_byte raw_buffer[MAX_REGISTER_SIZE];
+  struct value *val;
   gdb_assert (regnum < old_regs_count);
 
-  if (!target_has_registers
-      || !deprecated_frame_register_read (get_selected_frame (NULL), regnum,
-  raw_buffer))
+  if (!target_has_registers)
     return;
+  
+  val = get_frame_register_value (get_selected_frame (NULL), regnum);
+  if (value_optimized_out (val) || !value_entirely_available (val))
+    return;  
 
-  if (memcmp (&old_regs[regnum * MAX_REGISTER_SIZE], raw_buffer,
+  if (memcmp (&old_regs[regnum * MAX_REGISTER_SIZE],
+      value_contents_all (val),
       register_size (get_current_arch (), regnum)) == 0)
     return;
 
   /* Found a changed register.  Save new value and return its number. */
 
-  memcpy (&old_regs[regnum * MAX_REGISTER_SIZE], raw_buffer,
+  memcpy (&old_regs[regnum * MAX_REGISTER_SIZE],
+  value_contents_all (val),
   register_size (get_current_arch (), regnum));
 
   Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, Tcl_NewIntObj (regnum));

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] Remove use of deprecated_frame_register_read

Andrew Burgess-3
On 20/09/2013 1:20 AM, Keith Seitz wrote:
> On 09/18/2013 07:16 AM, Andrew Burgess wrote:
>> Continuing the theme of removing deprecated_* things, this
>> patch removes the use of deprecated_frame_register_read,
>> there's only one of them.
>>
>> OK to apply?
>
> With the two small nits mentioned below checked/fixed, please commit,
> and again, thank you for your help.

Both fixed and committed.

Thanks for reviewing.
Andrew


>> diff -u -p -r1.49 gdbtk-register.c
>> --- ./gdb/gdbtk/generic/gdbtk-register.c    6 Sep 2013 09:23:00
>> -0000    1.49
>> +++ ./gdb/gdbtk/generic/gdbtk-register.c    18 Sep 2013 13:26:40 -0000
>> @@ -443,21 +443,25 @@ map_arg_registers (Tcl_Interp *interp, i
>>   static void
>>   register_changed_p (int regnum, map_arg arg)
>>   {
>> -  gdb_byte raw_buffer[MAX_REGISTER_SIZE];
>> +  struct value *val;
>>     gdb_assert (regnum < old_regs_count);
>>
>> -  if (!target_has_registers
>> -      || !deprecated_frame_register_read (get_selected_frame (NULL),
>> regnum,
>> -                      raw_buffer))
>> +  if (!target_has_registers)
>>       return;
>> +
>
> (1/2) This line looks like it has trailing whitespace. Could you
> double-check?
>
>> +  val = get_frame_register_value (get_selected_frame (NULL), regnum);
>> +  if (value_optimized_out (val) || !value_entirely_available (val))
>> +    return;
>
> (2/2) So does this line.
>
>>
>> -  if (memcmp (&old_regs[regnum * MAX_REGISTER_SIZE], raw_buffer,
>> +  if (memcmp (&old_regs[regnum * MAX_REGISTER_SIZE],
>> +          value_contents_all (val),
>>             register_size (get_current_arch (), regnum)) == 0)
>>       return;
>>
>>     /* Found a changed register.  Save new value and return its
>> number. */
>>
>> -  memcpy (&old_regs[regnum * MAX_REGISTER_SIZE], raw_buffer,
>> +  memcpy (&old_regs[regnum * MAX_REGISTER_SIZE],
>> +      value_contents_all (val),
>>         register_size (get_current_arch (), regnum));
>>
>>     Tcl_ListObjAppendElement (NULL, result_ptr->obj_ptr, Tcl_NewIntObj
>> (regnum));
>>
>
>
>
>