read target register to decide breakpoint size
Antoine Tremblay
antoine.tremblay@ericsson.com
Wed Dec 14 12:32:00 GMT 2016
Yao Qi writes:
> On 16-12-13 13:30:02, Tim Newsome wrote:
>> Actually, this seems to work inside breakpoint_kind_from_pc():
>> ```
>> struct frame_info *frame = get_current_frame ();
>> uint32_t misa = get_frame_register_unsigned (frame, RISCV_CSR_MISA_REGNUM);
>> ```
>>
>> Is that kosher? If so, is there any reason for me to implement
>> breakpoint_kind_from_current_state?
>
> I'd like not to do so. Can't you decode the instruction to see whether
> it is compressed or uncompressed? I also think it is a good idea to
> make a decision based on ELF info, as you mentioned in the first email.
Correct me if I'm wrong but reading the RISC-V arch manual, it seems
like the MISA register information is static.
So unlike arm where the ISA might change, on RISC-V it is static for the
life of the program ?
If that's true, and that you can't decode the instruction, it doesn't
seem that bad to use the register in kind_from_pc ?
Yao, was your concern that this would be non-static, or there is another
reason ?
However thinking about the ELF info, could you elaborate on why it may
not reflect what is actually being executed ? And how this is a problem
?
A note about _from_current_state too this is used while single_stepping
since GDB knows it's about to set a breakpoint from a known state to
the next location, this differs from from_pc which is used to set a pc from
any state to any location.
So in your case it's really from_pc that you want.
Thanks,
Antoine
More information about the Gdb
mailing list