From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eli Zaretskii" To: jason-swarelist@molenda.com Cc: gdb-patches@sources.redhat.com, tromey@cygnus.com Subject: Re: [RFA] patch to add 'maint profile-gdb' command Date: Wed, 12 Sep 2001 06:00:00 -0000 Message-id: <7263-Wed12Sep2001155646+0300-eliz@is.elta.co.il> References: <20010911013721.A25996@shell17.ba.best.com> <20010911235955.A21595@shell17.ba.best.com> X-SW-Source: 2001-09/msg00160.html > Date: Tue, 11 Sep 2001 23:59:55 -0700 > From: Jason Molenda > > On Tue, Sep 11, 2001 at 10:57:34AM +0200, Eli Zaretskii wrote: > > > What I meant is that given you did compile with -pg, monstartup should do > > the same as linking with -pg, with the possible exception of linking in > > libc_p.a. (I don't think profiling the library is something you would > > want to do in this case. IIRC, many systems don't even have libc_p > > installed.) > > Are you suggesting that a program linked with -pg should call monstartup()? No, I mean that a program _compiled_ with -pg, but linked _without_ -pg will not start profiling until it calls monstartup. When you _link_ with -pg, you link into your program a module, normally called gcrt0.o, which calls monstartup (or its equivalent) right from the beginning. > There isn't any point - you're already profiling when you hit main() in a > program compiled -pg. Program compiled with -pg, but linked without -pg will not automatically profile itself, AFAIK. > #ifdef ENABLE_PROFILING > #ifdef HAVE_MONCONTROL > moncontrol (0); > #endif > #endif > > (or a compound #if, whatever.) I really don't see much point to > bothering wiith a check for moncontrol. I suppose it means a gdb > developer who tries to enable profiling without the necessary > moncontrol() function will find out about his folly at configure-time > instead of link-time, but that's the only benefit I can see. I think this benefit should not be disposed off too easily. A person who tries to configure with --enable-profiling might not realize we require moncontrol, since usually building a profiling version of a program doesn't require moncontrol, just -pg.