[Feature Request] Watch struct support
See original GitHub issueWould it be possible to enhance the WATCH window to allow structured data to be conveniently visualised? The end result would be like viewing a struct or array of structures when debugging C in Visual Studio.
Currently for watches you can tell DeZog the number of elements to show and if it should show bytes, words or both. The format is:
label,size,types
with
- label: The label, e.g. LBL_TEXT or just a number e.g. 0x4000
- size: The number of elements to show. Defaults to 100 if omitted.
- types: Determines if a byte array (‘b’), a word array (‘w’) or both (‘bw’) should be shown. Defaults to ‘bw’.
It would be very helpful for debugging if
- size: could be extended to accept labels
- types: could be extended to accept any numeric value or label to use as the structure size
For example:
STRUCT Hitbox
x0 BYTE 0 ; min X
x1 BYTE 0 ; max X (inclusive)
y0 BYTE 0 ; min Y
y1 BYTE 0 ; max Y (inclusive)
ENDS
STRUCT Invader
active BYTE
type BYTE
pSpriteAttributes WORD ; address of sprite attributes
hitboxScreenSpace Hitbox
ENDS
INVADER_COUNT EQU 55
invaders DS INVADER_COUNT*Invader
When assembled with sjasmplus this produces in the .lst file (or .lables file if sjasmplus --lstlab option used)
0x0008 Invader
0x0000 Invader.active
0x0001 Invader.type
0x0002 Invader.pSpriteAttributes
0x0004 Invader.hitboxScreenSpace
0x0004 X Invader.hitboxScreenSpace.x0
0x0005 X Invader.hitboxScreenSpace.x1
0x0006 X Invader.hitboxScreenSpace.y0
0x0007 X Invader.hitboxScreenSpace.y1
As a first pass, if the label ‘invaders’ watched, the user could specify invaders,55,8b which would display the memory in groupings of 8 bytes.
v WATCH
v invaders,55,8b
v 8b: [0,54]
v [0]
[0]: 00h
[1]: 00h
[2]: 00h
[3]: 00h
[4]: 00h
[5]: 00h
[6]: 00h
[7]: 00h
v [1]
[0]: 00h
[1]: 00h
[2]: 00h
[3]: 00h
[4]: 00h
[5]: 00h
[6]: 00h
[7]: 00h
> [2]
> [3]
> [4]
....
> [54]
Better still, if the Watch window could access types from the lst, it would know the size of the Invader struct and the array size, so the user could enter invaders,INVADER_COUNT,Invader
v WATCH
v invaders,INVADER_COUNT,Invader
v Invader: [0,54]
v [0]
[0]: 00h
[1]: 00h
[2]: 00h
[3]: 00h
[4]: 00h
[5]: 00h
[6]: 00h
[7]: 00h
v [1]
[0]: 00h
[1]: 00h
[2]: 00h
[3]: 00h
[4]: 00h
[5]: 00h
[6]: 00h
[7]: 00h
> [2]
> [3]
> [4]
....
> [54]
Ideally, the Watch window would parse the list file to allow the individual element struct members to be shown with the name and type:
v WATCH
v invaders,INVADER_COUNT,Invader
v Invader: [0,54]
v [0]
active: 00h
type: 00h
pSpriteAttributes: 0000h
v hitboxScreenSpace
x0: 00h
x1: 00h
y0: 00h
y1: 00h
v [1]
active: 00h
type: 00h
pSpriteAttributes: 0000h
v hitboxScreenSpace
x0: 00h
x1: 00h
y0: 00h
y1: 00h
> [2]
> [3]
> [4]
....
> [54]
I appreciate that this might not be possible, but it would make a huge difference to the quality of the debugging experience.
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (7 by maintainers)
Top GitHub Comments
I wasn’t aware of this! Quite a limitation.
Just saw this: Thanks for the sponsorship !