I suppose it has to do with optimizing a variable into a register or removing an (unused) variable assign when optimizing.
I would suggest you to set Project -> Build settings -> Compiler -> Optimization to "none" and try again.
The optimization was always set to "none" in our project, in PSoC Creator 4 it is also set to "none".
I made a simple new project with PSoC Creator 4, there the debugging works. But when I use my old Project developed with PSoC Creator 3.3 the debugging does not work.
I have additional information on this issue. I have made a project only toggling a led based on a counter variable. The project is made for the CY8CKIT-059 and for a custom board with PSoC CY8C5666LTI-LP005. The version for the CY8CKIT is debugable, the value for the counter is shown correctly. The version for the 5666 otherwise shows an empty value when stopped via breakpoint (debug via swd / miniprog 3).
I would suggest you to get in contact with Cypress directly: At top of this page select "Design support -> Create a Support Case" and ask your questions. You will be helped by a Cypress engineer. Would be nice when you keep us informed.
I used Counter example project which demonstrates how an 8-bit UDB Counter component works and how to read the Period, Compare, and Counter values of the component.
I added watch and a breakpoint on a variable "interruptCnt"which was used to keep track of the number of interrupts received.
I debugged the code on PSOC Creator 3.3 on CY8CKIT-050,The variable was updating after each breakpoint hit(snapshot attached)
Similarly,I debugged the code on PSOC Creator 4.0 on CY8CKIT-050 (CY8C5868AXI-LP035),I observed same phenomenon as observed on PC3.3 after each breakpoint hit.
I checked on CY8CKIT-059(CY8C5888LTI-LP097) also, the same phenomenon I observed.
If issue is specific to the custom board,please check the schematics of custom board with the schematic of CY8CKIT-059.
You can also look into this document for the "Programming and Debug" section-
The bug fix is in PSoC Creator 4.1, which is due out in two weeks.
I apologize for this problem. We really should have caught it. We've adjusted some of our testing and code review methodology as a result.