Forgot to stage path max

This commit is contained in:
Jeremy 2023-11-19 22:52:20 -06:00
parent ac13e71877
commit 9647a6d591
No known key found for this signature in database
GPG Key ID: B4C8300FEC395042

View File

@ -174,6 +174,13 @@ namespace cpptrace {
CPPTRACE_EXPORT stacktrace generate_trace(std::size_t skip = 0);
CPPTRACE_EXPORT stacktrace generate_trace(std::size_t skip, std::size_t max_depth);
// Path max isn't so simple, so I'm choosing 4096 which seems to encompass what all major OS's expect and should be
// fine in all reasonable cases.
// https://eklitzke.org/path-max-is-tricky
// https://insanecoding.blogspot.com/2007/11/pathmax-simply-isnt.html
#define CPPTRACE_PATH_MAX 4096
// safe tracing interface
CPPTRACE_EXPORT std::size_t safe_generate_raw_trace(
frame_ptr* buffer,
std::size_t size,
@ -185,6 +192,14 @@ namespace cpptrace {
std::size_t skip,
std::size_t max_depth
);
struct CPPTRACE_EXPORT minimal_object_frame {
frame_ptr raw_address = 0;
frame_ptr address_relative_to_object_base_in_memory = 0;
char object_path[CPPTRACE_PATH_MAX + 1];
// To be called outside a signal handler. Not signal safe.
object_frame resolve() const;
};
CPPTRACE_EXPORT void get_minimal_object_frame(frame_ptr address, minimal_object_frame* out);
// utilities:
CPPTRACE_EXPORT std::string demangle(const std::string& name);