OpenCores
Issue List
Or1ksim JTAG interface will not stepi through branches from GDB #36
Closed jeremybennett opened this issue about 16 years ago
jeremybennett commented about 16 years ago

Reported by Marcus Erlandsson

When using GDB with Or1ksim via its JTAG interface, the "stepi" command appears to ignore branch instructions.

jeremybennett commented about 16 years ago

I can reproduce the bug, which is long-standing in the code. The fix is to modify function mtspr() in sprs.c, so that it takes no action if asked to set the NPC to the value it already holds.<br> <br> The following code change is suggested within that function:<br> <br> case SPR_NPC:<br> {<br> / The debugger has redirected us to a new address /<br> / This is usually done to reissue an instruction<br> which just caused a breakpoint exception. /<br> <br> / JPB patch. When GDB stepi, this may be used to set the PC to the<br> value it is already at. If this is the case, then we do nothing (in<br> particular we do not trash a delayed branch) /<br> <br> if (value != cpu_state.pc)<br> {<br> cpu_state.pc = value;<br> <br> if(!value && config.sim.verbose)<br> PRINTF("WARNING: PC just set to 0!\n");<br> <br> / Clear any pending delay slot jumps also /<br> cpu_state.delay_insn = 0;<br> pcnext = value + 4;<br> }<br> }<br> break;<br> <br> This change will be included in the next release

jeremybennett commented over 15 years ago

Fixed in Or1ksim 0.3.0rc3

jeremybennett was assigned over 15 years ago
jeremybennett closed this over 15 years ago

Assignee
jeremybennett
Labels
Bug