[PATCH] Delete interp_exec_p

Pedro Alves palves@redhat.com
Wed Nov 13 13:11:00 GMT 2013


On 11/13/2013 12:16 AM, Doug Evans wrote:
> Hi.
> 
> I noticed this while working on some MI stuff.
> AFAICT every interpreter defines exec_proc so interp_exec_p is
> unnecessary.

I looked at Insight, and was a little worried, but I think it's fine.

It has a hack to disable interpreter-exec (generic/gdbtk-interp.c):

/* See note in gdbtk_interpreter_init */
static void
hack_disable_interpreter_exec (char *args, int from_tty)
{
  error ("interpreter-exec not available when running Insight");
}

static void *
gdbtk_interpreter_init (struct interp *interp, int top_level)
{
  /* Disable interpreter-exec. It causes us big trouble right now. */
...
  if (lookup_cmd_composition ("interpreter-exec", &alias, &prefix, &cmd))
    {
      set_cmd_cfunc (cmd, hack_disable_interpreter_exec);
    }


And then installs a exec_proc hook that does nothing:

static struct gdb_exception
gdbtk_interpreter_exec (void *data, const char *command_str)
{
  return exception_none;
}


void
_initialize_gdbtk_interp (void)
{
  static const struct interp_procs procs = {
...
   gdbtk_interpreter_exec,             /* exec_proc */
...


I considered whether it would be a cleaner to not install
a exec_proc hook.   But I think it'd be just as good to
have gdbtk_interpreter_exec itself return the error
instead of returning exception_none.

> Regression tested on amd64-linux.
> 
> Ok to check in?
> 
> 2013-11-12  Doug Evans  <dje@google.com>
> 
>     	* interps.h (interp_exec_p): Delete.
>     	* interps.c (interp_exec_p): Delete.
>     	(interp_exec): Update.  Assert interp->procs->exec_proc != NULL.
>     	* mi/mi-interp.c (mi_cmd_interpreter_exec): Update.

Looks good to me.

-- 
Pedro Alves



More information about the Gdb-patches mailing list