Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual frame adjustement - Filename only #413

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/base_frame_symbol_lookup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "logger.hpp"

#include <absl/strings/str_cat.h>
#include <filesystem>

namespace ddprof {

Expand All @@ -35,8 +36,10 @@ BaseFrameSymbolLookup::insert_bin_symbol(pid_t pid, SymbolTable &symbol_table,
std::string exe_name;
bool const exe_found = dso_hdr.find_exe_name(pid, exe_name);
if (exe_found) {
const std::filesystem::path path(exe_name);
const std::string base_name = path.filename().string();
symbol_idx = symbol_table.size();
symbol_table.emplace_back(Symbol({}, {}, 0, exe_name));
symbol_table.emplace_back(Symbol({}, base_name, 0, exe_name));
_bin_map.insert({pid, symbol_idx});
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/dso_symbol_lookup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <absl/strings/str_format.h>
#include <algorithm>
#include <filesystem>

namespace ddprof {

Expand All @@ -25,7 +26,7 @@ Symbol symbol_from_dso(ElfAddress_t normalized_addr, const Dso &dso,
// address that means something for our user (addr)
std::string const dso_dbg_str = normalized_addr
? absl::StrFormat("[%#x:%s]", normalized_addr, addr_type)
: "";
: std::filesystem::path(dso.format_filename()).filename().string();
return {dso_dbg_str, dso_dbg_str, 0, dso.format_filename()};
}
} // namespace
Expand Down