Introduce GFXSTREAM_ABORT instead of normal abort.

This CL moves most of our abort() callsites to use the new
GFXSTREAM_ABORT macro, which will allow us to track metrics
about when and where we abort.

Generated code is not yet changed, and test and third-party
code is not affected.

Bug: 204125485
Test: Compile, run emulator.

Change-Id: I909d79a35121f24a60e3b4db2745af5ceeee369c
diff --git a/stream-servers/vulkan/VkCommonOperations.cpp b/stream-servers/vulkan/VkCommonOperations.cpp
index fc95906..330324f 100644
--- a/stream-servers/vulkan/VkCommonOperations.cpp
+++ b/stream-servers/vulkan/VkCommonOperations.cpp
@@ -34,6 +34,7 @@
 #include "base/System.h"
 #include "base/Tracing.h"
 #include "common/goldfish_vk_dispatch.h"
+#include "host-common/GfxstreamFatalError.h"
 #include "host-common/vm_operations.h"
 
 #ifdef _WIN32
@@ -792,7 +793,6 @@
 
     sVkEmulation->physdev = physdevs[maxScoringIndex];
     sVkEmulation->deviceInfo = deviceInfos[maxScoringIndex];
-
     // Postcondition: sVkEmulation has valid device support info
 
     // Ask about image format support here.
@@ -1876,7 +1876,6 @@
     bool readRes = FrameBuffer::getFB()->
         readColorBufferContents(
             colorBufferHandle, &cbNumBytes, nullptr);
-
     if (!readRes) {
         fprintf(stderr, "%s: Failed to read color buffer 0x%x\n",
                 __func__, colorBufferHandle);
@@ -2008,7 +2007,7 @@
             });
         }
     }
-        
+
     vk->vkCmdCopyBufferToImage(
         sVkEmulation->commandBuffer,
         sVkEmulation->staging.buffer,
@@ -2469,8 +2468,8 @@
         if (res == VK_NOT_READY) {
             continue;
         }
-        VK_COMMON_ERROR("Invalid fence state: %d", static_cast<int>(res));
-        ::std::abort();
+        GFXSTREAM_ABORT(FatalError(ABORT_REASON_OTHER))
+            << "Invalid fence state: " << static_cast<int>(res);
     }
     VkCommandBuffer commandBuffer;
     VkCommandBufferAllocateInfo allocateInfo = {
@@ -2504,9 +2503,7 @@
 void acquireColorBuffersForHostComposing(const std::vector<uint32_t>& layerColorBuffers,
                                          uint32_t renderTargetColorBuffer) {
     if (!sVkEmulation || !sVkEmulation->live) {
-        VK_COMMON_ERROR("Host Vulkan device lost.");
-        ::std::abort();
-        return;
+        GFXSTREAM_ABORT(FatalError(ABORT_REASON_OTHER)) << "Host Vulkan device lost";
     }
 
     std::vector<std::tuple<uint32_t, VkImageLayout>> colorBuffersAndLayouts;
@@ -2647,9 +2644,7 @@
 static VkFence doReleaseColorBufferForGuestRendering(
     const std::vector<uint32_t>& colorBufferHandles) {
     if (!sVkEmulation || !sVkEmulation->live) {
-        VK_COMMON_ERROR("Host Vulkan device lost.");
-        ::std::abort();
-        return VK_NULL_HANDLE;
+        GFXSTREAM_ABORT(FatalError(ABORT_REASON_OTHER)) << "Host Vulkan device lost";
     }
 
     AutoLock lock(sVkEmulationLock);
@@ -2772,9 +2767,7 @@
 void releaseColorBufferFromHostComposingSync(const std::vector<uint32_t>& colorBufferHandles) {
     VkFence fence = doReleaseColorBufferForGuestRendering(colorBufferHandles);
     if (!sVkEmulation || !sVkEmulation->live) {
-        VK_COMMON_ERROR("Host Vulkan device lost.");
-        ::std::abort();
-        return;
+        GFXSTREAM_ABORT(FatalError(ABORT_REASON_OTHER)) << "Host Vulkan device lost";
     }
 
     AutoLock lock(sVkEmulationLock);