Example #1
0
void CRASHREPORTER_send_message_with_backtrace(const char *additional_information, enum Crash_Type crash_type, double time){
#define NUM_LINES 100

  char **strings;

#if 1 //defined(FOR_LINUX)
  void *buffer[NUM_LINES];
  int nptrs = backtrace(buffer, NUM_LINES);
  
  strings = backtrace_symbols(buffer, nptrs);
  
#elif 0 //defined(FOR_MACOSX)
  int nptrs = 1;
  strings = calloc(2,sizeof(char*));
  strings[0]=(char*)JUCE_get_backtrace(); // No point. Same as calling backtrace_symbols. I had hoped that it contained line numbers. Can not get the 'atos' program to work either.
  strings[1]=NULL;
#endif

  
  
  if (strings != NULL) {
    CRASHREPORTER_send_message(additional_information, (const char**)strings,nptrs,crash_type,time);
  } else {
    const char *message="no backtrace availabe\n";
    CRASHREPORTER_send_message(additional_information, &message,1,crash_type,time);
  }
}
Example #2
0
void CRASHREPORTER_send_assert_message(Crash_Type crash_type, const char *fmt,...){
  static bool is_currently_sending = false;
  
#if 0
  static int last_time = -10000;
  
  if ( last_time < (running_time.elapsed()-(30*1000)))
    return;

  last_time = running_time.elapsed();
#endif

  if (is_currently_sending)
    return;

  char message[1000];
  va_list argp;
  
  va_start(argp,fmt);
  /*	vfprintf(stderr,fmt,argp); */
  vsprintf(message,fmt,argp);
  va_end(argp);
  
  if (g_crashreporter_file!=NULL) {

    if (!g_crashreporter_file->open()){
      SYSTEM_show_message("Unable to create temprary file. Disk may be full");
      send_crash_message_to_server(message, get_plugin_names(), NOEMERGENCYSAVE, crash_type);
      goto exit;
    }

    if (false==file_is_empty(g_crashreporter_file)) {
      g_crashreporter_file->close();
      goto exit;
    }

    g_crashreporter_file->close();
  }

  is_currently_sending = true;
  RT_request_to_stop_playing();
  RT_pause_plugins();


  CRASHREPORTER_send_message_with_backtrace(message, crash_type);

#if 0
  if (may_do_blocking && THREADING_is_main_thread())
    send_crash_message_to_server(message, g_plugin_name, false);
  else{
    const char *messages[1] = {message};
    CRASHREPORTER_send_message(messages, 1, false);
  }
#endif
  
 exit:
  is_currently_sending = false;
}