This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
How to instrument a program using GCC
- From: "Haifeng He" <hehaifeng2nd at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Fri, 15 Feb 2008 16:06:30 -0700
- Subject: How to instrument a program using GCC
Hi,
I am trying to do some program instrumentation using GCC.
Suppose I have a C program, look like the following:
struct s {
int x; int y;
};
foo (int a, int b) {
struct s s;
s.x = a+b;
s.y = a-b;
}
I would like to instrument to program to do a value profiling of all
the variables in the program, i.e., what are the values of a, b, s.x,
s.y for test run. I think I could probably use GCC to automate the
process but I don't know how to start. Any suggestion will be
appreciated.
Thanks
Haifeng