tags:

views:

30

answers:

2

When I am in debug and I am dealing with some legacy code or some framework sometimes I need to get the property that contains a particular value. For example I know I put 153 on UI and I need to know where is it after I put it there. This will help to understand lot of things about this framework. That`s a one usage, the question is how to do it?

A: 

Well yeah, you've answered your own question with your tag: you attach a debugger to it and inspect the value.

Noon Silk
No, the question is how to get class property/field where this value lies with current debugging context. How to find it? If the only way is manually, just imagine how much properties you`ll need to check to get to the one you need.
Yaroslav Yakovlev
A: 

I wonder if you are referring to a "reverse engineering" requirement
where, you do not have source-level debug and
cannot use symbol reference to locate the field in question.

If that is so, and you know a general address range where the change might occur,
you could take a snapshot of the memory area before and after the change.

A diff on two text snapshots in this way would locate the address.


Another way would be to run a search through the address range to locate the entered value.

  • This is prone to false-positives depending on the 'simplicity' of the changed value
    (153, for example, is very difficult to search)
  • If the input can be altered in the program memory, it will also cause false-negatives


Some debug environments support data-watchpoints.
But these are usually not available for large ranges.

nik
Well, actually I want to know how to get property/field name by providing the value. E.g: I have a a complicated class hierarchy in some project with legacy code. I need to understand where one of my input values goes to understand how it all works. I`m getting this tool if I had one and just write 153. It shows me all the classes that have property/field value equal to 153.
Yaroslav Yakovlev