Ideas for new watch window formats

I've been using RemedyBG for a couple of weeks now. Overall, I really like it. Here are some ideas to make this excellent debugger even better:

  1. Lately, I've written and debugged a lot of parsers, and a common thing you want to do is look at a big string and highlight the current token you're processing. This's similar to the source file view or assembly window: you highlight the current line or instruction, and still can scroll up and down to look at the previous/next instructions. I can see the same idea apply here. Currently, I have to do something like file->str + token->pos, str file->size to view from the current token forward to the end of the file. If I want to look at all the previous tokens, then I'm out of luck (I can open a window to view from the beginning to the current token, but it's not great either). What I'm proposing is to have something like file->str, str file->size { __current token->pos, token->size }. You can apply this syntax to even more generic use cases like highlighting the current element in an array/table format or the current instruction in the disasm format.

  2. It's common for me to have a union and have multiple nested structs inside for overlapping fields like this:

    union Vector2 {

     struct { float a, b; };
    
     struct { float x, y; };
    
     struct { float min, max; };
    
     struct { float start, end; };
    
     float v[2];
    

    };

    If I just put a variable of this type in the watch window, it would display all the fields. I wish I could apply the table format specifier here and do something like myVector2 { $.a, $.v[1] }. This also can apply to any type if you want. For example, if I have a Player type and only want to display the health and money fields, I can do this myPlayer { $.health, $.money }.


Edited by longtran2904 on

There's issue related to this here: https://github.com/x13pixels/remedybg-issues/issues/113

The idea is to allow user to write any arbitrary formatting for custom types.

longtran2904,

  1. I needed something similar recently where I wanted to highlight a range in a single line string to double-check some indexes. One idea was to have string selection show character position + size, either in tooltip or in some status text. Highlighting based on an arbitrary expression sounds cool. Good idea.

  2. This is possible to do now with the existing format specifier (though the height of the evaluated expression is not really ideal for a single element):

             &myVector2, 1 { $.a, $.v[1] }
             &myPlayer, 1 { $.health, $.money }

Edited by x13pixels on Reason: typo

I think highlighting an index with a range inside an array is enough. It can be a string (char array), disassembly (instruction array), or any arrays in general (e.g myGameAssets, assetCount { __current level->startAsset, level->assetCount } will highlight all the current assets for the level).


Replying to x13pixels (#27115)