Re: [RFA] patch to add 'maint profile-gdb' command

Jason Molenda
2001-09-12T00:00:00Z

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()?
There isn't any point - you're already profiling when you hit main() in a
program compiled -pg.

> Anyway, I thought it was a policy in GNU projects to test for presence of
> any non-Posix function that a program needs.

I could add a check for moncontrol(), but obviously the check will
have to be run with -pg or it will be useless (cf my last note).
A failure could indicate either a lack of -pg support, or a lack
of the moncontrol() function.

But remember, the only time _any_ of this is going to be run is
when a developer has specifically configured their tree with
--enable-profiling. And the code in main.c is inevitably going
to look like

#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'm not trying to be recalcitrant (it comes naturally :-); if people
think that it's worthwhile to add an autoconf check for moncontrol,
I'll add it in there. But the results of this check will be ignored
99.9% of the time (because the vast majority of trees are not going
to be configured --enable-profiling).

Jason