This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: Patch: `maint
- To: tromey at cygnus dot com
- Subject: Re: Patch: `maint
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Mon, 31 Jan 2000 16:45:03 +1100
- CC: gdb-patches at sourceware dot cygnus dot com
- Organization: Cygnus Solutions
- References: <87ogak5z6n.fsf@cygnus.com>
Tom Tromey wrote:
(I've no opinion on the actual command - if it helps improve profiling
then it is probably good :-)
> +/* "maintenance profile-gdb <on|off>" */
> +static void
> +maint_profile_gdb (char *arg, int from_tty)
> +{
> +#ifdef ENABLE_PROFILE
> + int val;
> + if (arg == NULL || ! *arg)
> + error ("requires argument (\"on\" or \"off\"");
> + if (! strcmp (arg, "on"))
> + val = 1;
> + else if (! strcmp (arg, "off"))
> + val = 0;
> + else
> + error ("unrecognized argument; must be \"on\" or \"off\"");
> + moncontrol (val);
> +#else
> + error ("gdb was not configured with --enable-profiling");
> +#endif
> +}
> +
Have a look at the (cumbersom) add_set_enum_cmd() interface. By using
that interface, the interaction:
(gdb) maint profile-gdb <TAB>
will correctly list the set of choices available to the user. See also:
(gdb) set remote X-packet <TAB>
auto disable enable
enjoy,
Andrew