From: Krzysztof Jackiewicz Date: Mon, 13 Jun 2016 12:36:51 +0000 (+0200) Subject: Exclude main and std:: entries from gdb backtrace for clarity X-Git-Tag: security-manager_5.5_testing~26^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6d75ee0e14481bdb0c61b27daa40357abeaaaf2f;p=platform%2Fcore%2Ftest%2Fsecurity-tests.git Exclude main and std:: entries from gdb backtrace for clarity Change-Id: I235d129f5aa7bc840fca262ffc1df42026f5968d --- diff --git a/src/framework/src/gdbbacktrace.cpp b/src/framework/src/gdbbacktrace.cpp index 7443252a..44e00afe 100644 --- a/src/framework/src/gdbbacktrace.cpp +++ b/src/framework/src/gdbbacktrace.cpp @@ -43,7 +43,7 @@ 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-"); @@ -57,12 +57,13 @@ void printColor(const char *err, int errnoNumber = 0) 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;