public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* How to instrument a program using GCC
@ 2008-02-15 23:07 Haifeng He
  2008-02-17 20:17 ` Diego Novillo
  0 siblings, 1 reply; 5+ messages in thread
From: Haifeng He @ 2008-02-15 23:07 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to instrument a program using GCC
  2008-02-15 23:07 How to instrument a program using GCC Haifeng He
@ 2008-02-17 20:17 ` Diego Novillo
  2008-02-19  4:12   ` Haifeng He
  0 siblings, 1 reply; 5+ messages in thread
From: Diego Novillo @ 2008-02-17 20:17 UTC (permalink / raw)
  To: Haifeng He; +Cc: gcc-help

On Fri, Feb 15, 2008 at 6:06 PM, Haifeng He <hehaifeng2nd@gmail.com> wrote:

>  I would like to instrument to program to do a value profiling of all
>  the variables in the program

See the documentation on -fprofile-generate and -fprofile-use in the
GCC documentation.


Diego.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to instrument a program using GCC
  2008-02-17 20:17 ` Diego Novillo
@ 2008-02-19  4:12   ` Haifeng He
  2008-02-19 13:38     ` Diego Novillo
  0 siblings, 1 reply; 5+ messages in thread
From: Haifeng He @ 2008-02-19  4:12 UTC (permalink / raw)
  To: Diego Novillo; +Cc: gcc-help

Thanks for replying. I searched online but could not find much information about
GCC tree-profiling. GCC Internal also does not explain much on that. Is there
any other document explains that subject? Or some kind of tutorial or small
example that demonstrates how to manipulate GIMPLE tree will be also very
helpful.

Thanks

Haifeng

On Feb 17, 2008 1:16 PM, Diego Novillo <dnovillo@google.com> wrote:
> On Fri, Feb 15, 2008 at 6:06 PM, Haifeng He <hehaifeng2nd@gmail.com> wrote:
>
> >  I would like to instrument to program to do a value profiling of all
> >  the variables in the program
>
> See the documentation on -fprofile-generate and -fprofile-use in the
> GCC documentation.
>
>
> Diego.
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to instrument a program using GCC
  2008-02-19  4:12   ` Haifeng He
@ 2008-02-19 13:38     ` Diego Novillo
  2008-02-19 21:10       ` Haifeng He
  0 siblings, 1 reply; 5+ messages in thread
From: Diego Novillo @ 2008-02-19 13:38 UTC (permalink / raw)
  To: Haifeng He; +Cc: gcc-help

On 2/18/08 11:12 PM, Haifeng He wrote:
> Thanks for replying. I searched online but could not find much information about
> GCC tree-profiling. GCC Internal also does not explain much on that. Is there
> any other document explains that subject? Or some kind of tutorial or small
> example that demonstrates how to manipulate GIMPLE tree will be also very
> helpful.

If you just want GCC to instrument your program, then reading on how to 
use the -fprofile-* switches should be enough.  Both are in the user 
manual that comes with GCC.

If you want to know *how* these options work, that's different.  A good 
starting point is the GCC wiki.  In particular, 
http://gcc.gnu.org/wiki/GettingStarted


Diego.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to instrument a program using GCC
  2008-02-19 13:38     ` Diego Novillo
@ 2008-02-19 21:10       ` Haifeng He
  0 siblings, 0 replies; 5+ messages in thread
From: Haifeng He @ 2008-02-19 21:10 UTC (permalink / raw)
  To: Diego Novillo; +Cc: gcc-help

Thank you very much.

Haifeng

On Feb 19, 2008 5:29 AM, Diego Novillo <dnovillo@google.com> wrote:
> On 2/18/08 11:12 PM, Haifeng He wrote:
> > Thanks for replying. I searched online but could not find much information about
> > GCC tree-profiling. GCC Internal also does not explain much on that. Is there
> > any other document explains that subject? Or some kind of tutorial or small
> > example that demonstrates how to manipulate GIMPLE tree will be also very
> > helpful.
>
> If you just want GCC to instrument your program, then reading on how to
> use the -fprofile-* switches should be enough.  Both are in the user
> manual that comes with GCC.
>
> If you want to know *how* these options work, that's different.  A good
> starting point is the GCC wiki.  In particular,
> http://gcc.gnu.org/wiki/GettingStarted
>
>
> Diego.
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-02-19 21:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-15 23:07 How to instrument a program using GCC Haifeng He
2008-02-17 20:17 ` Diego Novillo
2008-02-19  4:12   ` Haifeng He
2008-02-19 13:38     ` Diego Novillo
2008-02-19 21:10       ` Haifeng He

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).