mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
Move GetStackTrace and Demangle to wpiutil, add Windows support (#1819)
For Windows, import the StackWalker source (https://github.com/JochenKalmbach/StackWalker) plus PR 35 in that repo, with a few simplifications to StackWalker.h.
This commit is contained in:
25
wpiutil/src/main/native/include/wpi/Demangle.h
Normal file
25
wpiutil/src/main/native/include/wpi/Demangle.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef WPIUTIL_WPI_DEMANGLE_H_
|
||||
#define WPIUTIL_WPI_DEMANGLE_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace wpi {
|
||||
|
||||
/**
|
||||
* Demangle a C++ symbol.
|
||||
*
|
||||
* @param mangledSymbol the mangled symbol.
|
||||
* @return The demangled symbol, or mangledSymbol if demangling fails.
|
||||
*/
|
||||
std::string Demangle(char const* mangledSymbol);
|
||||
|
||||
} // namespace wpi
|
||||
|
||||
#endif // WPIUTIL_WPI_DEMANGLE_H_
|
||||
24
wpiutil/src/main/native/include/wpi/StackTrace.h
Normal file
24
wpiutil/src/main/native/include/wpi/StackTrace.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef WPIUTIL_WPI_STACKTRACE_H_
|
||||
#define WPIUTIL_WPI_STACKTRACE_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace wpi {
|
||||
|
||||
/**
|
||||
* Get a stack trace, ignoring the first "offset" symbols.
|
||||
*
|
||||
* @param offset The number of symbols at the top of the stack to ignore
|
||||
*/
|
||||
std::string GetStackTrace(int offset);
|
||||
|
||||
} // namespace wpi
|
||||
|
||||
#endif // WPIUTIL_WPI_STACKTRACE_H_
|
||||
Reference in New Issue
Block a user