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

Andrew Cagney
2001-09-17T22:43:00Z

>
> Emacs uses monstartup and manages to solve both of these problems.
> See the file src/emacs.c (search for "etext") for the details.

from emacs 20.7:

> /* Gerd Moellmann <gerd@acm.org> says this makes profiling work on
> FreeBSD. It might work on some other systems too.
> Give it a try and tell me if it works on your system. */
> #ifdef __FreeBSD__
> #ifdef PROFILING
> if (initialized)
> {
> extern void _mcleanup ();
> extern char etext;
> extern Lisp_Object Fredraw_frame ();
> atexit (_mcleanup);
> /* This uses Fredraw_frame because that function
> comes first in the Emacs executable.
> It might be better to use something that gives
> the start of the text segment, but start_of_text
> is not defined on all systems now. */
> monstartup (Fredraw_frame, &etext);
> }
> else
> moncontrol (0);
> #endif
> #endif

I get the feeling that this is work in progress. I'd, for the moment,
suggest using Jason's mechanism - it isn't perfect but it works.
Someone can later make it more fancy.

Andrew