Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Feature Requests
 search for constant

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
gmit Posted - Oct 22 2007 : 03:35:38 AM
There is one feature I miss during debugging (and, for example, it's offered in IDA). I would like to have a Find Constant dialog similar to Find Symbol - when a numeric value is entered, the list will show defines, enums and, possibly, const ints which equals to the entered value.

I was wondering - are there more people that would like such feature.
7   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Oct 24 2007 : 08:42:26 AM
Personally I see the appeal, but I also see some practical concerns.

Looking at the Find Symbol dialog in VA 1614 I am seeing the following:



Some of the values you are seeing in the definition column (the ones with a + sign) are calculated by VA for enum items. So the constant values are often listed here, but you do still have the problem of finding the item you want.
gmit Posted - Oct 24 2007 : 03:06:12 AM
To sl@sh:

That's exactly what I want. Some filtering (system-project) and by letter (like in find symbol window) will help in narrowing down the choice.


To feline:

I would expect all of them to be showed: TRIANGE as 1, SQUARE as 2, CIRCLE as 3 and ghi as 4.



OK, some more explanation. It's certainly not a feature I cannot live without; I just wanted to see if there are possibly more people that want this (obviously not).

I first saw the feature in IDA disassembler where it works rather nicely:

step 1 - http://tinyurl.com/365cg7
step 2 - http://tinyurl.com/377xu2

Recently I had to done some asm debugging in VS in which I had to track window messages; each was a hex number, so, I've had to manually find it in includes. At the same time, a friend of mine complained that his code is full of fixed constants that are difficult to rid of... So, I though it might be convenient to have such feature...
feline Posted - Oct 23 2007 : 5:07:24 PM
Let me rephrase the question. How does VA which of these is a constant:

enum Shapes { TRIANGLE = 1, SQUARE, CIRCLE };

enum {ghi = 4};

They both might be constants, or neither of them are constants. It needs some form of definition to separate out constants from "other things that look a bit like constants", or else you are just right back to the current FSIW dialog.

As soon as you look at enum's sl@sh is quite right, for any number under 10 you are likely to get far to many entries.
sl@sh Posted - Oct 23 2007 : 10:48:28 AM
The problem I see with enums is that when you use a lot, or just include a lot of sytem headers, you will end up with dozens or even hundreds of symbols equalling the constant '1'!
gmit Posted - Oct 22 2007 : 2:17:56 PM
By constants, I mean:
#define abc 3
const int def = 3;
enum {ghi = 4};

In dialog like 'find symbol', there could be listed:
abc 3
def 3
ghi 4


If in code you see something like:
a = b + 3
and the cursor is positioned over 3, after a command is invoked, VA could say that symbols abc and def are equal to 3 and can offer to change 3 to the selected symbol.

feline Posted - Oct 22 2007 : 1:47:48 PM
Calculating the enum's is not to big a problem.

What do you mean by a "constant"? For example what about

#define MY_INT long

Or the enum:

enum Shapes { TRIANGLE, SQUARE, CIRCLE };

I am a great believer in constants as constants, rather than hard coded in 3,000 places, but most of my enum's and #defines have nothing to do with numeric or string constants.

So the idea of a central list of constants is appealing, but what gets put in it, and how do you find the occasional constant when it is surrounded by a mass of other "things".
sl@sh Posted - Oct 22 2007 : 04:05:39 AM
Not sure how well this would work for enums, as those don't need to be assigned explicitely - it would require VAX to explicitely generate a list of enum integer values.

Apart from that I can see the appeal: replacing explicit constant values with previously defined symbols.

There already was a suggestion to generate a constant symbol if for some value no symbol exists yet. Maybe the above suggestion could be combined with that one.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000