Files
godot-angle-static/util/android/android_backtrace.cpp
Amirali Abdolrashidi f62405c5ac Add utilities to get the Android backtrace
* Added getBacktraceInfo(), which returns the backtrace information
  from the ANGLE code, including the addresses and the symbols if
  possible

  * Returns the data in an instance of the new class BacktraceInfo.

  * In order to access this function, backtrace_utils.h has been
    included in vk_utils.h

* New GN flag to make use of this feature:

  * angle_enable_unwind_backtrace_support

    * Current only available on Android (debug mode)

  * If the flag is disabled, getBacktraceInfo() returns an empty
    object.

* Added functions in util/ (per platform) to print the BacktraceInfo
  data.

  * Example of usage:
      angle::printBacktraceInfo(angle::getBacktraceInfo());

* Minor edit: Moved cstdint from android_util.cpp to its header.

Bug: b/258475923
Change-Id: I6115462a1a2845d40c7cafc14ce52df09ecdcf34
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3995843
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Charlie Lao <cclao@google.com>
Commit-Queue: Amirali Abdolrashidi <abdolrashidi@google.com>
2022-11-11 18:18:55 +00:00

32 lines
826 B
C++

//
// Copyright 2022 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// android_backtrace.cpp:
// Implements functions to output the backtrace from the ANGLE code during execution on Android.
//
#include "common/backtrace_utils.h"
namespace angle
{
void printBacktraceInfo(BacktraceInfo backtraceInfo)
{
// Return if no backtrace data is available.
if (backtraceInfo.getStackAddresses().empty())
{
return;
}
WARN() << "Backtrace start";
for (size_t i = 0; i < backtraceInfo.getSize(); i++)
{
WARN() << i << ":" << backtraceInfo.getStackAddress(i) << " -> "
<< backtraceInfo.getStackSymbol(i);
}
WARN() << "Backtrace end";
}
} // namespace angle