mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 12:42:34 +01:00
Implement getCallStackFast/Exact for fast call-stack backtrace.
This commit is contained in:
@@ -49,7 +49,7 @@ namespace bx
|
||||
///
|
||||
WriterI* getDebugOut();
|
||||
|
||||
/// Capture current callstack.
|
||||
/// Capture current callstack fast.
|
||||
///
|
||||
/// @param[in] _skip Skip top N stack frames.
|
||||
/// @param[in] _max Maximum frame to capture.
|
||||
@@ -57,7 +57,17 @@ namespace bx
|
||||
///
|
||||
/// @returns Number of stack frames captured.
|
||||
///
|
||||
uint32_t getCallStack(uint32_t _skip, uint32_t _max, uintptr_t* _outStack);
|
||||
uint32_t getCallStackFast(uint32_t _skip, uint32_t _max, uintptr_t* _outStack);
|
||||
|
||||
/// Capture current callstack with slower but more accurate method.
|
||||
///
|
||||
/// @param[in] _skip Skip top N stack frames.
|
||||
/// @param[in] _max Maximum frame to capture.
|
||||
/// @param[out] _outStack Stack frames array. Must be at least `_max` elements.
|
||||
///
|
||||
/// @returns Number of stack frames captured.
|
||||
///
|
||||
uint32_t getCallStackExact(uint32_t _skip, uint32_t _max, uintptr_t* _outStack);
|
||||
|
||||
/// Write callstack.
|
||||
///
|
||||
@@ -68,9 +78,9 @@ namespace bx
|
||||
///
|
||||
/// @returns Number of bytes writen to `_writer`.
|
||||
///
|
||||
int32_t writeCallstack(WriterI* _writer, uintptr_t* _stack, uint32_t _num, Error* _err);
|
||||
int32_t writeCallstack(WriterI* _writer, const uintptr_t* _stack, uint32_t _num, Error* _err);
|
||||
|
||||
/// Capture call stack, and write it to debug output.
|
||||
/// Capture call stack with `bx::getCallStackExact`, and write it to debug output.
|
||||
///
|
||||
/// @param[in] _skip Skip top N stack frames.
|
||||
///
|
||||
|
||||
@@ -60,6 +60,10 @@ namespace bx
|
||||
///
|
||||
FilePath(const StringView& _str);
|
||||
|
||||
/// Assign file path from string.
|
||||
///
|
||||
FilePath& operator=(const char* _rhs);
|
||||
|
||||
/// Assign file path from string.
|
||||
///
|
||||
FilePath& operator=(const StringView& _rhs);
|
||||
|
||||
@@ -187,6 +187,25 @@ namespace bx
|
||||
return m_0terminated;
|
||||
}
|
||||
|
||||
inline bool operator==(const StringView& _lhs, const StringView& _rhs)
|
||||
{
|
||||
return 0 == strCmp(_lhs, _rhs);
|
||||
}
|
||||
|
||||
inline bool overlap(const StringView& _a, const StringView& _b)
|
||||
{
|
||||
return _a.getTerm() > _b.getPtr()
|
||||
&& _b.getTerm() > _a.getPtr()
|
||||
;
|
||||
}
|
||||
|
||||
inline bool contain(const StringView& _a, const StringView& _b)
|
||||
{
|
||||
return _a.getPtr() <= _b.getPtr()
|
||||
&& _a.getTerm() >= _b.getTerm()
|
||||
;
|
||||
}
|
||||
|
||||
template<uint16_t MaxCapacityT>
|
||||
inline FixedStringT<MaxCapacityT>::FixedStringT()
|
||||
: m_len(0)
|
||||
|
||||
@@ -137,6 +137,15 @@ namespace bx
|
||||
bool m_0terminated;
|
||||
};
|
||||
|
||||
/// Compare two string views.
|
||||
bool operator==(const StringView& _lhs, const StringView& _rhs);
|
||||
|
||||
/// Returns true if two string views overlap.
|
||||
bool overlap(const StringView& _a, const StringView& _b);
|
||||
|
||||
/// Returns true if string view `_a` contains string view `_b`.
|
||||
bool contain(const StringView& _a, const StringView& _b);
|
||||
|
||||
/// Fixed capacity string.
|
||||
///
|
||||
template<uint16_t MaxCapacityT>
|
||||
|
||||
Reference in New Issue
Block a user