[PATCH] sim: riscv: Fix PC at gdb breakpoints

Bernd Edlinger bernd.edlinger@hotmail.de
Mon Apr 15 08:21:59 GMT 2024



On 4/12/24 11:44, Andrew Burgess wrote:
> Bernd Edlinger <bernd.edlinger@hotmail.de> writes:
> 
>> The uncompressed EBREAK instruction does not work
>> correctly this way, and the comment saying that
>> GDB expects us to step over EBREAK is just wrong.
>> The PC was always 4 bytes too high, which skips one
>> instruction at break and step over commands, and
>> causes complete chaos.  The compressed EBREAK was
>> already implemented correctly.
>>
>> Tested by using gdb's "target sim" and single-stepping.
> 
> Thanks for fixing this.
> 
> For the record, in v1.12 of the RISC-V privileged architecture
> specification, section 3.3.1: Environment Call and Breakpoint documents
> that the $pc value should be the address of the EBREAK instruction, not
> the address of the following instruction.
> 
> Approved-By: Andrew Burgess <aburgess@redhat.com>
> 
> Thanks,
> Andrew
> 

Pushed.

Thanks
Bernd.


More information about the Gdb-patches mailing list