From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10742 invoked by alias); 15 Feb 2008 23:07:08 -0000 Received: (qmail 10457 invoked by uid 22791); 15 Feb 2008 23:06:52 -0000 X-Spam-Check-By: sourceware.org Received: from wr-out-0506.google.com (HELO wr-out-0506.google.com) (64.233.184.227) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 15 Feb 2008 23:06:35 +0000 Received: by wr-out-0506.google.com with SMTP id c47so1384419wra.20 for ; Fri, 15 Feb 2008 15:06:32 -0800 (PST) Received: by 10.142.178.13 with SMTP id a13mr2807893wff.17.1203116790807; Fri, 15 Feb 2008 15:06:30 -0800 (PST) Received: by 10.142.157.4 with HTTP; Fri, 15 Feb 2008 15:06:30 -0800 (PST) Message-ID: Date: Fri, 15 Feb 2008 23:07:00 -0000 From: "Haifeng He" To: gcc-help@gcc.gnu.org Subject: How to instrument a program using GCC MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2008-02/txt/msg00190.txt.bz2 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