maziac / DeZog

Visual Studio Code Debugger for Z80/ZX Spectrum.
MIT License
212 stars 35 forks source link

Watch expression evaluates incorrect value for label within IFDEF #24

Closed darenm closed 4 years ago

darenm commented 4 years ago

Describe the bug Watch expression evaluates incorrect value for label within IFDEF. In the IFDEF below I have two definitions of Level. When referring to Level in a watch expression, the address of the second Level (which is the end of the first Level) is returned

SRC:

    DEFINE CURRENT_LEVEL_1

    ; code here...

    IFDEF CURRENT_LEVEL_1
Level   TileMapStruct 62,  60, 0, 0, 0, 0
    ELSE
Level   TileMapStruct 160, 40, 0, 0, 0, 0
    ENDIF

LST:

 239  89B0                  IFDEF CURRENT_LEVEL_1
 240  89B0 3E 3C 00 00  Level   TileMapStruct 62,  60, 0, 0, 0, 0
 240  89B4 00 00
 241  89B6                  ELSE
 242  89B6 ~            Level   TileMapStruct 160, 40, 0, 0, 0, 0
 243  89B6                  ENDIF
 244  89B6

Watches: image

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior I expect Level to be evaluated to the value: $89B0 instead of $89B6 Screenshots If applicable, add screenshots to help explain your problem.

Version etc. (please complete the following information):

Additional context Please attach your launch.json file.

{
    "configurations": [
        {
            "type": "dezog",
            "request": "launch",
            "name": "DeZog",
            "remoteType": "cspect",
            "zsim": {
                "loadZxRom": true
            },
            "listFiles": [
                {
                    "path": "${workspaceRoot}\\project\\src\\Main.lst",
                    "asm": "sjasmplus",
                    "mainFile": "${workspaceRoot}\\project\\src\\Main.asm"
                },

            ],
            "startAutomatically": false,
            "skipInterrupt": true,
            "history": {
                "reverseDebugInstructionCount": 10000
            },
            "commandsAfterLaunch": [
                "-sprites",
                "-patterns"
            ],
            "disassemblerArgs": {
                "esxdosRst": true
            },
            "rootFolder": "${workspaceFolder}",
            "topOfStack": "stack_top",
            "load": "project.nex",
            "smallValuesMaximum": 513,
            "tmpDir": ".tmp"
       }    
    ]
}
maziac commented 4 years ago

Thanks for the error report. I think I know where this comes from. Will correct it.

maziac commented 4 years ago

I fixed it, please try https://github.com/maziac/DeZog/releases/tag/v1.3.1 and let me know if it works.

darenm commented 4 years ago

The bug is fixed in the 1.3.1 prerelease - thanks.