Re: How to write a program to track the value of a certain variable at run-time using debug features???



"classicalmania" <trungthanh78@xxxxxxxxx> writes:

One possible solution, as suggested by Martin Irman from
microsoft.public.vc.debugger is to use C++ wrapper class.

If you are going to restrict your users in certain ways, such as
above, a much simpler solution is to tell them:

- when you are solving for a given f(x), you must ensure that f()
is a true function of x (i.e. ensure that no external parameter
modification happens).

- when you are done with f(x), you can change what f(x) does in
arbitrary ways, but you must call solver_reset() routine.

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.

The only API Linux debuggers use is ptrace(). In order to "reuse" it,
your program must have detailed understanding of the ELF file format,
which isn't too difficult, but isn't trivial either.

Besides, this approach doesn't solve *anything*: if some globals
are pointers, then you must track not only that the pointer itself
didn't change, but the "pointed to" thing didn't change either.

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
.



Relevant Pages

  • Re: Interesting article by Joel Spolsky: The Perils of JavaSchools
    ... What matters is that Lisp teaches students to use ... recursion, because they have to. ... Java does NOT teach students to use ... pointers and recursion, she'll be able to understand anything, and get ...
    (comp.programming)
  • Re: What does restrict mean?
    ... void * restrict pSrc, size_t size) ... return pDest; ... doesn't give the compiler any information at all to say if it overlaps ... comparison of the pointers in MemFoo cannot be eliminated as is. ...
    (comp.lang.c)
  • Re: What does restrict mean?
    ... but what does the keyword 'restrict' mean? ... The reason that memcpy has the restrict keyword and memmove doesn't ... will be made from s2 or pointers derived from s2. ...
    (comp.lang.c)
  • Re: General remarks on restrict
    ... But when a function add a restrict qualification to its parameters (in ... And if I have two pointers that can be used to access the same lvalue, ... it is the hypothetical constraint that k should not be ...
    (comp.std.c)
  • Re: What is this noalias thing Dennis Ritchie is railing about ?
    ... Take a look at the C99 prototypes for memcpy and memmove: ... It's possible that s1 and/or pointers derived from s1, ... This allows restrict to specify exactly what was ...
    (comp.lang.c)