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

Eli Zaretskii
2001-09-11T00:38:00Z

On Mon, 10 Sep 2001, Jason Molenda wrote:

> > > I'd disagree. First, these functions are not very portable. Our
> > > very own RH 6.2 box that is sourceware.cygnus.com does not have
> > > moncontrol() or monstart(), and -pg doesn't seem to be usable at
> > > all. My RH 7.1 box at home works fine. MacOS X's FreeBSD works
> > > fine.
> >
> > We could autoconfiscate this, couldn't we?
>
> We could detect whether moncontrol() exists or not, but there aren't
> any macros specifically related to profiling in automake/autoconf.

There's a general-purpose macro to test for an existence of a
function; I think that is all we need.

> You're going to have
> an ifdef in main.c either way - either to check ENABLE_PROFILING
> or check HAVE_MONCONTROL - and profiling is not going to work unless
> you're specifically compiling gdb with profiling in mind.

The HAVE_* macros are the ``normal'' way these things should work, I
think.

> > > I just re-read the man page, it doesn't matter where it's disabled. The
> > > gmon.out file is going to be overwritten each time gdb is run no matter
> > > what.
> >
> > Not if we use monstartup: the file is not touched unless monstartup is
> > called.
>
> monstartup provides some information, but not everything that full
> profiling gets you.

Sorry, I don't understand what you mean. AFAIK, a program linked with
"-pg" calls monstartup in its startup code. So using monstartup
manually where you want to start profiling should not lose any
information, while avoiding the noise in the profile from GDB's
startup code and gratuitous overwriting of gmon.out.