namespace DPL {
namespace {
-const std::string FRAME_PATTERN_DPL("in DPL::Test");
+const char *FRAME_PATTERN = "in DPL::Test|in std::|in main";
const std::string FRAME_GDBBACKTRACE("in DPL::gdbbacktrace");
const std::string DEV_NULL("/dev/null");
const std::string TMP_FILE_PREFIX("/tmp/security-tests_gdbbacktrace-");
bool backtraceParseLine(const std::string &line, std::ostream &result, size_t lineNumber)
{
- if (line.find(FRAME_PATTERN_DPL, 0) != std::string::npos)
+ std::smatch m;
+ std::regex frame_expr(FRAME_PATTERN);
+ if (std::regex_search(line, m, frame_expr))
return false;
- std::smatch m;
std::regex expr("^#\\d+\\s+0x[0-9a-fA-F]+\\s+(.+)");
- if (!std::regex_search (line, m, expr))
+ if (!std::regex_search(line, m, expr))
return false;
result << "#" << std::left << std::setw(2) << lineNumber << " " << m[m.size()-1] << std::endl;