Handle empty addr2line input

This commit is contained in:
Jeremy 2023-08-27 20:54:34 -04:00
parent 0977253505
commit fb258f0671
No known key found for this signature in database
GPG Key ID: 19AA8270105E8EB4

View File

@ -425,6 +425,13 @@ namespace cpptrace {
for(const auto& entry : entries) {
const auto& object_name = entry.first;
const auto& entries_vec = entry.second;
// You may ask why it'd ever happen that there could be an empty entries_vec array, if there're
// no addresses why would get_addr2line_targets do anything? The reason is because if things in
// get_addr2line_targets fail it will silently skip. This is partly an optimization but also an
// assertion below will fail if addr2line is given an empty input.
if(entries_vec.empty()) {
continue;
}
std::string address_input;
for(const auto& pair : entries_vec) {
address_input += pair.first;