Re: How to write a program to track the value of a certain variable at run-time using debug features???
- From: "classicalmania" <trungthanh78@xxxxxxxxx>
- Date: 19 Mar 2007 14:51:01 -0700
One possible solution, as suggested by Martin Irman from
microsoft.public.vc.debugger is to use C++ wrapper class. When used
along with template class this solution can help us to check each
time
a parameter change. Something like this:
template <class PRM_TYPE>
class Parameter
{
private:
PRM_TYPE _prm; //the current value of the parameter
PRM_TYPE _old_prm; //the old value of the parameter
public:
//...
PRM_TYPE operator = (const PRM_TYPE& prm)
{
if (_old_prm!=prm)//check to see there is a change
{
notice(); //notice us about the change
_old_prm=prm; //update the old value
}
return (_prm = prm);
}
//...
};
However, this solution still require users to do the following:
1. Either use Parameter as the base class for the parameters that
they
will use in the function
2. Or, use Parameter as the base class for all parameters. In this
case, we will still need to parse the code to find which parameter
being used in the function.
As a result, I was considering this the last resort and looking for
another alternative...
As I see, some debuggers (ddd for example) can show the list of global
variables and
their value at run-time, so I wonder whether it is possible for me to
re-use some API from the debugger.
If it is impossible, then probably the solution above is the best
choice.
Thank you very much
Best regards,
Thanh.
.
- Follow-Ups:
- References:
- Prev by Date: Re: no Hello World!!
- Next by Date: Re: no Hello World!!
- Previous by thread: Re: How to write a program to track the value of a certain variable at run-time using debug features???
- Next by thread: Re: How to write a program to track the value of a certain variable at run-time using debug features???
- Index(es):
Relevant Pages
|