xref: /aosp_15_r20/external/angle/util/android/android_backtrace.cpp (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1 //
2 // Copyright 2022 The ANGLE Project Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 //
6 // android_backtrace.cpp:
7 //   Implements functions to output the backtrace from the ANGLE code during execution on Android.
8 //
9 
10 #include "common/backtrace_utils.h"
11 
12 namespace angle
13 {
14 
printBacktraceInfo(BacktraceInfo backtraceInfo)15 void printBacktraceInfo(BacktraceInfo backtraceInfo)
16 {
17     // Return if no backtrace data is available.
18     if (backtraceInfo.getStackAddresses().empty())
19     {
20         return;
21     }
22 
23     WARN() << "Backtrace start";
24     for (size_t i = 0; i < backtraceInfo.getSize(); i++)
25     {
26         WARN() << i << ":" << backtraceInfo.getStackAddress(i) << " -> "
27                << backtraceInfo.getStackSymbol(i);
28     }
29     WARN() << "Backtrace end";
30 }
31 }  // namespace angle
32