Fix regexp expressions in sancov.py to work with old grep on Tizen
authorMaria Guseva <m.guseva@samsung.com>
Fri, 9 Jun 2017 09:47:36 +0000 (12:47 +0300)
committerMaria Guseva <m.guseva@samsung.com>
Tue, 11 Jul 2017 02:46:03 +0000 (11:46 +0900)
Grep is known to treat "\s" differently:
only in newer versions it is intrepreted as whitespace.
See http://savannah.gnu.org/bugs/?30515 for details

On Tizen the grep verions is 2.5.2 and "\s" is not yet supported as a special
symbol there.

scripts/sancov.py

index d1180fb7b75ecdbb126c49782491ba625d4a7d75..5c12aa6c293532bdc333d76b8d55e3799d9f185e 100755 (executable)
@@ -194,8 +194,8 @@ def GetInstrumentedPCs(binary):
   # - with call or callq,
   # - directly or via PLT.
   cmd = "objdump -d %s | " \
-        "grep '^\s\+[0-9a-f]\+:.*\scall\(q\|\)\s\+[0-9a-f]\+ <__sanitizer_cov\(_with_check\|\)\(_trace_pc\|\)\(@plt\|\)>' | " \
-        "grep '^\s\+[0-9a-f]\+' -o" % binary
+        "grep '^[[:space:]]\+[0-9a-f]\+:.*[[:space:]]call\(q\|\)[[:space:]]\+[0-9a-f]\+ <__sanitizer_cov\(_with_check\|\)\(_trace_pc\|\)\(@plt\|\)>' | " \
+        "grep '^[[:space:]]\+[0-9a-f]\+' -o" % binary
   proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
                           shell=True)
   proc.stdin.close()