Open shahab-vahedi opened 4 years ago
I just noticed your break point enum: please note we also have SWI_S (ARCv2 on wards) which is semantically different from TRAP_S.
SWI_S doesn't commit before exception is taken (so PC remains unchanged and exception returns back to orig PC. OTOH TRAP_S comit sbefore exception so PC moves to next PC for return. Thus SWI_S is cleaner to implement breakpointing in general as we always have the orig context for say removing the bkpt after say single-step.
When working on Linux kprobes infrastructure, we were emulating the No-commit semantics using an unimplemented instruction opcode. Per my request this was formalized into ISA as a new SWI_S instruction but I never got around to propagating this in software. Perhaps we can start doing this for gdb if you feel it helps.
In GDB and GDBserver code, we have target hooks that need a breakpoint kind to figure what to do:
However, looking at the implementation of these codes, it becomes obvious that we are piggy backing the breakpoint size through the kind. This is at best confusing.
The correct way to handle this is to have an enum and a map to resolve the problem: