profiling: Account for failed unwindings.

Even if we do not know the full callstack, the partial callstack could
be useful. This is also useful to know the total memory seen by the heap
profiler, even if unwinding fails completely.

Change-Id: Icc453a4b8a44cc428b40c51e823ffd394fc9e384
diff --git a/src/profiling/memory/unwinding.cc b/src/profiling/memory/unwinding.cc
index 4f2bbae..e2a6e8e 100644
--- a/src/profiling/memory/unwinding.cc
+++ b/src/profiling/memory/unwinding.cc
@@ -162,11 +162,16 @@
     if (error_code != unwindstack::ERROR_INVALID_MAP)
       break;
   }
-  if (error_code == 0)
-    out->frames = unwinder.frames();
-  else
+  out->frames = unwinder.frames();
+  if (error_code != 0) {
+    unwindstack::FrameData frame_data{};
+    frame_data.function_name = "ERROR " + std::to_string(error_code);
+    frame_data.map_name = "ERROR";
+
+    out->frames.emplace_back(frame_data);
     PERFETTO_DLOG("unwinding failed %" PRIu8, error_code);
-  return error_code == 0;
+  }
+  return true;
 }
 
 bool HandleUnwindingRecord(UnwindingRecord* rec, BookkeepingRecord* out) {
@@ -183,10 +188,7 @@
 
     out->pid = rec->pid;
     out->record_type = BookkeepingRecord::Type::Malloc;
-    if (!DoUnwind(&msg, metadata.get(), &out->alloc_record)) {
-      return false;
-    }
-    return true;
+    return DoUnwind(&msg, metadata.get(), &out->alloc_record);
   } else if (msg.record_type == RecordType::Free) {
     out->record_type = BookkeepingRecord::Type::Free;
     out->pid = rec->pid;