Lines Matching refs:ds

124 static Dumpstate& ds = Dumpstate::GetInstance();
127 return ds.RunCommand(title, fullCommand, options);
132 return ds.RunDumpsys(title, dumpsysArgs, options, dumpsysTimeoutMs);
135 return ds.DumpFile(title, path);
169 const time_t thirty_minutes_ago = ds.now_ - 60 * 30;
244 if (ds.IsZipping() && add_to_zip) {
245 if (ds.AddZipEntryFromFd(ZIP_ROOT_DIR + name, fd, /* timeout = */ 0ms) != OK) {
274 if (ds.AddZipEntry(ZIP_ROOT_DIR + path, path)) {
283 if (!ds.IsZipping()) return;
330 if (!ds.IsZipping()) {
402 if (!ds.AddZipEntry("anrd_trace.txt", path)) {
418 if (!ds.IsZipping()) {
422 std::string systrace_path = ds.GetPath("-systrace.txt");
449 if (!ds.AddZipEntry("systrace.txt", systrace_path)) {
463 std::string raft_path = ds.GetPath("-raft_log.txt");
476 if (!ds.IsZipping()) {
483 if (!ds.AddZipEntry("raft_log.txt", raft_path)) {
755 get_mtime(fd, ds.now_));
823 return (ds.AddZipEntryFromFd(ZIP_ROOT_DIR + path, fd) == OK) ? 0 : 1;
843 int32_t err = zip_writer_->StartEntryWithTime(entry_name.c_str(), ZipWriter::kCompress, ds.now_);
937 ds.AddDir(dump_traces_dir, true);
941 ds.DumpFile("VM TRACES JUST NOW", dump_traces_path);
966 ds.AddDir(anr_traces_dir, true);
985 ds.AddZipEntry(ZIP_ROOT_DIR + anr_traces_dir + "/traces-just-now.txt", dump_traces_path);
989 ds.DumpFile("VM TRACES JUST NOW", dump_traces_path);
1000 if (ds.anr_data_.size() > 0) {
1001 AddDumps(ds.anr_data_.begin(), ds.anr_data_.begin() + 1,
1008 AddDumps(ds.anr_data_.begin() + ((add_to_zip) ? 1 : 0), ds.anr_data_.end(),
1016 const bool add_to_zip = ds.IsZipping() && ds.version_ == VERSION_SPLIT_ANR;
1059 ds.DumpFile("VM TRACES WHEN SLOW", slow_trace_path.c_str());
1120 DumpstateSectionReporter section_reporter(path, ds.listener_, ds.report_section_);
1170 if (!ds.IsZipping()) {
1191 DumpstateSectionReporter section_reporter(path, ds.listener_, ds.report_section_);
1194 status = ds.AddZipEntryFromFd(path, dumpsys.getDumpFd(), service_timeout);
1199 ds.zip_writer_->GetLastEntry(&file_entry);
1276 ds.AddZipEntry("lshal-debug/" + cleanName + ".txt", path);
1316 if (ds.IsZipping()) {
1345 ds.AddDir("/data/misc/bluetooth/logs", true);
1347 if (!ds.do_early_screenshot_) {
1349 ds.TakeScreenshot();
1358 const bool tombstones_dumped = AddDumps(ds.tombstone_data_.begin(), ds.tombstone_data_.end(),
1395 ds.AddDir(WMTRACE_DATA_DIR, false);
1398 ds.DumpstateBoard();
1478 printf("== Final progress (pid %d): %d/%d (estimated %d)\n", ds.pid_, ds.progress_->Get(),
1479 ds.progress_->GetMax(), ds.progress_->GetInitialMax());
1481 printf("== dumpstate: done (id %d)\n", ds.id_);
1540 printf("== dumpstate: done (id %d)\n", ds.id_);
1560 printf("== dumpstate: done (id %d)\n", ds.id_);
1718 MYLOGD("dumpstate id %d finished around %s (%ld s)\n", ds.id_, date,
1719 the_real_now_please_stand_up - ds.now_);
1721 if (!ds.AddZipEntry(entry_name, tmp_path_)) {
1732 if (!ds.AddZipEntry("dumpstate_log.txt", ds.log_path_.c_str())) {
1737 redirect_to_existing_file(stderr, const_cast<char*>(ds.log_path_.c_str()));
1747 ds.zip_file.reset(nullptr);
1866 case 'P': ds.update_progress_ = true; break;
1882 ds.args_ += argv[i];
1884 ds.args_ += " ";
1888 ds.extra_options_ = android::base::GetProperty(PROPERTY_EXTRA_OPTIONS, "");
1889 if (!ds.extra_options_.empty()) {
1892 if (ds.extra_options_ == "bugreportplus") {
1895 ds.update_progress_ = true;
1897 } else if (ds.extra_options_ == "bugreportremote") {
1901 } else if (ds.extra_options_ == "bugreportwear") {
1903 ds.update_progress_ = true;
1905 } else if (ds.extra_options_ == "bugreporttelephony") {
1907 } else if (ds.extra_options_ == "bugreportwifi") {
1911 MYLOGE("Unknown extra option: %s\n", ds.extra_options_.c_str());
1917 ds.notification_title = android::base::GetProperty(PROPERTY_EXTRA_TITLE, "");
1918 if (!ds.notification_title.empty()) {
1922 ds.notification_description = android::base::GetProperty(PROPERTY_EXTRA_DESCRIPTION, "");
1923 if (!ds.notification_description.empty()) {
1928 ds.notification_title.c_str(), ds.notification_description.c_str());
1931 if ((do_zip_file || do_add_date || ds.update_progress_ || do_broadcast) && !use_outfile) {
1939 if (ds.update_progress_ && !do_broadcast) {
1943 if (is_remote_mode && (ds.update_progress_ || !do_broadcast || !do_zip_file || !do_add_date)) {
1947 if (ds.version_ == VERSION_DEFAULT) {
1948 ds.version_ = VERSION_CURRENT;
1951 if (ds.version_ != VERSION_CURRENT && ds.version_ != VERSION_SPLIT_ANR) {
1953 ds.version_.c_str(), VERSION_DEFAULT.c_str(), VERSION_CURRENT.c_str(),
1959 ds.PrintHeader();
1970 ds.progress_.reset(new Progress(stats_path));
1974 ds.id_ = ++last_id;
1993 MYLOGI("dumpstate info: id=%d, args='%s', extra_options= %s)\n", ds.id_, ds.args_.c_str(),
1994 ds.extra_options_.c_str());
1996 MYLOGI("bugreport format version: %s\n", ds.version_.c_str());
1998 ds.do_early_screenshot_ = ds.update_progress_;
2008 ds.control_socket_fd_ = open_socket("dumpstate");
2009 ds.update_progress_ = 1;
2013 ds.bugreport_dir_ = dirname(use_outfile);
2016 ds.base_name_ = android::base::StringPrintf("%s-%s-%s", basename(use_outfile),
2020 strftime(date, sizeof(date), "%Y-%m-%d-%H-%M-%S", localtime(&ds.now_));
2021 ds.name_ = date;
2023 ds.name_ = "undated";
2027 ds.base_name_ += "-telephony";
2029 ds.base_name_ += "-wifi";
2033 ds.screenshot_path_ = ds.GetPath(".png");
2035 ds.tmp_path_ = ds.GetPath(".tmp");
2036 ds.log_path_ = ds.GetPath("-dumpstate_log-" + std::to_string(ds.pid_) + ".txt");
2045 ds.bugreport_dir_.c_str(), ds.base_name_.c_str(), ds.name_.c_str(),
2046 ds.log_path_.c_str(), ds.tmp_path_.c_str(), ds.screenshot_path_.c_str());
2049 ds.path_ = ds.GetPath(".zip");
2050 MYLOGD("Creating initial .zip file (%s)\n", ds.path_.c_str());
2051 create_parent_dirs(ds.path_.c_str());
2052 ds.zip_file.reset(fopen(ds.path_.c_str(), "wb"));
2053 if (ds.zip_file == nullptr) {
2054 MYLOGE("fopen(%s, 'wb'): %s\n", ds.path_.c_str(), strerror(errno));
2057 ds.zip_writer_.reset(new ZipWriter(ds.zip_file.get()));
2059 ds.AddTextZipEntry("version.txt", ds.version_);
2062 if (ds.update_progress_) {
2068 "--es", "android.intent.extra.NAME", ds.name_,
2069 "--ei", "android.intent.extra.ID", std::to_string(ds.id_),
2070 "--ei", "android.intent.extra.PID", std::to_string(ds.pid_),
2071 "--ei", "android.intent.extra.MAX", std::to_string(ds.progress_->GetMax()),
2077 dprintf(ds.control_socket_fd_, "BEGIN:%s\n", ds.path_.c_str());
2093 if (do_fb && ds.do_early_screenshot_) {
2094 if (ds.screenshot_path_.empty()) {
2099 ds.TakeScreenshot();
2104 if (chown(ds.path_.c_str(), AID_SHELL, AID_SHELL)) {
2105 MYLOGE("Unable to change ownership of zip file %s: %s\n", ds.path_.c_str(),
2112 redirect_to_file(stderr, const_cast<char*>(ds.log_path_.c_str()));
2113 if (chown(ds.log_path_.c_str(), AID_SHELL, AID_SHELL)) {
2115 ds.log_path_.c_str(), strerror(errno));
2121 redirect_to_file(stdout, const_cast<char*>(ds.tmp_path_.c_str()));
2122 if (chown(ds.tmp_path_.c_str(), AID_SHELL, AID_SHELL)) {
2124 ds.tmp_path_.c_str(), strerror(errno));
2134 ds.PrintHeader();
2138 ds.DumpstateBoard();
2160 ds.tombstone_data_ = GetDumpFds(TOMBSTONE_DIR, TOMBSTONE_FILE_PREFIX, !ds.IsZipping());
2161 ds.anr_data_ = GetDumpFds(ANR_DIR, ANR_FILE_PREFIX, !ds.IsZipping());
2163 ds.AddDir(RECOVERY_DIR, true);
2164 ds.AddDir(RECOVERY_DATA_DIR, true);
2165 ds.AddDir(UPDATE_ENGINE_LOG_DIR, true);
2166 ds.AddDir(LOGPERSIST_DATA_DIR, false);
2168 ds.AddDir(PROFILE_DATA_DIR_CUR, true);
2169 ds.AddDir(PROFILE_DATA_DIR_REF, true);
2202 android::base::StringPrintf("dumpstate.%d.name", ds.pid_), "");
2214 MYLOGI("changing suffix from %s to %s\n", ds.name_.c_str(), name.c_str());
2215 ds.name_ = name;
2216 if (!ds.screenshot_path_.empty()) {
2217 std::string new_screenshot_path = ds.GetPath(".png");
2218 if (rename(ds.screenshot_path_.c_str(), new_screenshot_path.c_str())) {
2219 MYLOGE("rename(%s, %s): %s\n", ds.screenshot_path_.c_str(),
2222 ds.screenshot_path_ = new_screenshot_path;
2229 if (!ds.FinishZipFile()) {
2235 std::string new_path = ds.GetPath(".zip");
2236 if (ds.path_ != new_path) {
2237 MYLOGD("Renaming zip file from %s to %s\n", ds.path_.c_str(), new_path.c_str());
2238 if (rename(ds.path_.c_str(), new_path.c_str())) {
2239 MYLOGE("rename(%s, %s): %s\n", ds.path_.c_str(), new_path.c_str(),
2242 ds.path_ = new_path;
2248 ds.path_ = ds.GetPath(".txt");
2249 MYLOGD("Generating .txt bugreport at %s from %s\n", ds.path_.c_str(),
2250 ds.tmp_path_.c_str());
2251 if (rename(ds.tmp_path_.c_str(), ds.path_.c_str())) {
2252 MYLOGE("rename(%s, %s): %s\n", ds.tmp_path_.c_str(), ds.path_.c_str(),
2254 ds.path_.clear();
2259 dprintf(ds.control_socket_fd_,
2262 ds.log_path_.c_str());
2264 dprintf(ds.control_socket_fd_, "OK:%s\n", ds.path_.c_str());
2279 if (!ds.path_.empty()) {
2280 MYLOGI("Final bugreport path: %s\n", ds.path_.c_str());
2285 "--ei", "android.intent.extra.ID", std::to_string(ds.id_),
2286 "--ei", "android.intent.extra.PID", std::to_string(ds.pid_),
2287 "--ei", "android.intent.extra.MAX", std::to_string(ds.progress_->GetMax()),
2288 "--es", "android.intent.extra.BUGREPORT", ds.path_,
2289 "--es", "android.intent.extra.DUMPSTATE_LOG", ds.log_path_
2295 am_args.push_back(ds.screenshot_path_);
2297 if (!ds.notification_title.empty()) {
2300 am_args.push_back(ds.notification_title);
2301 if (!ds.notification_description.empty()) {
2304 am_args.push_back(ds.notification_description);
2310 am_args.push_back(SHA256_file_hash(ds.path_));
2321 MYLOGD("Final progress: %d/%d (estimated %d)\n", ds.progress_->Get(), ds.progress_->GetMax(),
2322 ds.progress_->GetInitialMax());
2323 ds.progress_->Save();
2324 MYLOGI("done (id %d)\n", ds.id_);
2330 if (use_control_socket && ds.control_socket_fd_ != -1) {
2332 close(ds.control_socket_fd_);
2335 ds.tombstone_data_.clear();
2336 ds.anr_data_.clear();