diff --git a/compiler-rt/lib/sanitizer_common/scripts/sancov.py b/compiler-rt/lib/sanitizer_common/scripts/sancov.py --- a/compiler-rt/lib/sanitizer_common/scripts/sancov.py +++ b/compiler-rt/lib/sanitizer_common/scripts/sancov.py @@ -193,16 +193,14 @@ # - __sanitizer_cov() or __sanitizer_cov_with_check(), # - 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_guard\)\(@plt\|\)>' | " \ - "grep '^\s\+[0-9a-f]\+' -o" % binary - proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, - shell=True) - proc.stdin.close() + cmd = r"objdump --no-show-raw-insn -d %s | " \ + r"grep '^\s\+[0-9a-f]\+:\s\+call\(q\|\)\s\+\(0x\|\)[0-9a-f]\+ <__sanitizer_cov\(_with_check\|\|_trace_pc_guard\)\(@plt\|\)>' | " \ + r"grep -o '^\s\+[0-9a-f]\+'" % binary + lines = subprocess.check_output(cmd, stdin=subprocess.PIPE, shell=True).splitlines() # The PCs we get from objdump are off by 4 bytes, as they point to the # beginning of the callq instruction. Empirically this is true on x86 and # x86_64. - return set(int(line.strip(), 16) + 4 for line in proc.stdout) + return set(int(line.strip(), 16) + 4 for line in lines) def PrintMissing(binary): if not os.path.isfile(binary):