profiling: Forward failed unwindings to bookkeeping.

This is to keep the sequence numbering consistent.

Change-Id: I6424ef7e3d2e16044a20478e4a5277e3a2aa73ad
diff --git a/src/profiling/memory/unwinding.cc b/src/profiling/memory/unwinding.cc
index be7bb59..4a74d1f 100644
--- a/src/profiling/memory/unwinding.cc
+++ b/src/profiling/memory/unwinding.cc
@@ -171,10 +171,14 @@
   std::unique_ptr<unwindstack::Regs> regs(
       CreateFromRawData(alloc_metadata->arch, alloc_metadata->register_data));
   if (regs == nullptr) {
+    unwindstack::FrameData frame_data{};
+    frame_data.function_name = "ERROR READING REGISTERS";
+    frame_data.map_name = "ERROR";
+
+    out->frames.emplace_back(frame_data, "");
     PERFETTO_DLOG("regs");
     return false;
   }
-  out->alloc_metadata = *alloc_metadata;
   uint8_t* stack = reinterpret_cast<uint8_t*>(msg->payload);
   std::shared_ptr<unwindstack::Memory> mems =
       std::make_shared<StackOverlayMemory>(metadata->fd_mem,
@@ -239,9 +243,11 @@
       return false;
     }
 
+    out->alloc_record.alloc_metadata = *msg.alloc_header;
     out->pid = rec->pid;
     out->record_type = BookkeepingRecord::Type::Malloc;
-    return DoUnwind(&msg, metadata.get(), &out->alloc_record);
+    DoUnwind(&msg, metadata.get(), &out->alloc_record);
+    return true;
   } else if (msg.record_type == RecordType::Free) {
     out->record_type = BookkeepingRecord::Type::Free;
     out->pid = rec->pid;