From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Molenda To: gdb-patches@sources.redhat.com Cc: Tom Tromey Subject: [RFA] patch to add 'maint profile-gdb' command Date: Mon, 10 Sep 2001 00:30:00 -0000 Message-id: <20010910003022.A21681@shell17.ba.best.com> X-SW-Source: 2001-09/msg00125.html This is a refresh of Tom Tromey's gdb profiling patch, originally here: http://sources.redhat.com/ml/gdb-patches/2000-q1/msg00022.html Instead of profiling all of gdb, Tom's patch lets you profile a specific command (or commands). You enable profiling with the 'maint profile-gdb on' before the command(s) of interest, and 'maint profile-gdb off' (or exit) when you're finished. configure and config.in both need to be regenerated after applying this patch. Your build must be compiled with --enable-profiling for this feature to be enabled. My only comments on this patch are (1) the documentation entry could note that your gmon.out file will be overwritten each time gdb is started, even if you don't do a profile-gdb on command[1], and (2) the configure.in check for $enable_profiling could be embedded in the AC_ARG_ENABLE() autoconf call. It doesn't make any practical difference, but it looks like tradition in gdb's configure.in is to include this code inside the AC_ARG_ENABLE call. [1] A bit of profiling happens before it can be turned off in captured_main(). This initial profiling will overwrite away any existing gmon.out. At least it does with the gprof on Linux and FreeBSD systems. No testsuite regressions are added with this patch. This patch does not require approval for the 5.1 branch - it is not something end users have cause to enable. This patch does add a couple of ifdefs in main.c, aint.c to guard the code, but this is necessary. Obviously you can't compile in profiling all the time (performance, portability), and you can't make calls to the profiling system calls if you aren't compiling -pg. Jason >From jason-swarelist@molenda.com Mon Sep 10 00:36:00 2001 From: Jason Molenda To: gdb-patches@sources.redhat.com Subject: Typeo in NEWS Date: Mon, 10 Sep 2001 00:36:00 -0000 Message-id: <20010910003611.A22499@shell17.ba.best.com> X-SW-Source: 2001-09/msg00126.html Content-length: 249 The NEWS file claims that gdb's code has been converted to "ANS/ISO C". It should either be "ANSI/ISO C", or more correctly, just "ISO C". I won't argue strenuously for "ISO" over "ANSI/ISO", but the patch I'm including implements the latter. J >From eliz@is.elta.co.il Mon Sep 10 00:50:00 2001 From: Eli Zaretskii To: Jason Molenda Cc: gdb-patches@sources.redhat.com, Tom Tromey Subject: Re: [RFA] patch to add 'maint profile-gdb' command Date: Mon, 10 Sep 2001 00:50:00 -0000 Message-id: References: <20010910003022.A21681@shell17.ba.best.com> X-SW-Source: 2001-09/msg00127.html Content-length: 1698 On Mon, 10 Sep 2001, Jason Molenda wrote: > This is a refresh of Tom Tromey's gdb profiling patch, originally here: > http://sources.redhat.com/ml/gdb-patches/2000-q1/msg00022.html Thanks! I think it's a very useful feature, but I have a few minor comments. > My only comments on this patch are (1) the documentation entry > could note that your gmon.out file will be overwritten each time > gdb is started, even if you don't do a profile-gdb on command[1], and > (2) the configure.in check for $enable_profiling could be embedded > in the AC_ARG_ENABLE() autoconf call. It doesn't make any practical > difference, but it looks like tradition in gdb's configure.in is > to include this code inside the AC_ARG_ENABLE call. > > [1] A bit of profiling happens before it can be turned > off in captured_main(). This initial profiling will overwrite > away any existing gmon.out. At least it does with the gprof > on Linux and FreeBSD systems. Isn't it better to use monstartup instead of moncontrol and -pg? It looks like using monstartup could solve several problems: - you don't overwrite gmon.out unless you actually profile - you can link without -pg - you can make this option available by default, since it is invisible unless you actually profile (I dislike features that require a rebuild to become available) We will have to add Autoconf tests to see if monstartup is available, but I think using moncontrol if --enable-profiling is given is not safe enough anyway. In addition, I think the commands this patch adds should be documented in gdb.texinfo as well, since all commands one can type at GDB's prompt should be described there.