int addr2line_all(void** addrs, int length, std::string& output) {
    // turn the addresses into a space-separated string
    std::ostringstream out;
    for (int i = 0; i < length; i++) {
        out << " " << std::hex << std::setfill('0') << addrs[i];
    }
    std::string addrsStr = out.str();
    out.str("");

    // have addr2line map the address to the relevant line in the code
#if defined(__APPLE__)
    // Mac OS X

    // BUGFIX (JL) was "atos -o", but newer versions of atos include a 5-line informational
    // message at the beginning of the output, so must call atos using either "xcrun atos"
    // or "atos -d".
    out << "xcrun atos -o " << exceptions::getProgramNameForStackTrace() << addrsStr;
#elif defined(_WIN32)
    // Windows
    out << "addr2line.exe -f -C -s -p -e " << exceptions::getProgramNameForStackTrace() << addrsStr;
#else
    // Linux
    out << "addr2line -f -C -s -p -e " << exceptions::getProgramNameForStackTrace() << addrsStr;
#endif
    std::string command = out.str();
    //std::cout << command << endl; // JL testing
    int result = execAndCapture(command, output);
    //std::cout << "\n addr2line/atos returned:\n" << output << endl; // JL
    return result;
}
int addr2line_all(void** addrs, int length, std::string& output) {
    // turn the addresses into a space-separated string
    std::ostringstream out;
    for (int i = 0; i < length; i++) {
        out << " " << std::hex << std::setfill('0') << addrs[i];
    }
    std::string addrsStr = out.str();
    out.str("");

    // have addr2line map the address to the relent line in the code
#if defined(__APPLE__)
    // Mac OS X
    out << "atos -o " << exceptions::getProgramNameForStackTrace() << addrsStr;
#elif defined(_WIN32)
    // Windows
    // out << "start /min /B /wait cmd /C addr2line.exe -f -p -s -C -e " << exceptions::getProgramNameForStackTrace() << addrsStr;
    out << "addr2line.exe -f -p -s -C -e " << exceptions::getProgramNameForStackTrace() << addrsStr;
#else
    // Linux
    out << "addr2line -f -C -s -p -e " << exceptions::getProgramNameForStackTrace() << addrsStr;
#endif
    int result = execAndCapture(out.str(), output);
    return result;
}