Lines Matching refs:ds
119 static Dumpstate& ds = Dumpstate::GetInstance(); variable
123 return ds.RunCommand(title, full_command, options, verbose_duration); in RunCommand()
180 if (ds.IsUserConsentDenied()) { \
284 return ds.RunDumpsys(title, dumpsysArgs, options, dumpsysTimeoutMs); in RunDumpsys()
287 return ds.DumpFile(title, path); in DumpFile()
317 const time_t thirty_minutes_ago = ds.now_ - 60 * 30; in GetDumpFds()
383 if (ds.IsZipping() && add_to_zip) { in AddDumps()
384 if (ds.AddZipEntryFromFd(ZIP_ROOT_DIR + name, fd, /* timeout = */ 0ms) != OK) { in AddDumps()
413 if (ds.AddZipEntry(ZIP_ROOT_DIR + path, path)) { in do_mountinfo()
422 if (!ds.IsZipping()) return; in add_mountinfo()
745 get_mtime(fd, ds.now_)); in AddZipEntryFromFd()
825 return (ds.AddZipEntryFromFd(ZIP_ROOT_DIR + path, fd) == OK) ? 0 : 1; in _add_file_from_fd()
845 … int32_t err = zip_writer_->StartEntryWithTime(entry_name.c_str(), ZipWriter::kCompress, ds.now_); in AddTextZipEntry()
936 if (!ds.IsZipping()) { in DumpIncidentReport()
941 const std::string path = ds.bugreport_internal_dir_ + "/tmp_incident_report"; in DumpIncidentReport()
955 ds.AddZipEntry(kProtoPath + "incident_report" + kProtoExt, path); in DumpIncidentReport()
989 … ds.AddZipEntry(ZIP_ROOT_DIR + anr_traces_dir + "/traces-just-now.txt", dump_traces_path); in AddAnrTraceDir()
993 ds.DumpFile("VM TRACES JUST NOW", dump_traces_path); in AddAnrTraceDir()
1004 if (ds.anr_data_.size() > 0) { in AddAnrTraceDir()
1005 AddDumps(ds.anr_data_.begin(), ds.anr_data_.begin() + 1, in AddAnrTraceDir()
1012 AddDumps(ds.anr_data_.begin() + ((add_to_zip) ? 1 : 0), ds.anr_data_.end(), in AddAnrTraceDir()
1020 const bool add_to_zip = ds.IsZipping() && ds.version_ == VERSION_SPLIT_ANR; in AddAnrTraceFiles()
1038 ds.DumpFile("VM TRACES WHEN SLOW", slow_trace_path.c_str()); in AddAnrTraceFiles()
1150 if (!ds.IsZipping()) { in RunDumpsysProto()
1174 status = ds.AddZipEntryFromFd(path, dumpsys.getDumpFd(), service_timeout); in RunDumpsysProto()
1179 ds.zip_writer_->GetLastEntry(&file_entry); in RunDumpsysProto()
1228 if (!ds.IsZipping()) { in DumpHals()
1255 const std::string path = ds.bugreport_internal_dir_ + "/lshal_debug_" + cleanName; in DumpHals()
1273 ds.AddZipEntry("lshal-debug/" + cleanName + ".txt", path); in DumpHals()
1386 ds.AddDir("/data/misc/bluetooth/logs", true); in dumpstate()
1388 if (ds.options_->do_fb && !ds.do_early_screenshot_) { in dumpstate()
1390 ds.TakeScreenshot(); in dumpstate()
1397 const bool tombstones_dumped = AddDumps(ds.tombstone_data_.begin(), ds.tombstone_data_.end(), in dumpstate()
1437 ds.AddDir(WMTRACE_DATA_DIR, false); in dumpstate()
1440 ds.AddDir(SNAPSHOTCTL_LOG_DIR, false); in dumpstate()
1442 RUN_SLOW_FUNCTION_WITH_CONSENT_CHECK(ds.DumpstateBoard); in dumpstate()
1524 printf("== Final progress (pid %d): %d/%d (estimated %d)\n", ds.pid_, ds.progress_->Get(), in dumpstate()
1525 ds.progress_->GetMax(), ds.progress_->GetInitialMax()); in dumpstate()
1527 printf("== dumpstate: done (id %d)\n", ds.id_); in dumpstate()
1537 ds.AddDir(LINKERCONFIG_DIR, true); in dumpstate()
1564 RUN_SLOW_FUNCTION_WITH_CONSENT_CHECK(ds.DumpTraces, &dump_traces_path); in DumpstateDefault()
1567 ds.tombstone_data_ = GetDumpFds(TOMBSTONE_DIR, TOMBSTONE_FILE_PREFIX, !ds.IsZipping()); in DumpstateDefault()
1568 ds.anr_data_ = GetDumpFds(ANR_DIR, ANR_FILE_PREFIX, !ds.IsZipping()); in DumpstateDefault()
1570 ds.AddDir(RECOVERY_DIR, true); in DumpstateDefault()
1571 ds.AddDir(RECOVERY_DATA_DIR, true); in DumpstateDefault()
1572 ds.AddDir(UPDATE_ENGINE_LOG_DIR, true); in DumpstateDefault()
1573 ds.AddDir(LOGPERSIST_DATA_DIR, false); in DumpstateDefault()
1575 ds.AddDir(PROFILE_DATA_DIR_CUR, true); in DumpstateDefault()
1576 ds.AddDir(PROFILE_DATA_DIR_REF, true); in DumpstateDefault()
1577 ds.AddZipEntry(ZIP_ROOT_DIR + PACKAGE_DEX_USE_LIST, PACKAGE_DEX_USE_LIST); in DumpstateDefault()
1579 ds.AddDir(PREREBOOT_DATA_DIR, false); in DumpstateDefault()
1583 ds.AddDir(OTA_METADATA_DIR, true); in DumpstateDefault()
1624 ds.AddDir(LOGPERSIST_DATA_DIR, false); in DumpstateRadioCommon()
1731 printf("== dumpstate: done (id %d)\n", ds.id_); in DumpstateTelephonyOnly()
1751 printf("== dumpstate: done (id %d)\n", ds.id_); in DumpstateWifiOnly()
1879 paths.emplace_back(StringPrintf("%s/%s", ds.bugreport_internal_dir_.c_str(), in DumpstateBoard()
2010 MYLOGD("dumpstate id %d finished around %s (%ld s)\n", ds.id_, date, in FinishZipFile()
2011 the_real_now_please_stand_up - ds.now_); in FinishZipFile()
2013 if (!ds.AddZipEntry(entry_name, tmp_path_)) { in FinishZipFile()
2024 if (!ds.AddZipEntry("dumpstate_log.txt", ds.log_path_.c_str())) { in FinishZipFile()
2030 if (!redirect_to_existing_file(stderr, const_cast<char*>(ds.log_path_.c_str()))) { in FinishZipFile()
2042 ds.zip_file.reset(nullptr); in FinishZipFile()
2124 MaybeResolveSymlink(&ds.bugreport_internal_dir_); in PrepareToWriteToFile()
2128 ds.base_name_ = StringPrintf("bugreport-%s-%s", device_name.c_str(), build_id.c_str()); in PrepareToWriteToFile()
2129 if (ds.options_->do_add_date) { in PrepareToWriteToFile()
2131 strftime(date, sizeof(date), "%Y-%m-%d-%H-%M-%S", localtime(&ds.now_)); in PrepareToWriteToFile()
2132 ds.name_ = date; in PrepareToWriteToFile()
2134 ds.name_ = "undated"; in PrepareToWriteToFile()
2137 if (ds.options_->telephony_only) { in PrepareToWriteToFile()
2138 ds.base_name_ += "-telephony"; in PrepareToWriteToFile()
2139 } else if (ds.options_->wifi_only) { in PrepareToWriteToFile()
2140 ds.base_name_ += "-wifi"; in PrepareToWriteToFile()
2143 if (ds.options_->do_fb) { in PrepareToWriteToFile()
2144 ds.screenshot_path_ = ds.GetPath(".png"); in PrepareToWriteToFile()
2146 ds.tmp_path_ = ds.GetPath(".tmp"); in PrepareToWriteToFile()
2147 ds.log_path_ = ds.GetPath("-dumpstate_log-" + std::to_string(ds.pid_) + ".txt"); in PrepareToWriteToFile()
2149 std::string destination = ds.options_->bugreport_fd.get() != -1 in PrepareToWriteToFile()
2150 ? StringPrintf("[fd:%d]", ds.options_->bugreport_fd.get()) in PrepareToWriteToFile()
2151 : ds.bugreport_internal_dir_.c_str(); in PrepareToWriteToFile()
2159 destination.c_str(), ds.base_name_.c_str(), ds.name_.c_str(), ds.log_path_.c_str(), in PrepareToWriteToFile()
2160 ds.tmp_path_.c_str(), ds.screenshot_path_.c_str()); in PrepareToWriteToFile()
2162 if (ds.options_->do_zip_file) { in PrepareToWriteToFile()
2163 ds.path_ = ds.GetPath(".zip"); in PrepareToWriteToFile()
2164 MYLOGD("Creating initial .zip file (%s)\n", ds.path_.c_str()); in PrepareToWriteToFile()
2165 create_parent_dirs(ds.path_.c_str()); in PrepareToWriteToFile()
2166 ds.zip_file.reset(fopen(ds.path_.c_str(), "wb")); in PrepareToWriteToFile()
2167 if (ds.zip_file == nullptr) { in PrepareToWriteToFile()
2168 MYLOGE("fopen(%s, 'wb'): %s\n", ds.path_.c_str(), strerror(errno)); in PrepareToWriteToFile()
2170 ds.zip_writer_.reset(new ZipWriter(ds.zip_file.get())); in PrepareToWriteToFile()
2172 ds.AddTextZipEntry("version.txt", ds.version_); in PrepareToWriteToFile()
2183 android::base::GetProperty(android::base::StringPrintf("dumpstate.%d.name", ds.pid_), ""); in FinalizeFile()
2195 MYLOGI("changing suffix from %s to %s\n", ds.name_.c_str(), name.c_str()); in FinalizeFile()
2196 ds.name_ = name; in FinalizeFile()
2197 if (!ds.screenshot_path_.empty()) { in FinalizeFile()
2198 std::string new_screenshot_path = ds.GetPath(".png"); in FinalizeFile()
2199 if (rename(ds.screenshot_path_.c_str(), new_screenshot_path.c_str())) { in FinalizeFile()
2200 MYLOGE("rename(%s, %s): %s\n", ds.screenshot_path_.c_str(), in FinalizeFile()
2203 ds.screenshot_path_ = new_screenshot_path; in FinalizeFile()
2209 if (ds.options_->do_zip_file) { in FinalizeFile()
2210 if (!ds.FinishZipFile()) { in FinalizeFile()
2216 std::string new_path = ds.GetPath(".zip"); in FinalizeFile()
2217 if (ds.path_ != new_path) { in FinalizeFile()
2218 MYLOGD("Renaming zip file from %s to %s\n", ds.path_.c_str(), new_path.c_str()); in FinalizeFile()
2219 if (rename(ds.path_.c_str(), new_path.c_str())) { in FinalizeFile()
2220 MYLOGE("rename(%s, %s): %s\n", ds.path_.c_str(), new_path.c_str(), in FinalizeFile()
2223 ds.path_ = new_path; in FinalizeFile()
2229 ds.path_ = ds.GetPath(".txt"); in FinalizeFile()
2230 MYLOGD("Generating .txt bugreport at %s from %s\n", ds.path_.c_str(), ds.tmp_path_.c_str()); in FinalizeFile()
2231 if (rename(ds.tmp_path_.c_str(), ds.path_.c_str())) { in FinalizeFile()
2232 MYLOGE("rename(%s, %s): %s\n", ds.tmp_path_.c_str(), ds.path_.c_str(), strerror(errno)); in FinalizeFile()
2233 ds.path_.clear(); in FinalizeFile()
2236 if (ds.options_->use_control_socket) { in FinalizeFile()
2238 dprintf(ds.control_socket_fd_, in FinalizeFile()
2241 ds.log_path_.c_str()); in FinalizeFile()
2243 dprintf(ds.control_socket_fd_, "OK:%s\n", ds.path_.c_str()); in FinalizeFile()
2251 if (!ds.path_.empty()) { in SendBugreportFinishedBroadcast()
2252 MYLOGI("Final bugreport path: %s\n", ds.path_.c_str()); in SendBugreportFinishedBroadcast()
2257 "--ei", "android.intent.extra.ID", std::to_string(ds.id_), in SendBugreportFinishedBroadcast()
2258 "--ei", "android.intent.extra.PID", std::to_string(ds.pid_), in SendBugreportFinishedBroadcast()
2259 "--ei", "android.intent.extra.MAX", std::to_string(ds.progress_->GetMax()), in SendBugreportFinishedBroadcast()
2260 "--es", "android.intent.extra.BUGREPORT", ds.path_, in SendBugreportFinishedBroadcast()
2261 "--es", "android.intent.extra.DUMPSTATE_LOG", ds.log_path_ in SendBugreportFinishedBroadcast()
2264 if (ds.options_->do_fb && !android::os::IsFileEmpty(ds.screenshot_path_)) { in SendBugreportFinishedBroadcast()
2267 am_args.push_back(ds.screenshot_path_); in SendBugreportFinishedBroadcast()
2269 if (!ds.options_->notification_title.empty()) { in SendBugreportFinishedBroadcast()
2272 am_args.push_back(ds.options_->notification_title); in SendBugreportFinishedBroadcast()
2273 if (!ds.options_->notification_description.empty()) { in SendBugreportFinishedBroadcast()
2276 am_args.push_back(ds.options_->notification_description); in SendBugreportFinishedBroadcast()
2279 if (ds.options_->is_remote_mode) { in SendBugreportFinishedBroadcast()
2282 am_args.push_back(SHA256_file_hash(ds.path_)); in SendBugreportFinishedBroadcast()
2868 return ds.consent_callback_ != nullptr && in IsUserConsentDenied()
2869 ds.consent_callback_->getResult() == UserConsentResult::DENIED; in IsUserConsentDenied()
2945 Dumpstate::RunStatus status = ds.ParseCommandlineAndRun(argc, argv); in run_main()
3165 if (ds.IsUserConsentDenied()) { in __for_each_pid()
3243 if (ds.IsUserConsentDenied()) { in for_each_tid_helper()
3706 ds.DumpFile("RT_TABLES", RT_TABLES_PATH); in dump_route_tables()