Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c80cf0c authored by Felipe Leme's avatar Felipe Leme
Browse files

Adds all tombstone files when writing to zipped file.

Currently, a bugreport simply cats any tombstone file modified in the
last half an hour into the bugreport. This is a problem since the
tombstones contain a lot of really valuable information, and sometimes
users don't get a bugreport in this time frame. In addition, some of our
monkey testing has the same problem.

Since now dumpstate can create a zip file, we can include all  directly
on it, although still using the old mechanism when it's creating it (for example, when invoked through 'adb bugreport').

BUG: 25974224
Change-Id: Ie29fd7d91953d91232b0db1c9588043aee13f93e
parent 1e9edc61
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -304,7 +304,7 @@ static void print_header() {
}

static void dumpstate(const std::string& screenshot_path) {
    std::unique_ptr<DurationReporter> duration_reporter(new DurationReporter("DUMPSTATE"));
    DurationReporter> duration_reporter("DUMPSTATE");
    unsigned long timeout;

    dump_dev_files("TRUSTY VERSION", "/sys/bus/platform/drivers/trusty", "trusty_version");
+10 −1
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ static const int WEIGHT_TOTAL = 4000;
static const int WEIGHT_FILE = 5;

/*
 * TOOD: the dumpstate internal state is getting fragile; for example, this variable is defined
 * TODO: the dumpstate internal state is getting fragile; for example, this variable is defined
 * here, declared at utils.cpp, and used on utils.cpp and dumpstate.cpp.
 * It would be better to take advantage of the C++ migration and encapsulate the state in an object,
 * but that will be better handled in a major C++ refactoring, which would also get rid of other C
@@ -142,6 +142,15 @@ void dumpstate_board();
/* Takes a screenshot and save it to the given file */
void take_screenshot(const std::string& path);

/* Vibrates for a given durating (in milliseconds). */
void vibrate(FILE* vibrator, int ms);

/* Checks if a given path is a directory. */
bool is_dir(const char* pathname);

/** Gets the last modification time of a file, or default time if file is not found. */
time_t get_mtime(int fd, time_t default_mtime);

/* dump eMMC Extended CSD data */
void dump_emmc_ecsd(const char *ext_csd_path);

+22 −1
Original line number Diff line number Diff line
@@ -912,6 +912,27 @@ void take_screenshot(const std::string& path) {
    run_command_always(NULL, 10, args);
}

void vibrate(FILE* vibrator, int ms) {
    fprintf(vibrator, "%d\n", ms);
    fflush(vibrator);
}

bool is_dir(const char* pathname) {
    struct stat info;
    if (stat(pathname, &info) == -1) {
        return false;
    }
    return S_ISDIR(info.st_mode);
}

time_t get_mtime(int fd, time_t default_mtime) {
    struct stat info;
    if (fstat(fd, &info) == -1) {
        return default_mtime;
    }
    return info.st_mtime;
}

void dump_emmc_ecsd(const char *ext_csd_path) {
    static const size_t EXT_CSD_REV = 192;
    static const size_t EXT_PRE_EOL_INFO = 267;