Skip to content

Commit

Permalink
Performance optimization: changed reverse debug decoration.
Browse files Browse the repository at this point in the history
  • Loading branch information
maziac committed Dec 28, 2019
1 parent 089b032 commit 38b43d9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 0.9.5
- Fixed moving of PC to cursor during reverse debugging.
- Changed reverse debug decoration to blue background only due to performance reasons.

## 0.9.4
- Reverse debugging available.
Expand Down
20 changes: 20 additions & 0 deletions design/ZxNextInterface.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,30 @@ From what I have seen from the Z80 sources I need to modify them slightly for my
- There are only 10 breakpoints available. I probably need to increase this (100?)
- A breakpoint is cleared when hit. I need to remove this feature.
- 38h IM1 interrupt is turned off. So not usable with running interrupts (breakpoints use RST 38h). Seems Chris is working on this.
- No conditional breakpoint. I need to implement this on Z80 side.


# SW Breakpoints

When a breakpoint is set the opcode at the breakpoint address is saved and instead a one byte opcode RST is added.
Chris uses RST 38h which makes the interrupts unusable but if the ROM is exchanged then it should be possible to use also other values.
If DIVMMC is used it depends on what addresses it reacts.

## Breakpoint conditions

After a breakpoint is hit it needs to be checked if the condition is true.

Conditions like
```(A > 3) AND (PEEKW(SP) != PC)```
should be allowed.

Here is the algorithm to implement the math expression: https://en.wikipedia.org/wiki/Shunting-yard_algorithm


# Reverse Debugging

Real reverse debugging, i.e. collecting a trace of instruction on the ZX Next, is not possible because this would run far too slow.

But it is possible to implement a lite version:
While steping or running (and break stopping) through the code at each stop the stack is and the register values are saved.
Then, when back stepping, one can exactly step back through these stored values.
6 changes: 4 additions & 2 deletions src/decoration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ export class DecorationClass {
const revDbgDecoType = vscode.window.createTextEditorDecorationType({
isWholeLine: true,
gutterIconSize: 'auto',
/* This gives a bad performance, it's better to change just the color.
borderWidth: '1px',
borderStyle: 'dashed', //'solid',
borderRadius: '5px',
/*
*/

light: {
// this color will be used in light color themes
backgroundColor: '#A9E2F3',
Expand All @@ -109,7 +111,7 @@ export class DecorationClass {
// this color will be used in dark color themes
backgroundColor: '#033563',
}
*/

});


Expand Down

0 comments on commit 38b43d9

Please sign in to comment.