question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature Request] Watch struct support

See original GitHub issue

Would 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:closed
  • Created 3 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
howpricecommented, Jan 5, 2021

vscode does not allow editing of variables in the WATCH area.

I wasn’t aware of this! Quite a limitation.

1reaction
maziaccommented, Jan 5, 2021

Just saw this: Thanks for the sponsorship !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature Request: Add support for struct · Issue #12468 - GitHub
Summary of the new feature/enhancement As a user I want the "struct" keyword so that I can create custom objects derived from System....
Read more >
Feature Requests: How to Track, Prioritize, and Manage - Pipefy
Feature requests are demands for improvement in a company's product. Click to learn how to track and prioritize these requests efficiently!
Read more >
How We Manage Feature Requests at Float
This post covers how we manage user feedback and provides insight into how a feature request makes it onto our product roadmap and, ......
Read more >
Submit a feature request for Solarwinds Products
This article describes how to submit a feature request to SolarWinds. Feature requests and votes by you and other SolarWinds users help ......
Read more >
Dealbreakers: How to Handle Feature Requests from Prospects
Are you getting feature requests from prospects? Here's some considerations to remember when handling a dealbreaker request.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found