Ejemplo n.º 1
0
func (info *JavaFileInfo) GenJavaInfo(s string) {
	info.info_ = make(map[string]string)
	line_num := 0
	start_index := 0
	context_start_index := 0
	for i := 0; i < len(s); i++ {
		if s[i] == '\n' {
			if start_index > 0 {
				start_index++
			}
			context_start_index = start_index + len(key_arr_java[line_num]) + 1

			if line_num == 5 {
				info.info_[key_arr_java[line_num]] = s[start_index:]
			} else {
				info.info_[key_arr_java[line_num]] = s[context_start_index:i]
			}

			start_index = i
			line_num++
			if line_num >= len(key_arr_java) {
				break
			}
		}
	}

	if info.info_["file"] == "" {
		info.info_["file"] = s[start_index+len(key_arr_java[5])+2:]
	}

	path := "./" + info.project + "/dump/" + info.info_["version"]
	file.CreateDir(path)
	info.file_name_ = info.info_["UUID"] + ".txt"
	file.WriteFile(path+"/"+info.file_name_, []byte(info.info_["file"]), os.O_TRUNC)
}
Ejemplo n.º 2
0
func (info *DumpFileInfo) GenTencentDumpInfo() {
	path := "./" + info.project + "/dump/" + info.info_["version"] + "/" + info.file_name_

	version := info.info_["version"]

	count := strings.Count(version, "_")
	if count > 1 {
		index := strings.Index(version, "_")
		version = version[:index]
	}

	context := file.ReadFile(path)
	intputlibname := goCfgMgr.Get("libname", "inputname").(string)
	outputlibname := goCfgMgr.Get("libname", "outputname").(string)

	ref_str := strings.Replace(outputlibname, ".", "\\.", 1)
	re := regexp.MustCompile(ref_str)
	finale_context := string(context)
	re.ReplaceAllLiteralString(finale_context, version+"_"+intputlibname)

	file.WriteFile(path, []byte(finale_context), os.O_TRUNC)

	cmd := exec.Command("/bin/sh", "./gen_ndk_info.sh", info.info_["version"], info.file_name_, info.project)
	_, err := cmd.Output()
	if err != nil {
		log.Println("GenNdkfile err:" + err.Error())
	}

}
Ejemplo n.º 3
0
func (info *DumpFileInfo) GenLogInfo(s string) {

	info.info_ = make(map[string]string)
	line_num := 0
	start_index := 0
	context_start_index := 0
	for i := 0; i < len(s); i++ {
		if s[i] == '\n' {
			if start_index > 0 {
				start_index++
			}
			context_start_index = start_index + len(key_arr_log[line_num]) + 1

			if line_num == 5 {
				info.info_[key_arr_log[line_num]] = s[start_index:]
			} else {
				info.info_[key_arr_log[line_num]] = s[context_start_index:i]
			}

			start_index = i
			line_num++
			if line_num >= len(key_arr_log) {
				break
			}
		}
	}

	path := "./" + info.project + "/dump/" + info.info_["version"]
	file.CreateDir(path)
	//info.file_name_ = "crash_" + info.info_["UUID"] + "_" + time.Now().Format(time.RFC3339) + ".txt"
	info.file_name_ = info.info_["UUID"] + ".log"
	file.WriteFile(path+"/"+info.file_name_, []byte(info.info_["file"]), os.O_TRUNC)

}
Ejemplo n.º 4
0
func (info *DumpFileInfo) GenNdkfile() {
	/* eg.
	03-24 15:34:32.361: I/DEBUG(130): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
	03-24 15:34:32.361: I/DEBUG(130): Build fingerprint: '111'
	03-24 15:34:32.361: I/DEBUG(130): pid: 11142, tid: 11365, name: dfdsf  >>> sfsaf <<<
	03-24 15:34:32.794: I/DEBUG(130): backtrace:
	03-24 15:34:32.794: I/DEBUG(130):     #00  pc 0069D08F  libpishell.so ()
	03-24 15:34:32.794: I/DEBUG(130):     #01  pc 5e4ade49  libpishell.so ()
	*/
	max_info_count := 3
	info_key := ""

	file_context := "03-24 15:34:32.361: I/DEBUG(130): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***\n"
	file_context += "03-24 15:34:32.361: I/DEBUG(130): Build fingerprint: '111'\n"
	file_context += "03-24 15:34:32.361: I/DEBUG(130): pid: 11142, tid: 11365, name: dfdsf  >>> sfsaf <<<\n"
	file_context += "03-24 15:34:32.794: I/DEBUG(130): backtrace:\n"
	stack_head := "03-24 15:34:32.794: I/DEBUG(130):     #"
	for i := 0; i < len(info.stack_lib_name); i++ {
		result_str := ""
		address := info.stack_address[i] - info.so_address

		var buf = make([]byte, 4)
		binary.BigEndian.PutUint32(buf, uint32(address))

		libname := info.stack_lib_name[i]
		if libname == goCfgMgr.Get("libname", "outputname").(string) {
			libname = goCfgMgr.Get("libname", "inputname").(string)
		}

		version := info.info_["version"]

		count := strings.Count(version, "_")
		if count > 1 {
			index := strings.Index(version, "_")
			version = version[:index]
		}

		if i < 10 {
			result_str = "0" + strconv.Itoa(i) + "  pc " + hex.EncodeToString(buf) + "  " + version + "_" + libname + " ()\n"
			file_context += (stack_head + result_str)
		}

		if max_info_count > 0 {
			info_key = info_key + hex.EncodeToString(buf) + "_"
			max_info_count--
		}

	}
	file_context += "\n"

	path := "./" + info.project + "/dump/" + info.info_["version"]
	file.WriteFile(path+"/"+info.file_name_+".ndk", []byte(file_context), os.O_TRUNC)

	cmd := exec.Command("/bin/sh", "./gen_ndk_info.sh", info.info_["version"], info.file_name_+".ndk", info.project)
	_, err := cmd.Output()
	if err != nil {
		log.Println("GenNdkfile err:" + err.Error())
	}
}