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

Backtrace: system::exename not correct if in PATH #3435

Open
ax3l opened this issue Jul 20, 2023 · 0 comments
Open

Backtrace: system::exename not correct if in PATH #3435

ax3l opened this issue Jul 20, 2023 · 0 comments
Labels

Comments

@ax3l
Copy link
Member

ax3l commented Jul 20, 2023

The system::exename in AMReX, which is used for Backtrace generation on most systems, is not correct if the executable was started because it was found in PATH.

have_eu_addr2line = file_exists("/usr/bin/eu-addr2line");
if (have_eu_addr2line) {
const pid_t pid = getpid();
// cmd = "/usr/bin/eu-addr2line -C -f -i --pretty-print -p "
eu_cmd = "/usr/bin/eu-addr2line -C -f -i -p "
+ std::to_string(pid);
}
}
std::string cmd;
{
have_addr2line = file_exists("/usr/bin/addr2line");
if (have_addr2line) {
cmd = "/usr/bin/addr2line -Cpfie " + amrex::system::exename;
}
}

This will result in errors of the kind

/usr/bin/addr2line: 'warpx': No such file

unless the tool eu-addr2line is found during backtrace generation.

Currently, using the more available addr2line tool, AMReX can only handle absolute paths or relative paths to the current working dir:

amrex/Src/Base/AMReX.cpp

Lines 357 to 361 in abc6696

if (argv[0][0] != '/') {
system::exename = FileSystem::CurrentPath();
system::exename += "/";
}
system::exename += argv[0];

@ax3l ax3l added the bug label Jul 20, 2023
@ax3l ax3l changed the title system::exename not correct if in PATH Backtrace: system::exename not correct if in PATH Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant