1 parent
f0825fbd1a
commit
42268c6c35
45 files changed
+2732
-262
No files matched your search
@@ -1,18 +1,31 @@
|
||||
#pragma once
|
||||
#include <Void/Result/Error.hpp>
|
||||
#include <Void/Result/Result.hpp>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <ostream>
|
||||
|
||||
namespace Void::Stacktrace {
|
||||
struct StackFrame {
|
||||
std::string function_name;
|
||||
std::string source_file;
|
||||
int source_line{0};
|
||||
std::string source_snippet;
|
||||
};
|
||||
namespace Void::Stacktrace
|
||||
{
|
||||
struct StackFrame {
|
||||
std::string function_name;
|
||||
std::string source_file;
|
||||
int source_line{0};
|
||||
std::string source_snippet;
|
||||
};
|
||||
|
||||
std::vector<StackFrame> capture_stacktrace(unsigned skip_frames = 0, unsigned max_frames = 32);
|
||||
std::string read_source_snippet(const std::string& file, int line, int context_lines = 3);
|
||||
std::string format_stacktrace(const std::vector<StackFrame>& frames);
|
||||
void print_stacktrace(std::ostream& os, const std::vector<StackFrame>& frames);
|
||||
std::vector<StackFrame> capture_stacktrace(unsigned skip_frames = 0,
|
||||
unsigned max_frames = 32);
|
||||
|
||||
/// Read a snippet of source around `line`. On failure (file missing,
|
||||
/// not readable, etc.) returns Failure<Error> instead of an empty
|
||||
/// string — callers that want the silent fallback can still do
|
||||
/// `read_source_snippet(...).value_or("")`.
|
||||
Void::Result::Result<std::string, Void::Result::Error>
|
||||
read_source_snippet(const std::string& file, int line,
|
||||
int context_lines = 3);
|
||||
|
||||
std::string format_stacktrace(const std::vector<StackFrame>& frames);
|
||||
void print_stacktrace(std::ostream& os,
|
||||
const std::vector<StackFrame>& frames);
|
||||
} // namespace Void::Stacktrace
|
||||
Reference in new issue
Block a user