Exemplo n.º 1
0
void
cli_style_option::do_show_intensity (struct ui_file *file, int from_tty,
				     struct cmd_list_element *cmd,
				     const char *value)
{
  const char *name = (const char *) get_cmd_context (cmd);
  fprintf_filtered (file, _("The \"%s\" display intensity is: %s\n"),
		    name, value);
}
Exemplo n.º 2
0
static void
pascm_show_func (struct ui_file *file, int from_tty,
		 struct cmd_list_element *c, const char *value)
{
  param_smob *p_smob = (param_smob *) get_cmd_context (c);
  SCM value_scm, self, result, exception;
  char *msg;
  struct cleanup *cleanups;

  gdb_assert (gdbscm_is_procedure (p_smob->show_func));

  value_scm = gdbscm_scm_from_host_string (value, strlen (value));
  if (gdbscm_is_exception (value_scm))
    {
      error (_("Error converting parameter value \"%s\" to Scheme string."),
	     value);
    }
  self = p_smob->containing_scm;

  result = gdbscm_safe_call_2 (p_smob->show_func, self, value_scm,
			       gdbscm_user_error_p);

  if (gdbscm_is_exception (result))
    {
      pascm_signal_setshow_error (result,
				  _("Error occurred showing parameter."));
    }

  msg = gdbscm_scm_to_host_string (result, NULL, &exception);
  if (msg == NULL)
    {
      gdbscm_print_gdb_exception (SCM_BOOL_F, exception);
      error (_("Error converting show text to host string."));
    }

  cleanups = make_cleanup (xfree, msg);
  fprintf_filtered (file, "%s\n", msg);
  do_cleanups (cleanups);
}
Exemplo n.º 3
0
static void
cmdscm_function (struct cmd_list_element *command, char *args, int from_tty)
{
  command_smob *c_smob/*obj*/ = (command_smob *) get_cmd_context (command);
  SCM arg_scm, tty_scm, result;

  gdb_assert (c_smob != NULL);

  if (args == NULL)
    args = "";
  arg_scm = gdbscm_scm_from_string (args, strlen (args), host_charset (), 1);
  if (gdbscm_is_exception (arg_scm))
    error (_("Could not convert arguments to Scheme string."));

  tty_scm = scm_from_bool (from_tty);

  result = gdbscm_safe_call_3 (c_smob->invoke, c_smob->containing_scm,
			       arg_scm, tty_scm, gdbscm_user_error_p);

  if (gdbscm_is_exception (result))
    {
      /* Don't print the stack if this was an error signalled by the command
	 itself.  */
      if (gdbscm_user_error_p (gdbscm_exception_key (result)))
	{
	  char *msg = gdbscm_exception_message_to_string (result);

	  make_cleanup (xfree, msg);
	  error ("%s", msg);
	}
      else
	{
	  gdbscm_print_gdb_exception (SCM_BOOL_F, result);
	  error (_("Error occurred in Scheme-implemented GDB command."));
	}
    }
}
Exemplo n.º 4
0
static void
pascm_set_func (const char *args, int from_tty, struct cmd_list_element *c)
{
  param_smob *p_smob = (param_smob *) get_cmd_context (c);
  SCM self, result, exception;
  char *msg;
  struct cleanup *cleanups;

  gdb_assert (gdbscm_is_procedure (p_smob->set_func));

  self = p_smob->containing_scm;

  result = gdbscm_safe_call_1 (p_smob->set_func, self, gdbscm_user_error_p);

  if (gdbscm_is_exception (result))
    {
      pascm_signal_setshow_error (result,
				  _("Error occurred setting parameter."));
    }

  if (!scm_is_string (result))
    error (_("Result of %s set-func is not a string."), p_smob->name);

  msg = gdbscm_scm_to_host_string (result, NULL, &exception);
  if (msg == NULL)
    {
      gdbscm_print_gdb_exception (SCM_BOOL_F, exception);
      error (_("Error converting show text to host string."));
    }

  cleanups = make_cleanup (xfree, msg);
  /* GDB is usually silent when a parameter is set.  */
  if (*msg != '\0')
    fprintf_filtered (gdb_stdout, "%s\n", msg);
  do_cleanups (cleanups);
}
Exemplo n.º 5
0
/* FIXME: needs comment: */
static void
call_dump_func(struct cmd_list_element *c, const char *args, int from_tty)
{
  struct dump_context *d = (struct dump_context *)get_cmd_context(c);
  d->func(args, d->mode);
}