diff --git i/Boss/Main.cpp w/Boss/Main.cpp index ff9bf8f..41dc6d5 100644 --- i/Boss/Main.cpp +++ w/Boss/Main.cpp @@ -17,12 +17,14 @@ #include #ifdef HAVE_CONFIG_H # include "config.h" #endif +const char* g_argv0{"unknown"}; + namespace Boss { class Main::Impl { private: std::istream& cin; std::ostream& cout; @@ -59,12 +61,13 @@ public: , exit_code(0) , is_version(false) , is_help(false) { assert(argv.size() >= 1); argv0 = argv[0]; + g_argv0 = argv0.c_str(); if (argv.size() >= 2) { auto argv1 = argv[1]; if (argv1 == "--version" || argv1 == "-V") is_version = true; else if (argv1 == "--debugger") { auto os = std::ostringstream(); diff --git i/Util/BacktraceException.hpp w/Util/BacktraceException.hpp index 313efb8..8d022e8 100644 --- i/Util/BacktraceException.hpp +++ w/Util/BacktraceException.hpp @@ -6,12 +6,14 @@ #include #include #include #include #include +extern const char* g_argv0; + namespace Util { /** class Util::BacktraceException * * @brief A wrapper for an exception E which additionally stores a * backtrace when it is constructed. The backtrace formatting is @@ -77,13 +79,13 @@ private: // Unfortunately there is no simple way to get a high quality // backtrace using in-process libraries. Instead for now we // popen an addr2line process and use it's output. std::string addr2line(void* addr) const { char cmd[512]; snprintf(cmd, sizeof(cmd), - "addr2line -C -f -p -e %s %p", program_invocation_name, addr); + "addr2line -C -f -p -e %s %p", g_argv0, addr); std::array buffer; std::string result; std::unique_ptr pipe(popen(cmd, "r")); if (!pipe) {