Austin Schuh | 75263e3 | 2022-02-22 18:05:32 -0800 | [diff] [blame] | 1 | // Copyright (c) FIRST and other WPILib contributors. |
| 2 | // Open Source Software; you can modify and/or share it under the terms of |
| 3 | // the WPILib BSD license file in the root directory of this project. |
| 4 | |
| 5 | #include <atomic> |
| 6 | |
| 7 | #include "wpi/StackTrace.h" |
| 8 | |
| 9 | static std::atomic<std::string (*)(int offset)> gStackTraceImpl{ |
| 10 | wpi::GetStackTraceDefault}; |
| 11 | |
| 12 | std::string wpi::GetStackTrace(int offset) { |
| 13 | return (gStackTraceImpl.load())(offset); |
| 14 | } |
| 15 | |
| 16 | void wpi::SetGetStackTraceImpl(std::string (*func)(int offset)) { |
| 17 | gStackTraceImpl = func ? func : wpi::GetStackTraceDefault; |
| 18 | } |