diff options
author | Florian Mayer <fmayer@google.com> | 2022-04-12 16:25:40 -0700 |
---|---|---|
committer | Florian Mayer <fmayer@google.com> | 2022-04-13 19:09:04 -0700 |
commit | ffd656a2fe5da8c3ad50fe353bcadeae009f0eb4 (patch) | |
tree | 69865e4df52119e0032a5aec42732b98da6b82f3 | |
parent | a73f7ababb4b2de65c6e2cdd832fc1f8c21207cf (diff) | |
download | llvm-ffd656a2fe5da8c3ad50fe353bcadeae009f0eb4.zip llvm-ffd656a2fe5da8c3ad50fe353bcadeae009f0eb4.tar.gz llvm-ffd656a2fe5da8c3ad50fe353bcadeae009f0eb4.tar.bz2 |
[HWASan] symbolize: use buildid index for locals.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D123644
-rwxr-xr-x | compiler-rt/lib/hwasan/scripts/hwasan_symbolize | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/compiler-rt/lib/hwasan/scripts/hwasan_symbolize b/compiler-rt/lib/hwasan/scripts/hwasan_symbolize index 3aba187..cb22ac6 100755 --- a/compiler-rt/lib/hwasan/scripts/hwasan_symbolize +++ b/compiler-rt/lib/hwasan/scripts/hwasan_symbolize @@ -146,7 +146,7 @@ class Symbolizer: file_name = re.sub(".*crtstuff.c:0", "???:0", file_name) return file_name - def __process_binary_name(self, name, buildid=None): + def __process_binary_name(self, name, buildid): if name.startswith('/'): name = name[1:] if buildid is not None and buildid in self.__index: @@ -171,10 +171,10 @@ class Symbolizer: self.__warnings.add(name) return None - def iter_locals(self, binary, addr): + def iter_locals(self, binary, addr, buildid): self.__open_pipe() p = self.__pipe - binary = self.__process_binary_name(binary) + binary = self.__process_binary_name(binary, buildid) if not binary: return self.__write("FRAME %s %s" % (binary, addr)) @@ -219,8 +219,9 @@ class Symbolizer: self.__index[bid] = filename def symbolize_line(line, symbolizer_path): - #0 0x7f6e35cf2e45 (/blah/foo.so+0x11fe45) - match = re.match(r'^(.*?)#([0-9]+)( *)(0x[0-9a-f]*) *\((.*)\+(0x[0-9a-f]+)\)(?:\s*\(BuildId: ([0-9a-f]+)\))?', line, re.UNICODE) + #0 0x7f6e35cf2e45 (/blah/foo.so+0x11fe45) (BuildId: 4abce4cd41ea5c2f34753297b7e774d9) + match = re.match(r'^(.*?)#([0-9]+)( *)(0x[0-9a-f]*) *\((.*)\+(0x[0-9a-f]+)\)' + r'(?:\s*\(BuildId: ([0-9a-f]+)\))?', line, re.UNICODE) if match: frameno = match.group(2) binary = match.group(5) @@ -257,18 +258,20 @@ def process_stack_history(line, symbolizer, ignore_tags=False): return True pc_mask = (1 << 48) - 1 fp_mask = (1 << 20) - 1 - # record_addr:0x1234ABCD record:0x1234ABCD (/path/to/binary+0x1234ABCD) - match = re.match(r'^(.*?)record_addr:(0x[0-9a-f]+) +record:(0x[0-9a-f]+) +\((.*)\+(0x[0-9a-f]+)\)', line, re.UNICODE) + # record_addr:0x1234ABCD record:0x1234ABCD (/path/to/binary+0x1234ABCD) (BuildId: 4abce4cd41ea5c2f34753297b7e774d9) + match = re.match(r'^(.*?)record_addr:(0x[0-9a-f]+) +record:(0x[0-9a-f]+) +\((.*)\+(0x[0-9a-f]+)\)' + r'(?:\s*\(BuildId: ([0-9a-f]+)\))?', line, re.UNICODE) if match: record_addr = int(match.group(2), 16) record = int(match.group(3), 16) binary = match.group(4) addr = int(match.group(5), 16) + buildid = match.group(6) base_tag = (record_addr >> 3) & 0xFF fp = (record >> 48) << 4 pc = record & pc_mask - for local in symbolizer.iter_locals(binary, addr): + for local in symbolizer.iter_locals(binary, addr, buildid): frame_offset = local[3] size = local[4] if frame_offset is None or size is None: |