Exemplo n.º 1
0
throw_it (enum return_reason reason, enum errors error, const char *fmt,
	  va_list ap)
{
  struct gdb_exception e;
  char *new_message;
#if GDB_XCPT == GDB_XCPT_SJMP
  int depth = catcher_list_size ();
#else
  int depth = try_scope_depth;
#endif

  gdb_assert (depth > 0);

  /* Note: The new message may use an old message's text.  */
  new_message = xstrvprintf (fmt, ap);

  if (depth > exception_messages_size)
    {
      int old_size = exception_messages_size;

      exception_messages_size = depth + 10;
      exception_messages = XRESIZEVEC (char *, exception_messages,
				       exception_messages_size);
      memset (exception_messages + old_size, 0,
	      (exception_messages_size - old_size) * sizeof (char *));
    }
Exemplo n.º 2
0
throw_it (enum return_reason reason, enum errors error, const char *fmt,
	  va_list ap)
{
  struct gdb_exception e;
  char *new_message;
  int depth = catcher_list_size ();

  gdb_assert (depth > 0);

  /* Note: The new message may use an old message's text.  */
  new_message = xstrvprintf (fmt, ap);

  if (depth > exception_messages_size)
    {
      int old_size = exception_messages_size;

      exception_messages_size = depth + 10;
      exception_messages = (char **) xrealloc (exception_messages,
					       exception_messages_size
					       * sizeof (char *));
      memset (exception_messages + old_size, 0,
	      (exception_messages_size - old_size) * sizeof (char *));
    }

  xfree (exception_messages[depth - 1]);
  exception_messages[depth - 1] = new_message;

  /* Create the exception.  */
  e.reason = reason;
  e.error = error;
  e.message = new_message;

  /* Throw the exception.  */
  throw_exception (e);
}
Exemplo n.º 3
0
void
gdbscm_printf (SCM port, const char *format, ...)
{
  va_list args;
  char *string;

  va_start (args, format);
  string = xstrvprintf (format, args);
  va_end (args);
  scm_puts (string, port);
  xfree (string);
}
Exemplo n.º 4
0
void
serial_printf (struct serial *desc, const char *format,...)
{
  va_list args;
  char *buf;
  va_start (args, format);

  buf = xstrvprintf (format, args);
  serial_write (desc, buf, strlen (buf));

  xfree (buf);
  va_end (args);
}
Exemplo n.º 5
0
SCM
gdbscm_scm_from_printf (const char *format, ...)
{
  va_list args;
  char *string;
  SCM result;

  va_start (args, format);
  string = xstrvprintf (format, args);
  va_end (args);
  result = scm_from_latin1_string (string);
  xfree (string);

  return result;
}
Exemplo n.º 6
0
static void
link_callbacks_einfo (const char *fmt, ...)
{
  struct cleanup *cleanups;
  va_list ap;
  char *str;

  va_start (ap, fmt);
  str = xstrvprintf (fmt, ap);
  va_end (ap);
  cleanups = make_cleanup (xfree, str);

  warning (_("Compile module: warning: %s"), str);

  do_cleanups (cleanups);
}