Author Topic: Possible to modify type of element in a watch structure?  (Read 1318 times)

Online AndrewCot

  • Almost regular
  • **
  • Posts: 196
Possible to modify type of element in a watch structure?
« on: March 05, 2021, 12:25:02 am »

How can I change the format on elements on a structure in the watch window?  For example take the structure, "ifreq" which is defined in "if.h" (Linux).   Now this structure has a lot of elements.  Some are buffers, some are character strings, some are 4 byte unsigned int types, some are arrays, etc...

Now I can only change the data format for the root node which changes everything.  IE I can set it to character arrays and see the strings, but then even an int value is treated as a string.  Id like to just change the leaf node to display it's data type.

I can add a watch for an element in the structure and codeblocks allows me to change the data type via the properties context menu.

If codeblocks does not support it then is it easy/hard/impossible to modify the code to add this in? If it's easy or hard I will try to do it and upload a patch to sourceforge for review and potential inclusion into the code or is it easier to fork obfuscated github repo and create a pull regest? This assumes I can code the changes and am happy with the changes and they work on both Windows and Linux (I run Mint in a Virtualbox).

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13438
    • Travis build status
Re: Possible to modify type of element in a watch structure?
« Reply #1 on: March 05, 2021, 05:26:07 pm »
Using the current plugin implementation I don't think it will be possible.
Currently we execute a "print" command for the whole struct and just parse the result.
To get what you want you'll need to execute separate commands for every struct member. This would be extremely slow.

Have you considered writing a python pretty printer for your structs? (I'm not 100% sure it will work)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]