This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Remove MAX_REGISTER_SIZE from regcache.c


> On 24 Mar 2017, at 08:49, Yao Qi <qiyaoltc@gmail.com> wrote:
> 
> Alan Hayward <Alan.Hayward@arm.com> writes:
> 
>> @@ -126,6 +129,8 @@ init_regcache_descr (struct gdbarch *gdbarch)
>> 	descr->register_offset[i] = offset;
>> 	offset += descr->sizeof_register[i];
>> 	gdb_assert (MAX_REGISTER_SIZE >= descr->sizeof_register[i]);
> 
> Do we still need to keep MAX_REGISTER_SIZE? or you plan to remove it later.
> 

I planned to keep it here until I remove MAX_REGISTER_SIZE.
Whilst the define is still in use, we should really keep this check here.


>> +	descr->max_register_size = std::max (descr->max_register_size,
>> +					     descr->sizeof_register[i]);
>>       }
>>     /* Set the real size of the raw register cache buffer.  */
>>     descr->sizeof_raw_registers = offset;
> 
>> @@ -1465,17 +1473,19 @@ regcache_dump (struct regcache *regcache, struct ui_file *file,
>> 	    fprintf_unfiltered (file, "Cooked value");
>> 	  else
>> 	    {
>> -	      enum register_status status;
>> +	      struct value *value = regcache_cooked_read_value (regcache,
>> +								regnum);
>> 
>> -	      status = regcache_cooked_read (regcache, regnum, buf);
>> -	      if (status == REG_UNKNOWN)
>> -		fprintf_unfiltered (file, "<invalid>");
> 
> "<invalid>" is lost after your patch.

Yes. There seems to be no way of getting an UNKNOWN status when reading using values.

Looking into the code, only msp430 and nds32 seem to explicitly set status to UNKNOWN.
Everything else looks like it will error instead of setting UNKNOWN

I could add "if (regcache_register_status (regcache, regnum) == REG_UNKNOWN)"
before calling regcache_cooked_read_value. But I think that’s not what we want, as we
want to always try reading from the target.


> 
>> -	      else if (status == REG_UNAVAILABLE)
>> +	      if (value_optimized_out (value)
>> +		  || !value_entirely_available (value))
>> 		fprintf_unfiltered (file, "<unavailable>");
>> 	      else
>> -		print_hex_chars (file, buf,
>> +		print_hex_chars (file, value_contents_all (value),
>> 				 regcache->descr->sizeof_register[regnum],
>> 				 gdbarch_byte_order (gdbarch));
>> +
>> +	      release_value (value);
>> +	      value_free (value);
> 
> -- 
> Yao (齐尧)


Alan.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]