Skip to content

Commit 818ac70

Browse files
authored
[HWASan] Compatible with Windows path retrieval (#172194)
Fix #134853 Since the Windows path separator is typically `\\`, Here, we use `pathlib` to ensure that the separator is in Unix format. Additionally, since the file itself specifies the use of python3 (pathlib requires python3), some python2 code has been removed.
1 parent e9b1f56 commit 818ac70

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

compiler-rt/lib/hwasan/scripts/hwasan_symbolize

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,12 @@ import html
2121
import json
2222
import mmap
2323
import os
24+
import pathlib
2425
import re
2526
import struct
2627
import subprocess
2728
import sys
2829

29-
if sys.version_info.major < 3:
30-
# Simulate Python 3.x behaviour of defaulting to UTF-8 for print. This is
31-
# important in case any symbols are non-ASCII.
32-
import codecs
33-
sys.stdout = codecs.getwriter("utf-8")(sys.stdout)
34-
3530
# Below, a parser for a subset of ELF. It only supports 64 bit, little-endian,
3631
# and only parses what is necessary to find the build ids. It uses a memoryview
3732
# into an mmap to avoid copying.
@@ -476,7 +471,7 @@ def main():
476471
# Source location.
477472
paths_to_cut = args.source or []
478473
if not paths_to_cut:
479-
paths_to_cut.append(os.getcwd() + '/')
474+
paths_to_cut.append(pathlib.Path.cwd().as_posix() + '/')
480475
if 'ANDROID_BUILD_TOP' in os.environ:
481476
paths_to_cut.append(os.environ['ANDROID_BUILD_TOP'] + '/')
482477

0 commit comments

Comments
 (0)