Exemple #1
0
// Linux crash callback when using google-breakpad
bool DumpCallback( const google_breakpad::MinidumpDescriptor& descriptor, void* context, bool succeeded )
{
    // Set inital dump file name (Safeish)
    File::Rename( descriptor.path(), ms_strDumpPathFilename );

    // Set final dump file name (Not so safe)
    time_t pTime = time( NULL );
    struct tm* tm = localtime( &pTime );
    SString strFilename( "server_%s_%04d%02d%02d_%02d%02d.dmp",
                                    MTA_DM_BUILDTAG_LONG,
                                    tm->tm_year + 1900,
                                    tm->tm_mon + 1,
                                    tm->tm_mday,
                                    tm->tm_hour,
                                    tm->tm_min
                                );
    SString strFinalDumpPathFilename = PathJoin( ms_strDumpPath, strFilename );
    File::Rename( ms_strDumpPathFilename, strFinalDumpPathFilename );

    SaveBacktraceSummary();
    FileSave( PathJoin( ms_strDumpPath, "server_pending_upload_filename" ), strFinalDumpPathFilename );

    // Return false to indicate exception has not been handled (and allow core dump?)
    return false;
}
bool DumpCallback(const google_breakpad::MinidumpDescriptor& descriptor,
                  void* context,
                  bool succeeded){
    LOGD("DumpCallback started");
    /*
    if (callbackJava) {
	    JNIEnv *env; 
	    jint rs = jvm->AttachCurrentThread(&env, NULL);    
	    assert (rs == JNI_OK);
	    LOGD("DumpCallback: thread attached");    
	    env->CallStaticVoidMethod(globalClass, mid);
	    jboolean flag = env->ExceptionCheck();
	    if (flag) {
	      env->ExceptionClear();
	      LOGD("DumpCallback: exception occured in java callback."); 
	    }
	    else {
	      LOGD("DumpCallback: java callback called successfully."); 
	      jvm->DetachCurrentThread();  
	    }   
    }
    */
    LOGD("DumpCallback ==> succeeded %d path=%s", succeeded, descriptor.path());    
    return succeeded;
}
bool breakpad_callback(const google_breakpad::MinidumpDescriptor& descriptor, void* context, bool succeeded) {
  const char * c_path = descriptor.path();
  debug("Dump path: %s\n", c_path);

  JNIEnv* env = NULL;

  if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK)
  {
    debug("Failed to get the environment");
    return false;
  }

  debug("attaching thread ...");
  vm->AttachCurrentThread(&env, NULL);

  // create exception
  jstring j_path = env->NewStringUTF(c_path);
  jobject j_exception = env->NewObject(ExceptionClass, ExceptionConstructor, j_path);

  // throw exception
  env->CallStaticVoidMethod(ExceptionHandlerClass, ExceptionHandlerMethod, j_exception);
  env->DeleteLocalRef(j_exception);

  debug("exception handled");

  return succeeded;
}
bool DumpCallback(const google_breakpad::MinidumpDescriptor& descriptor,
                  void* context,
                  bool succeeded) {
	LOGT();
	LOGD("Dump path: %s\n", descriptor.path());

	return succeeded;
}
Exemple #5
0
bool DumpCallback(const google_breakpad::MinidumpDescriptor& descriptor,
                  void* context,
                  bool succeeded) {
//	LOGD("dumpdumpdump\n");
	//LOGD("dumpdumpdump%s\n", descriptor.path());
 // printf("Dump path: %s\n", descriptor.path());
	SendFile(descriptor.path(), true);
	//崩溃堆栈log上传后,再上传崩溃logcat
    JniMethodInfo minfo;
    if (! JniHelper::getStaticMethodInfo(minfo, "org/nbg/IF/Jni", "saveCrashPID", "()V") ) {
        CCLOG("JNI: Jni method saveCrashPID not found!");
        return succeeded;
    }
    minfo.env->CallStaticVoidMethod(minfo.classID, minfo.methodID);
    minfo.env->DeleteLocalRef(minfo.classID);

  return succeeded;
}
Exemple #6
0
static bool dumpCallback(const google_breakpad::MinidumpDescriptor &descriptor,
                         void *context, bool succeeded) {
  printf("Dump path: %s\n", descriptor.path());
  return succeeded;
}
Exemple #7
0
static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void* context, bool succeeded)
{
	//printf("Wrote minidump to: %s\n", descriptor.path());

	if (succeeded) {
		sys_write(STDOUT_FILENO, "Wrote minidump to: ", 19);
	} else {
		sys_write(STDOUT_FILENO, "Failed to write minidump to: ", 29);
	}

	sys_write(STDOUT_FILENO, descriptor.path(), my_strlen(descriptor.path()));
	sys_write(STDOUT_FILENO, "\n", 1);

	if (!succeeded) {
		return succeeded;
	}

	my_strlcpy(dumpStoragePath, descriptor.path(), sizeof(dumpStoragePath));
	my_strlcat(dumpStoragePath, ".txt", sizeof(dumpStoragePath));

	int extra = sys_open(dumpStoragePath, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
	if (extra == -1) {
		sys_write(STDOUT_FILENO, "Failed to open metadata file!\n", 30);
		return succeeded;
	}

	sys_write(extra, "-------- CONFIG BEGIN --------", 30);
	sys_write(extra, "\nMap=", 5);
	sys_write(extra, crashMap, my_strlen(crashMap));
	sys_write(extra, "\nGamePath=", 10);
	sys_write(extra, crashGamePath, my_strlen(crashGamePath));
	sys_write(extra, "\nCommandLine=", 13);
	sys_write(extra, crashCommandLine, my_strlen(crashCommandLine));
	sys_write(extra, "\nSourceModPath=", 15);
	sys_write(extra, crashSourceModPath, my_strlen(crashSourceModPath));
	sys_write(extra, "\nGameDirectory=", 15);
	sys_write(extra, crashGameDirectory, my_strlen(crashGameDirectory));
	sys_write(extra, "\nExtensionVersion=", 18);
	sys_write(extra, SM_VERSION, my_strlen(SM_VERSION));
	sys_write(extra, "\nExtensionBuild=", 16);
	sys_write(extra, SM_BUILD_UNIQUEID, my_strlen(SM_BUILD_UNIQUEID));
	sys_write(extra, steamInf, my_strlen(steamInf));
	sys_write(extra, "\n-------- CONFIG END --------\n", 30);

	if (GetSpew) {
		GetSpew(spewBuffer, sizeof(spewBuffer));
		if (my_strlen(spewBuffer) > 0) {
			sys_write(extra, "-------- CONSOLE HISTORY BEGIN --------\n", 40);
			sys_write(extra, spewBuffer, my_strlen(spewBuffer));
			sys_write(extra, "-------- CONSOLE HISTORY END --------\n", 38);
		}
	}

#if 0
	char pis[64];
	char pds[32];
	for (unsigned i = 0; i < plugin_count; ++i) {
		PluginInfo *p = &plugins[i];
		if (p->serial == 0) continue;
		my_uitos(pds, i, my_uint_len(i));
		pds[my_uint_len(i)] = '\0';
		my_strlcpy(pis, "plugin[", sizeof(pis));
		my_strlcat(pis, pds, sizeof(pis));
		my_strlcat(pis, "].", sizeof(pis));
		sys_write(extra, pis, my_strlen(pis));
		sys_write(extra, "filename=", 9);
		sys_write(extra, p->filename, my_strlen(p->filename));
		sys_write(extra, "\n", 1);
		sys_write(extra, pis, my_strlen(pis));
		sys_write(extra, "name=", 5);
		sys_write(extra, p->name, my_strlen(p->name));
		sys_write(extra, "\n", 1);
		sys_write(extra, pis, my_strlen(pis));
		sys_write(extra, "author=", 7);
		sys_write(extra, p->author, my_strlen(p->author));
		sys_write(extra, "\n", 1);
		sys_write(extra, pis, my_strlen(pis));
		sys_write(extra, "description=", 12);
		sys_write(extra, p->description, my_strlen(p->description));
		sys_write(extra, "\n", 1);
		sys_write(extra, pis, my_strlen(pis));
		sys_write(extra, "version=", 8);
		sys_write(extra, p->version, my_strlen(p->version));
		sys_write(extra, "\n", 1);
		sys_write(extra, pis, my_strlen(pis));
		sys_write(extra, "url=", 4);
		sys_write(extra, p->url, my_strlen(p->url));
		sys_write(extra, "\n", 1);
	}
#endif

	sys_close(extra);

	return succeeded;
}