示例#1
0
func Start() {
	server_address := goCfgMgr.Get("basic", "Host").(string) + ":" +
		goCfgMgr.Get("basic", "Port").(string)

	ctx := gozd.Context{
		Hash:    "pin_dump_test",
		Logfile: os.TempDir() + "/pin_dump_test.log",
		Directives: map[string]gozd.Server{
			"sock": gozd.Server{
				Network: "unix",
				Address: os.TempDir() + "/pin_dump_test.sock",
			},
			"port1": gozd.Server{
				Network: "tcp",
				Address: server_address,
			},
		},
	}
	dumpProcessChan = make(chan int, 15)
	cl := make(chan net.Listener, 1)
	go handleListners(cl)
	sig, err := gozd.Daemonize(ctx, cl) // returns channel that connects with daemon
	if err != nil {
		log.Println("error: ", err)
		return
	}

	// other initializations or config setting

	for s := range sig {
		switch s {
		case syscall.SIGHUP, syscall.SIGUSR2:
			// do some custom jobs while reload/hotupdate

		case syscall.SIGTERM:
			// do some clean up and exit
			return
		}
	}

	dbinfo.Init()

	go dbinfo.Check_Sql_Connect()
	go debug.CheckMemStats()
}
示例#2
0
func (info *DumpFileInfo) GenDbInfo() {
	context := file.ReadFile("./" + info.project + "/dump/" + info.info_["version"] + "/" + info.file_name_ + ".ndk.info")
	//context := file.ReadFile("./a.txt.info")
	start_pos := 0

	address_info := 3
	info_str := ""
	info_key := ""
	for i := 0; i < len(context); i++ {
		if context[i] == '\n' {
			if i-start_pos > 1 {
				temp_str := string(context[start_pos:i])

				re := regexp.MustCompile("pc\\s{1}[0-9|a-f]{8}")
				matched := re.FindString(temp_str)

				if matched != "" && address_info > 0 {
					libname := goCfgMgr.Get("libname", "inputname").(string)
					prostack_flag, _ := regexp.MatchString(libname, temp_str)
					if prostack_flag {
						re = regexp.MustCompile("[0-9|a-f]{8}")
						key := re.FindString(matched)

						info_key = info_key + "_" + key
						address_info--
					}

				}

				info_str = info_str + temp_str + "<br>"

			}

			start_pos = i + 1

		}
	}
	//db.CreateDB(info.project, info.info_["version"], info_key, info_str, info.info_["UUID"])
	mysql_c, db_err := dbinfo.Init()
	if db_err == nil {
		mysql_c.AddInfo(info.project, info.info_["version"], info_key, info_str, info.info_["UUID"], info.lianyun)
		mysql_c.AddDeviceInfo(info.project, info.info_["version"], info_key, info.info_["device"], info.lianyun, info.info_["UUID"])
	}
}
示例#3
0
func (info *JavaFileInfo) GenJavaDBInfo() {

	s := file.ReadFile("./" + info.project + "/dump/" + info.info_["version"] + "/" + info.file_name_)
	context := string(s)

	start_pos := 0
	info_key := ""
	key_index := 0
	for i := 0; i < len(context); i++ {
		if context[i] == '\n' {
			if i-start_pos > 1 {
				temp_str := string(context[start_pos:i])

				re := regexp.MustCompile("\\([^\\(\\)]*\\.java:[0-9]{0,10}\\)")
				matched := re.FindString(temp_str)
				if matched != "" {
					//fmt.Println("matched : ", matched)
					key_index++
					info_key += matched
					if key_index >= 3 {
						break
					}
				}
			}
			start_pos = i + 1

		}
	}

	h := md5.New()
	h.Write([]byte(info_key))
	result_str := hex.EncodeToString(h.Sum(nil))

	mysql_c, db_err := dbinfo.Init()
	if db_err == nil {
		mysql_c.AddInfo(info.project, info.info_["version"], result_str, context, info.info_["UUID"], info.lianyun)
		mysql_c.AddDeviceInfo(info.project, info.info_["version"], info_key, info.info_["device"], info.lianyun, info.info_["UUID"])
	}
}