예제 #1
0
void
g_on_error_stack_trace (const gchar *prg_name)
{
#ifdef G_OS_UNIX
  pid_t pid;
  gchar buf[16];
  gchar *args[4] = { "gdb", NULL, NULL, NULL };

  if (!prg_name)
    return;

  _g_sprintf (buf, "%u", (guint) getpid ());

  args[1] = (gchar*) prg_name;
  args[2] = buf;

  pid = fork ();
  if (pid == 0)
    {
      stack_trace (args);
      _exit (0);
    }
  else if (pid == (pid_t) -1)
    {
      perror ("unable to fork gdb");
      return;
    }
  
  while (glib_on_error_halt)
    ;
  glib_on_error_halt = TRUE;
#else
  abort ();
#endif
}
예제 #2
0
EXPORT_C void
g_on_error_stack_trace (const gchar *prg_name)
{
#if defined(G_OS_UNIX) || defined(G_OS_BEOS)
  pid_t pid;
  gchar buf[16];
  gchar *args[4] = { "gdb", NULL, NULL, NULL };
  int status;

  if (!prg_name)
    return;

  _g_sprintf (buf, "%u", (guint) getpid ());

  args[1] = (gchar*) prg_name;
  args[2] = buf;

  pid = fork ();
  if (pid == 0)
    {
      stack_trace (args);
      _exit (0);
    }
  else if (pid == (pid_t) -1)
    {
      perror ("unable to fork gdb");
      return;
    }

  waitpid (pid, &status, 0);
#elif defined(__SYMBIAN32__)
	abort();
#else
  if (IsDebuggerPresent ())
    G_BREAKPOINT ();
  else
    abort ();
#endif
}