This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch: `maint


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]