Ejemplo n.º 1
0
void
_cgo_panic (const char *p)
{
  intgo len;
  unsigned char *data;
  String *ps;
  Eface e;
  const struct __go_type_descriptor *td;

  runtime_exitsyscall (0);
  len = __builtin_strlen (p);
  data = alloc_saved (len);
  __builtin_memcpy (data, p, len);
  ps = alloc_saved (sizeof *ps);
  ps->str = data;
  ps->len = len;
  td = &string_type_descriptor;
  memcpy(&e._type, &td, sizeof td); /* This is a const_cast.  */
  e.data = ps;

  /* We don't call runtime_entersyscall here, because normally what
     will happen is that we will walk up the stack to a Go deferred
     function that calls recover.  However, this will do the wrong
     thing if this panic is recovered and the stack unwinding is
     caught by a C++ exception handler.  It might be possible to
     handle this by calling runtime_entersyscall in the personality
     function in go-unwind.c.  FIXME.  */

  __go_panic (e);
}
Ejemplo n.º 2
0
void
__go_panic_msg (const char* msg)
{
  size_t len;
  unsigned char *sdata;
  struct __go_string s;
  struct __go_empty_interface arg;

  len = __builtin_strlen (msg);
  sdata = runtime_mallocgc (len, FlagNoPointers, 0, 0);
  __builtin_memcpy (sdata, msg, len);
  s.__data = sdata;
  s.__length = len;
  newErrorString(s, &arg);
  __go_panic (arg);
}
Ejemplo n.º 3
0
void
_cgo_panic (const char *p)
{
  int len;
  unsigned char *data;
  struct __go_string *ps;
  struct __go_empty_interface e;

  len = __builtin_strlen (p);
  data = __go_alloc (len);
  __builtin_memcpy (data, p, len);
  ps = __go_alloc (sizeof *ps);
  ps->__data = data;
  ps->__length = len;
  e.__type_descriptor = &string_type_descriptor;
  e.__object = ps;
  __go_panic (e);
}