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

Commit 017adb2d authored by Kweku Adams's avatar Kweku Adams Committed by Android (Google) Code Review
Browse files

Merge "Dumping stack traces to proto."

parents 30980b82 5c804e2b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -813,6 +813,7 @@ gensrcs {
    ],

    srcs: [
        "core/proto/android/os/backtrace.proto",
        "core/proto/android/os/batterytype.proto",
        "core/proto/android/os/cpufreq.proto",
        "core/proto/android/os/cpuinfo.proto",
+8 −2
Original line number Diff line number Diff line
@@ -15,8 +15,10 @@
LOCAL_PATH:= $(call my-dir)

# proto files used in incidentd to generate cppstream proto headers.
PROTO_FILES:= frameworks/base/core/proto/android/util/log.proto \
        frameworks/base/core/proto/android/os/data.proto
PROTO_FILES:= \
        frameworks/base/core/proto/android/os/backtrace.proto \
        frameworks/base/core/proto/android/os/data.proto \
        frameworks/base/core/proto/android/util/log.proto

# ========= #
# incidentd #
@@ -46,6 +48,8 @@ LOCAL_SHARED_LIBRARIES := \
        libbase \
        libbinder \
        libcutils \
        libdebuggerd_client \
        libdumputils \
        libincident \
        liblog \
        libprotobuf-cpp-lite \
@@ -119,6 +123,8 @@ LOCAL_SHARED_LIBRARIES := \
    libbase \
    libbinder \
    libcutils \
    libdebuggerd_client \
    libdumputils \
    libincident \
    liblog \
    libprotobuf-cpp-lite \
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ service incidentd /system/bin/incidentd
    class main
    user incidentd
    group incidentd log readproc
    capabilities KILL SYS_PTRACE

on post-fs-data
    # Create directory for incidentd
+29 −0
Original line number Diff line number Diff line
@@ -87,6 +87,35 @@ status_t FdBuffer::read(int fd, int64_t timeout) {
    return NO_ERROR;
}

status_t FdBuffer::readFully(int fd) {
    mStartTime = uptimeMillis();

    while (true) {
        if (mBuffer.size() >= MAX_BUFFER_COUNT * BUFFER_SIZE) {
            // Don't let it get too big.
            mTruncated = true;
            VLOG("Truncating data");
            break;
        }
        if (mBuffer.writeBuffer() == NULL) return NO_MEMORY;

        ssize_t amt =
                TEMP_FAILURE_RETRY(::read(fd, mBuffer.writeBuffer(), mBuffer.currentToWrite()));
        if (amt < 0) {
            VLOG("Fail to read %d: %s", fd, strerror(errno));
            return -errno;
        } else if (amt == 0) {
            VLOG("Done reading %zu bytes", mBuffer.size());
            // We're done.
            break;
        }
        mBuffer.wp()->move(amt);
    }

    mFinishTime = uptimeMillis();
    return NO_ERROR;
}

status_t FdBuffer::readProcessedDataInStream(int fd, int toFd, int fromFd, int64_t timeoutMs,
                                             const bool isSysfs) {
    struct pollfd pfds[] = {
+6 −0
Original line number Diff line number Diff line
@@ -40,6 +40,12 @@ public:
     */
    status_t read(int fd, int64_t timeoutMs);

    /**
     * Read the data until we hit eof.
     * Returns NO_ERROR if there were no errors.
     */
    status_t readFully(int fd);

    /**
     * Read processed results by streaming data to a parsing process, e.g. incident helper.
     * The parsing process provides IO fds which are 'toFd' and 'fromFd'. The function
Loading