[PATCH v5 3/7] Refactor arm_software_single_step to use regcache.
Antoine Tremblay
antoine.tremblay@ericsson.com
Fri Dec 4 15:43:00 GMT 2015
On 12/04/2015 10:31 AM, Antoine Tremblay wrote:
>
>
> On 12/04/2015 10:10 AM, Pedro Alves wrote:
>> On 12/04/2015 01:12 PM, Antoine Tremblay wrote:
>>> @@ -4727,7 +4754,8 @@ thumb_get_next_pc_raw (struct frame_info
>>> *frame, CORE_ADDR pc)
>>> {
>>> /* CBNZ or CBZ. */
>>> int imm = (bit (inst1, 9) << 6) + (bits (inst1, 3, 7) << 1);
>>> - ULONGEST reg = get_frame_register_unsigned (frame, bits
>>> (inst1, 0, 2));
>>> + ULONGEST reg;
>>> + regcache_raw_read_unsigned (regcache, bits (inst1, 0, 2), ®);
>>
>> Missing empty line.
>
> Fixed.
>
>>
>> Note that get_frame_register_unsigned throws if the register is
>> unavailable, while regcache_raw_read_unsigned uses the return value as
>> status indication.
>>
>> Shouldn't really happen normally in get_next_pcs to see an unavailable
>> register, but, wouldn't it be nicer to add a small wrapper like:
>>
>> ULONGEST
>> get_regcache_raw_unsigned (struct regcache *regcache, int regnum)
>> {
>> ULONGEST value;
>> enum register_status status;
>>
>> status = regcache_raw_read_unsigned (regcache, regnum, &value);
>> if (status == REG_UNAVAILABLE)
>> throw_error (NOT_AVAILABLE_ERROR,
>> _("Register %s is not available"), regnum);
>> return value;
>> }
>>
>> ?
>
> OK.
However thinking about it since I will add this to regcache.h and then
to common-regcache.h.
I think I will call it regcache_raw_read_unsigned_throw.
Thanks,
Antoine
More information about the Gdb-patches
mailing list