Skip to content

Commit

Permalink
fix: remove basename (#4343)
Browse files Browse the repository at this point in the history
close #4342
  • Loading branch information
SchrodingerZhu authored Mar 18, 2022
1 parent f48d803 commit 358d528
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions libs/libdaemon/src/BaseDaemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,16 @@ class SignalListener : public Poco::Runnable

if (sym_info.object_name)
{
output << " [" << ::basename(sym_info.object_name) << "+" << sym_info.svma << "]";
std::string_view view(sym_info.object_name);
auto pos = view.rfind('/');
if (pos != std::string_view::npos)
{
output << " [" << view.substr(pos + 1) << "+" << sym_info.svma << "]";
}
else
{
output << " [" << view << "+" << sym_info.svma << "]";
}
}

if (sym_info.source_filename)
Expand All @@ -604,11 +613,11 @@ class SignalListener : public Poco::Runnable
std::string_view view(sym_info.source_filename, sym_info.source_filename_length);
if (view.find(TIFLASH_SOURCE_PREFIX) != std::string_view::npos)
{
output << address << "\t" << view.substr(prefix_size) << ":" << sym_info.lineno << "";
output << address << "\t" << view.substr(prefix_size) << ":" << sym_info.lineno;
}
else
{
output << address << "\t" << view << ":" << sym_info.lineno << "";
output << address << "\t" << view << ":" << sym_info.lineno;
}
}
}
Expand Down

0 comments on commit 358d528

Please sign in to comment.