Lines Matching defs:ds

96 static Dumpstate& ds = Dumpstate::GetInstance();
99 return ds.RunCommand(title, fullCommand, options);
104 return ds.RunDumpsys(title, dumpsysArgs, options, dumpsysTimeout);
107 return ds.DumpFile(title, path);
128 time_t thirty_minutes_ago = ds.now_ - 60 * 30;
135 (ds.IsZipping() || st.st_mtime >= thirty_minutes_ago)) {
162 if (ds.AddZipEntry(ZIP_ROOT_DIR + path, path)) {
171 if (!ds.IsZipping()) return;
218 if (!ds.IsZipping()) {
290 if (!ds.AddZipEntry("anrd_trace.txt", path)) {
306 if (!ds.IsZipping()) {
310 std::string systrace_path = ds.GetPath("-systrace.txt");
337 if (!ds.AddZipEntry("systrace.txt", systrace_path)) {
351 std::string raft_path = ds.GetPath("-raft_log.txt");
364 if (!ds.IsZipping()) {
371 if (!ds.AddZipEntry("raft_log.txt", raft_path)) {
422 if (!ds.IsZipping()) {
437 radio_bugreport_dir = dirname(ds.GetPath("").c_str());
452 if (!ds.AddZipEntry(filename, modem_log_file)) {
714 get_mtime(fd, ds.now_));
759 return ds.AddZipEntryFromFd(ZIP_ROOT_DIR + path, fd) ? 0 : 1;
779 int32_t err = zip_writer_->StartEntryWithTime(entry_name.c_str(), ZipWriter::kCompress, ds.now_);
864 bool add_to_zip = ds.IsZipping() && ds.version_ == VERSION_SPLIT_ANR;
872 ds.AddDir(dump_traces_dir, true);
876 ds.DumpFile("VM TRACES JUST NOW", dump_traces_path);
907 ds.AddDir(anr_traces_dir, true);
938 ds.DumpFile("VM TRACES WHEN SLOW", anr_traces_path.c_str());
971 if (ds.IsZipping()) {
977 ds.AddZipEntry("lshal-debug.txt", kLsHalDebugPath);
1002 ds.AddDir("/data/misc/bluetooth/logs", true);
1004 if (!ds.do_early_screenshot_) {
1006 ds.TakeScreenshot();
1019 if (ds.IsZipping()) {
1020 if (!ds.AddZipEntryFromFd(ZIP_ROOT_DIR + name, fd)) {
1094 ds.DumpstateBoard();
1159 printf("== Final progress (pid %d): %d/%d (estimated %d)\n", ds.pid_, ds.progress_->Get(),
1160 ds.progress_->GetMax(), ds.progress_->GetInitialMax());
1162 printf("== dumpstate: done (id %d)\n", ds.id_);
1273 MYLOGD("dumpstate id %d finished around %s (%ld s)\n", ds.id_, date,
1274 the_real_now_please_stand_up - ds.now_);
1276 if (!ds.AddZipEntry(entry_name, tmp_path_)) {
1287 if (!ds.AddZipEntry("dumpstate_log.txt", ds.log_path_.c_str())) {
1292 redirect_to_existing_file(stderr, const_cast<char*>(ds.log_path_.c_str()));
1302 ds.zip_file.reset(nullptr);
1417 case 'P': ds.update_progress_ = true; break;
1433 ds.args_ += argv[i];
1435 ds.args_ += " ";
1439 ds.extra_options_ = android::base::GetProperty(PROPERTY_EXTRA_OPTIONS, "");
1440 if (!ds.extra_options_.empty()) {
1443 if (ds.extra_options_ == "bugreportplus") {
1446 ds.update_progress_ = true;
1448 } else if (ds.extra_options_ == "bugreportremote") {
1452 } else if (ds.extra_options_ == "bugreportwear") {
1453 ds.update_progress_ = true;
1454 } else if (ds.extra_options_ == "bugreporttelephony") {
1457 MYLOGE("Unknown extra option: %s\n", ds.extra_options_.c_str());
1463 ds.notification_title = android::base::GetProperty(PROPERTY_EXTRA_TITLE, "");
1464 if (!ds.notification_title.empty()) {
1468 ds.notification_description = android::base::GetProperty(PROPERTY_EXTRA_DESCRIPTION, "");
1469 if (!ds.notification_description.empty()) {
1474 ds.notification_title.c_str(), ds.notification_description.c_str());
1477 if ((do_zip_file || do_add_date || ds.update_progress_ || do_broadcast) && !use_outfile) {
1485 if (ds.update_progress_ && !do_broadcast) {
1489 if (is_remote_mode && (ds.update_progress_ || !do_broadcast || !do_zip_file || !do_add_date)) {
1493 if (ds.version_ == VERSION_DEFAULT) {
1494 ds.version_ = VERSION_CURRENT;
1497 if (ds.version_ != VERSION_CURRENT && ds.version_ != VERSION_SPLIT_ANR) {
1499 ds.version_.c_str(), VERSION_DEFAULT.c_str(), VERSION_CURRENT.c_str(),
1505 ds.PrintHeader();
1516 ds.progress_.reset(new Progress(stats_path));
1520 ds.id_ = ++last_id;
1539 MYLOGI("dumpstate info: id=%d, args='%s', extra_options= %s)\n", ds.id_, ds.args_.c_str(),
1540 ds.extra_options_.c_str());
1542 MYLOGI("bugreport format version: %s\n", ds.version_.c_str());
1544 ds.do_early_screenshot_ = ds.update_progress_;
1554 ds.control_socket_fd_ = open_socket("dumpstate");
1555 ds.update_progress_ = 1;
1559 ds.bugreport_dir_ = dirname(use_outfile);
1562 ds.base_name_ = android::base::StringPrintf("%s-%s-%s", basename(use_outfile),
1566 strftime(date, sizeof(date), "%Y-%m-%d-%H-%M-%S", localtime(&ds.now_));
1567 ds.name_ = date;
1569 ds.name_ = "undated";
1573 ds.base_name_ += "-telephony";
1577 ds.screenshot_path_ = ds.GetPath(".png");
1579 ds.tmp_path_ = ds.GetPath(".tmp");
1580 ds.log_path_ = ds.GetPath("-dumpstate_log-" + std::to_string(ds.pid_) + ".txt");
1589 ds.bugreport_dir_.c_str(), ds.base_name_.c_str(), ds.name_.c_str(),
1590 ds.log_path_.c_str(), ds.tmp_path_.c_str(), ds.screenshot_path_.c_str());
1593 ds.path_ = ds.GetPath(".zip");
1594 MYLOGD("Creating initial .zip file (%s)\n", ds.path_.c_str());
1595 create_parent_dirs(ds.path_.c_str());
1596 ds.zip_file.reset(fopen(ds.path_.c_str(), "wb"));
1597 if (ds.zip_file == nullptr) {
1598 MYLOGE("fopen(%s, 'wb'): %s\n", ds.path_.c_str(), strerror(errno));
1601 ds.zip_writer_.reset(new ZipWriter(ds.zip_file.get()));
1603 ds.AddTextZipEntry("version.txt", ds.version_);
1606 if (ds.update_progress_) {
1612 "--es", "android.intent.extra.NAME", ds.name_,
1613 "--ei", "android.intent.extra.ID", std::to_string(ds.id_),
1614 "--ei", "android.intent.extra.PID", std::to_string(ds.pid_),
1615 "--ei", "android.intent.extra.MAX", std::to_string(ds.progress_->GetMax()),
1621 dprintf(ds.control_socket_fd_, "BEGIN:%s\n", ds.path_.c_str());
1637 if (do_fb && ds.do_early_screenshot_) {
1638 if (ds.screenshot_path_.empty()) {
1643 ds.TakeScreenshot();
1648 if (chown(ds.path_.c_str(), AID_SHELL, AID_SHELL)) {
1649 MYLOGE("Unable to change ownership of zip file %s: %s\n", ds.path_.c_str(),
1655 redirect_to_file(stderr, const_cast<char*>(ds.log_path_.c_str()));
1656 if (chown(ds.log_path_.c_str(), AID_SHELL, AID_SHELL)) {
1658 ds.log_path_.c_str(), strerror(errno));
1663 redirect_to_file(stdout, const_cast<char*>(ds.tmp_path_.c_str()));
1664 if (chown(ds.tmp_path_.c_str(), AID_SHELL, AID_SHELL)) {
1666 ds.tmp_path_.c_str(), strerror(errno));
1676 ds.PrintHeader();
1686 ds.DumpstateBoard();
1711 ds.AddDir(RECOVERY_DIR, true);
1712 ds.AddDir(RECOVERY_DATA_DIR, true);
1713 ds.AddDir(LOGPERSIST_DATA_DIR, false);
1715 ds.AddDir(PROFILE_DATA_DIR_CUR, true);
1716 ds.AddDir(PROFILE_DATA_DIR_REF, true);
1746 android::base::StringPrintf("dumpstate.%d.name", ds.pid_), "");
1758 MYLOGI("changing suffix from %s to %s\n", ds.name_.c_str(), name.c_str());
1759 ds.name_ = name;
1760 if (!ds.screenshot_path_.empty()) {
1761 std::string new_screenshot_path = ds.GetPath(".png");
1762 if (rename(ds.screenshot_path_.c_str(), new_screenshot_path.c_str())) {
1763 MYLOGE("rename(%s, %s): %s\n", ds.screenshot_path_.c_str(),
1766 ds.screenshot_path_ = new_screenshot_path;
1773 if (!ds.FinishZipFile()) {
1779 std::string new_path = ds.GetPath(".zip");
1780 if (ds.path_ != new_path) {
1781 MYLOGD("Renaming zip file from %s to %s\n", ds.path_.c_str(), new_path.c_str());
1782 if (rename(ds.path_.c_str(), new_path.c_str())) {
1783 MYLOGE("rename(%s, %s): %s\n", ds.path_.c_str(), new_path.c_str(),
1786 ds.path_ = new_path;
1792 ds.path_ = ds.GetPath(".txt");
1793 MYLOGD("Generating .txt bugreport at %s from %s\n", ds.path_.c_str(),
1794 ds.tmp_path_.c_str());
1795 if (rename(ds.tmp_path_.c_str(), ds.path_.c_str())) {
1796 MYLOGE("rename(%s, %s): %s\n", ds.tmp_path_.c_str(), ds.path_.c_str(),
1798 ds.path_.clear();
1803 dprintf(ds.control_socket_fd_,
1806 ds.log_path_.c_str());
1808 dprintf(ds.control_socket_fd_, "OK:%s\n", ds.path_.c_str());
1821 if (!ds.path_.empty()) {
1822 MYLOGI("Final bugreport path: %s\n", ds.path_.c_str());
1827 "--ei", "android.intent.extra.ID", std::to_string(ds.id_),
1828 "--ei", "android.intent.extra.PID", std::to_string(ds.pid_),
1829 "--ei", "android.intent.extra.MAX", std::to_string(ds.progress_->GetMax()),
1830 "--es", "android.intent.extra.BUGREPORT", ds.path_,
1831 "--es", "android.intent.extra.DUMPSTATE_LOG", ds.log_path_
1837 am_args.push_back(ds.screenshot_path_);
1839 if (!ds.notification_title.empty()) {
1842 am_args.push_back(ds.notification_title);
1843 if (!ds.notification_description.empty()) {
1846 am_args.push_back(ds.notification_description);
1852 am_args.push_back(SHA256_file_hash(ds.path_));
1863 MYLOGD("Final progress: %d/%d (estimated %d)\n", ds.progress_->Get(), ds.progress_->GetMax(),
1864 ds.progress_->GetInitialMax());
1865 ds.progress_->Save();
1866 MYLOGI("done (id %d)\n", ds.id_);
1872 if (use_control_socket && ds.control_socket_fd_ != -1) {
1874 close(ds.control_socket_fd_);