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

Commit 5943bf6b authored by Vishnu Nair's avatar Vishnu Nair
Browse files

Capture traces when we encounter fatal errors

When we encounter fatal errors, capture the transaction trace
and write it to disk. This will help us root cause
unexpected failures faster.

Bug: 311954600
Test: presubmit
Change-Id: I19aabc20b75531bc22ed540096def111647b9afb
parent 926dbea7
Loading
Loading
Loading
Loading
+18 −15
Original line number Diff line number Diff line
@@ -2235,7 +2235,8 @@ void SurfaceFlinger::updateLayerHistory(nsecs_t now) {
        }

        auto it = mLegacyLayers.find(snapshot->sequence);
        LOG_ALWAYS_FATAL_IF(it == mLegacyLayers.end(), "Couldn't find layer object for %s",
        LLOG_ALWAYS_FATAL_WITH_TRACE_IF(it == mLegacyLayers.end(),
                                        "Couldn't find layer object for %s",
                                        snapshot->getDebugString().c_str());

        if (updateSmallDirty) {
@@ -2389,7 +2390,8 @@ bool SurfaceFlinger::updateLayerSnapshots(VsyncId vsyncId, nsecs_t frameTimeNs,
            const bool willReleaseBufferOnLatch = layer->willReleaseBufferOnLatch();

            auto it = mLegacyLayers.find(layer->id);
            LOG_ALWAYS_FATAL_IF(it == mLegacyLayers.end(), "Couldnt find layer object for %s",
            LLOG_ALWAYS_FATAL_WITH_TRACE_IF(it == mLegacyLayers.end(),
                                            "Couldnt find layer object for %s",
                                            layer->getDebugString().c_str());
            if (!layer->hasReadyFrame() && !willReleaseBufferOnLatch) {
                if (!it->second->hasBuffer()) {
@@ -3089,7 +3091,7 @@ void SurfaceFlinger::onCompositionPresented(PhysicalDisplayId pacesetterId,
                        [&, compositionDisplay = compositionDisplay](
                                std::unique_ptr<frontend::LayerSnapshot>& snapshot) {
                            auto it = mLegacyLayers.find(snapshot->sequence);
                            LOG_ALWAYS_FATAL_IF(it == mLegacyLayers.end(),
                            LLOG_ALWAYS_FATAL_WITH_TRACE_IF(it == mLegacyLayers.end(),
                                                            "Couldnt find layer object for %s",
                                                            snapshot->getDebugString().c_str());
                            auto& legacyLayer = it->second;
@@ -6459,7 +6461,8 @@ void SurfaceFlinger::dumpHwcLayersMinidump(std::string& result) const {
                return;
            }
            auto it = mLegacyLayers.find(snapshot.sequence);
            LOG_ALWAYS_FATAL_IF(it == mLegacyLayers.end(), "Couldnt find layer object for %s",
            LLOG_ALWAYS_FATAL_WITH_TRACE_IF(it == mLegacyLayers.end(),
                                            "Couldnt find layer object for %s",
                                            snapshot.getDebugString().c_str());
            it->second->miniDump(result, snapshot, ref);
        });
@@ -8843,7 +8846,7 @@ std::vector<std::pair<Layer*, LayerFE*>> SurfaceFlinger::moveSnapshotsToComposit
                    }

                    auto it = mLegacyLayers.find(snapshot->sequence);
                    LOG_ALWAYS_FATAL_IF(it == mLegacyLayers.end(),
                    LLOG_ALWAYS_FATAL_WITH_TRACE_IF(it == mLegacyLayers.end(),
                                                    "Couldnt find layer object for %s",
                                                    snapshot->getDebugString().c_str());
                    auto& legacyLayer = it->second;
@@ -8914,7 +8917,7 @@ SurfaceFlinger::getLayerSnapshotsForScreenshots(
                    }

                    auto it = mLegacyLayers.find(snapshot->sequence);
                    LOG_ALWAYS_FATAL_IF(it == mLegacyLayers.end(),
                    LLOG_ALWAYS_FATAL_WITH_TRACE_IF(it == mLegacyLayers.end(),
                                                    "Couldnt find layer object for %s",
                                                    snapshot->getDebugString().c_str());
                    Layer* legacyLayer = (it == mLegacyLayers.end()) ? nullptr : it->second.get();