Make stacktrace_frame an aggregate again

This commit is contained in:
Jeremy 2023-09-19 15:36:34 -04:00
parent 799e7a7705
commit a31fe3dc00
No known key found for this signature in database
GPG Key ID: 19AA8270105E8EB4
5 changed files with 6 additions and 5 deletions

View File

@ -56,7 +56,7 @@ namespace cpptrace {
struct stacktrace_frame {
uintptr_t address;
std::uint_least32_t line;
std::uint_least32_t column = UINT_LEAST32_MAX; // UINT_LEAST32_MAX if not present
std::uint_least32_t column; // UINT_LEAST32_MAX if not present
std::string filename;
std::string symbol;
bool operator==(const stacktrace_frame& other) const {

View File

@ -267,7 +267,7 @@ namespace addr2line {
std::vector<stacktrace_frame> resolve_frames(const std::vector<object_frame>& frames) {
// TODO: Refactor better
std::vector<stacktrace_frame> trace(frames.size());
std::vector<stacktrace_frame> trace(frames.size(), stacktrace_frame { 0, 0, UINT_LEAST32_MAX, "", "" });
for(size_t i = 0; i < frames.size(); i++) {
trace[i].address = frames[i].raw_address;
// Set what is known for now, and resolutions from addr2line should overwrite

View File

@ -59,6 +59,7 @@ namespace libbacktrace {
// TODO: Handle backtrace_pcinfo calling the callback multiple times on inlined functions
stacktrace_frame resolve_frame(const uintptr_t addr) {
stacktrace_frame frame;
frame.column = UINT_LEAST32_MAX;
backtrace_pcinfo(
get_backtrace_state(),
addr,

View File

@ -1037,7 +1037,7 @@ namespace libdwarf {
CPPTRACE_FORCE_NO_INLINE_FOR_PROFILING
std::vector<stacktrace_frame> resolve_frames(const std::vector<object_frame>& frames) {
std::vector<stacktrace_frame> trace(frames.size());
std::vector<stacktrace_frame> trace(frames.size(), stacktrace_frame { 0, 0, UINT_LEAST32_MAX, "", "" });
for(const auto& obj_entry : collate_frames(frames, trace)) {
const auto& obj_name = obj_entry.first;
dwarf_resolver resolver(obj_name);

View File

@ -9,11 +9,11 @@ namespace cpptrace {
namespace detail {
namespace nothing {
std::vector<stacktrace_frame> resolve_frames(const std::vector<uintptr_t>& frames) {
return std::vector<stacktrace_frame>(frames.size());
return std::vector<stacktrace_frame>(frames.size(), stacktrace_frame { 0, 0, UINT_LEAST32_MAX, "", "" });
}
std::vector<stacktrace_frame> resolve_frames(const std::vector<object_frame>& frames) {
return std::vector<stacktrace_frame>(frames.size());
return std::vector<stacktrace_frame>(frames.size(), stacktrace_frame { 0, 0, UINT_LEAST32_MAX, "", "" });
}
}
}