Lines Matching defs:info

95 constexpr const char STACK_ERROR_MESSAGE[] = "Cannot get SourceMap info, dump raw stack:";
252 void Faultlogger::AddPublicInfo(FaultLogInfo &info)
254 info.sectionMap["DEVICE_INFO"] = Parameter::GetString("const.product.name", "Unknown");
255 if (info.sectionMap.find("BUILD_INFO") == info.sectionMap.end()) {
256 info.sectionMap["BUILD_INFO"] = Parameter::GetString("const.product.software.version", "Unknown");
258 info.sectionMap["UID"] = std::to_string(info.id);
259 info.sectionMap["PID"] = std::to_string(info.pid);
260 info.module = RegulateModuleNameIfNeed(info.module);
261 info.sectionMap["MODULE"] = info.module;
263 if (info.id >= MIN_APP_USERID && GetDfxBundleInfo(info.module, bundleInfo)) {
265 info.sectionMap["VERSION"] = bundleInfo.versionName;
266 info.sectionMap["VERSION_CODE"] = std::to_string(bundleInfo.versionCode);
270 info.sectionMap["PRE_INSTALL"] = "Yes";
272 info.sectionMap["PRE_INSTALL"] = "No";
276 if (info.sectionMap["FOREGROUND"].empty() && info.id >= MIN_APP_USERID) {
277 if (UCollectUtil::ProcessStatus::GetInstance().GetProcessState(info.pid) ==
279 info.sectionMap["FOREGROUND"] = "Yes";
280 } else if (UCollectUtil::ProcessStatus::GetInstance().GetProcessState(info.pid) ==
283 .GetProcessLastForegroundTime(info.pid));
284 if (lastFgTime > info.time) {
285 info.sectionMap["FOREGROUND"] = "Yes";
287 info.sectionMap["FOREGROUND"] = "No";
292 if (info.reason.empty()) {
293 info.reason = info.sectionMap["REASON"];
295 info.sectionMap["REASON"] = info.reason;
298 if (info.summary.empty()) {
299 info.summary = GetSummaryFromSectionMap(info.faultLogType, info.sectionMap);
301 info.sectionMap["SUMMARY"] = info.summary;
305 AnalysisFaultlog(info, info.parsedLogInfo);
306 info.sectionMap.insert(info.parsedLogInfo.begin(), info.parsedLogInfo.end());
307 info.parsedLogInfo.clear();
310 void Faultlogger::AddCppCrashInfo(FaultLogInfo& info)
312 if (!info.registers.empty()) {
313 info.sectionMap["KEY_THREAD_REGISTERS"] = info.registers;
316 info.sectionMap["APPEND_ORIGIN_LOG"] = GetCppCrashTempLogName(info);
319 GetHilog(info.pid, log);
320 info.sectionMap["HILOG"] = log;
469 FaultLogInfo info;
470 info.time = sysEvent.happenTime_;
471 info.id = sysEvent.GetUid();
472 info.pid = sysEvent.GetPid();
474 info.faultLogType = FaultLogType::JS_CRASH;
476 info.faultLogType = FaultLogType::RUST_PANIC;
478 info.faultLogType = FaultLogType::ADDR_SANITIZER;
480 info.module = info.faultLogType == FaultLogType::JS_CRASH ?
482 info.reason = sysEvent.GetEventValue("REASON");
484 info.summary = StringUtil::UnescapeJsonStringValue(summary);
485 info.sectionMap = sysEvent.GetKeyValuePairs();
487 return info;
490 static void UpdateSysEvent(SysEvent &sysEvent, FaultLogInfo &info)
492 sysEvent.SetEventValue("FAULT_TYPE", std::to_string(info.faultLogType));
493 sysEvent.SetEventValue("MODULE", info.module);
494 sysEvent.SetEventValue("LOG_PATH", info.logPath);
497 sysEvent.SetEventValue("VERSION", info.sectionMap["VERSION"]);
498 sysEvent.SetEventValue("PRE_INSTALL", info.sectionMap["PRE_INSTALL"]);
499 sysEvent.SetEventValue("FOREGROUND", info.sectionMap["FOREGROUND"]);
501 if (AnalysisFaultlog(info, eventInfos)) {
513 if (info.faultLogType != FaultLogType::ADDR_SANITIZER) {
532 FaultLogInfo info = FillFaultLogInfo(*sysEvent);
533 if (info.faultLogType == FaultLogType::ADDR_SANITIZER && info.summary.empty()) {
537 AddFaultLog(info);
538 UpdateSysEvent(*sysEvent, info);
539 if (info.faultLogType == FaultLogType::JS_CRASH) {
542 if (info.faultLogType == FaultLogType::ADDR_SANITIZER) {
665 void Faultlogger::AddFaultLog(FaultLogInfo& info)
671 AddFaultLogIfNeed(info, nullptr);
680 auto info = std::make_unique<FaultLogInfo>(FaultLogger::ParseFaultLogInfoFromFile(logPath));
681 info->logPath = logPath;
682 return info;
737 void Faultlogger::AddFaultLogIfNeed(FaultLogInfo& info, std::shared_ptr<Event> event)
739 if ((info.faultLogType <= FaultLogType::ALL) || (info.faultLogType > FaultLogType::ADDR_SANITIZER)) {
744 info.pid, info.module.c_str(), info.reason.c_str());
745 info.sectionMap["PROCESS_NAME"] = info.module; // save process name
747 bool isSystemProcess = IsSystemProcess(info.module, info.id);
749 std::string appName = GetApplicationNameById(info.id);
751 info.module = appName; // if bundle name is not empty, replace module name by it.
755 HIVIEW_LOGD("nameProc %{public}s", info.module.c_str());
756 if ((info.module.empty()) || (!IsModuleNameValid(info.module))) {
757 HIVIEW_LOGW("Invalid module name %{public}s", info.module.c_str());
760 AddPublicInfo(info);
762 info.sectionMap.erase("APPEND_ORIGIN_LOG");
763 if (info.faultLogType == FaultLogType::CPP_CRASH) {
764 AddCppCrashInfo(info);
765 } else if (info.faultLogType == FaultLogType::APP_FREEZE) {
766 info.sectionMap["STACK"] = GetThreadStack(info.logPath, info.pid);
769 mgr_->SaveFaultLogToFile(info);
770 if (info.faultLogType != FaultLogType::JS_CRASH && info.faultLogType != FaultLogType::RUST_PANIC
771 && info.faultLogType != FaultLogType::ADDR_SANITIZER) {
772 mgr_->SaveFaultInfoToRawDb(info);
778 info.pid,
779 info.module.c_str(),
780 info.reason.c_str(),
781 info.summary.c_str());
783 if (!isSystemProcess && info.faultLogType == FaultLogType::CPP_CRASH) {
784 CheckFaultLogAsync(info);
785 ReportCppCrashToAppEvent(info);
786 } else if (!isSystemProcess && info.faultLogType == FaultLogType::APP_FREEZE) {
787 ReportAppFreezeToAppEvent(info);
791 RemoveHilogFromFaultlog(info.logPath, info.faultLogType);
820 auto info = ParseFaultLogInfoFromFile(file, true);
821 if (info.summary.find("#00") == std::string::npos) {
824 "PID", info.pid,
825 "UID", info.id,
826 "PROCESS_NAME", info.module,
827 "HAPPEN_TIME", std::to_string(info.time)
834 if (mgr_->IsProcessedFault(info.pid, info.id, info.faultLogType)) {
835 HIVIEW_LOGI("Skip processed fault.(%{public}d:%{public}d) ", info.pid, info.id);
838 AddFaultLogIfNeed(info, nullptr);
842 void Faultlogger::ReportCppCrashToAppEvent(const FaultLogInfo& info) const
845 GetStackInfo(info, stackInfo);
850 HIVIEW_LOGI("report cppcrash to appevent, pid:%{public}d len:%{public}zu", info.pid, stackInfo.length());
852 std::string outputFilePath = "/data/test_cppcrash_info_" + std::to_string(info.pid);
857 EventPublish::GetInstance().PushEvent(info.id, APP_CRASH_TYPE, HiSysEvent::EventType::FAULT, stackInfo);
860 void Faultlogger::GetStackInfo(const FaultLogInfo& info, std::string& stackInfo) const
862 if (info.pipeFd == nullptr || *(info.pipeFd) == -1) {
868 nread = TEMP_FAILURE_RETRY(read(*info.pipeFd, buffer, MAX_PIPE_SIZE));
882 stackInfoObj["bundle_name"] = info.module;
884 externalLog.append(info.logPath);
886 if (info.sectionMap.count("VERSION") == 1) {
887 stackInfoObj["bundle_version"] = info.sectionMap.at("VERSION");
889 if (info.sectionMap.count("FOREGROUND") == 1) {
890 stackInfoObj["foreground"] = (info.sectionMap.at("FOREGROUND") == "Yes") ? true : false;
892 if (info.sectionMap.count("FINGERPRINT") == 1) {
893 stackInfoObj["uuid"] = info.sectionMap.at("FINGERPRINT");
895 if (info.sectionMap.count("HILOG") == 1) {
897 auto hilogStr = info.sectionMap.at("HILOG");
1036 FreezeJsonUtil::FreezeJsonCollector Faultlogger::GetFreezeJsonCollector(const FaultLogInfo& info) const
1039 std::string jsonFilePath = FreezeJsonUtil::GetFilePath(info.pid, info.id, info.time);
1071 if (info.sectionMap.count("FOREGROUND") == 1) {
1072 std::string foreground = info.sectionMap.at("FOREGROUND");
1076 if (info.sectionMap.count("VERSION") == 1) {
1077 collector.version = info.sectionMap.at("VERSION");
1080 if (info.sectionMap.count("FINGERPRINT") == 1) {
1081 collector.uuid = info.sectionMap.at("FINGERPRINT");
1087 void Faultlogger::ReportAppFreezeToAppEvent(const FaultLogInfo& info) const
1091 FreezeJsonUtil::FreezeJsonCollector collector = GetFreezeJsonCollector(info);
1093 externalLogList.push_back(info.logPath);
1117 EventPublish::GetInstance().PushEvent(info.id, APP_FREEZE_TYPE,
1125 bool Faultlogger::CheckFaultLog(FaultLogInfo info)
1128 if (!CheckFaultSummaryValid(info.summary)) {
1131 ReportCrashException(info.module, info.pid, info.id, err);
1136 void Faultlogger::CheckFaultLogAsync(const FaultLogInfo& info)
1139 auto task = [this, info] {
1140 CheckFaultLog(info);