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



On 19 Mar, 18:38, Ulrich Eckhardt <dooms...@xxxxxxxx> wrote:
Uli

Dear Ulrich,

Thank you for your quick helps. Firstly, apologies for my possibly off-
topic topic, but I think that possibly there might be some Linux-based
debug tools for my purpose.


However, the problem is that my program will NOT KNOW which function
to be provided by the users and which/ how many parameters (defined as
global variables) the function may take

Give me an example how your program is supposed to behave in action. IOW,
what is the user-input and what is the program output? Collecting
use-cases is a good start for defining the behaviour in general.


Secondly, I am afraid that my first post does not properly show what I
would like to ask (sorry about that). Actually as a part of my
research I have written an algorithm to solve numerical functions. The
algorithm will be integrated by users with the code of their numerical
functions so that their program can solve the functions.

In other word, my algorithm will treat users' numerical functions as
black boxes. It will solve them no matter what is the content of these
functions provided that they conform to the format y=f(vector x).

However, there is a problem: the functions of users may change
dynamically over time (for example, they may change from y=x+y to y=x
+2y, as shown in the previous post). My algorithm needs to track this
change without knowning anything about user source code. That's why I
am thinking about using Linux debug features.

I think that one solution for the problem might be:

1. List all global variables currently used in the program
2. Find out which global variables are being used by f (I can do that
by parsing the source code file of f)
3. Tracking the value of all these global variables to see whether
they have been changed outside of f or not. If they have, then
possibly that f has been changed too.

This is possible, but very complicated in C because it is a statically
compiled language. If you want the user to enter code that is to be
executed, you might want to take a look at dynamic languages like Python
instead. If you want to stay with C, you need to learn about the ELF
binary format (which is used by Linux) and you need to learn about memory
protection methods in order to track accesses to variables.

As mentioned above, I do not want users to enter code dynamically.
Instead users will integrate my algorithm with their source code and
compile it, and I need to track how many variables they are using and
whether their variables have changed or not.

Do you have any idea about this issue?

Thank you very much and again sorry for my slightly off-topic
question.

Best regards,

Thanh.

.



Relevant Pages

  • Re: Blowfish Sign Extension implementation risk
    ... > Tom St Denis wrote: ... >> the algorithm correctly in the first place is the better course of action. ... mainstream, was published with C source code (again, see Dr. Dobbs, ... Applied Cryptography, etc.). ...
    (sci.crypt)
  • Re: How much must be revealed
    ... You can convince peope to trust your /algorithm/ by publishing it. ... You can convince people that you are not a liar by providing source code. ... Not only because the algorithm cannot be ... Microsoft-built crypto software in the black. ...
    (sci.crypt)
  • Re: [Khufu] Pre-Computing the S-Boxes and obtaining aux. keys
    ... > algorithm, but he did some quick hacks to get around the fact he hasn't ... Then click on "Images", and browse the document (it's a series of TIFF ... If you manage to get a working Khufu implementation, ... I'd encourage you to release the source code on the Internet, ...
    (sci.crypt)
  • Hi.. Need immediate help
    ... I would like to request all the members to help me find the source code ... 8.c program for spanning tree algorithm to find loopless path with 6 to ... Using FIFO or Message Queue as the IPC Channed (Processes are ... Please let me know the C source code and also implementation details. ...
    (comp.lang.c)
  • Re: How much must be revealed
    ... You can convince peope to trust your /algorithm/ by publishing it. ... You can convince people that you are not a liar by providing source code. ... Not only because the algorithm cannot be ...
    (sci.crypt)