(self, mmap_info, code_map, options)
| 718 | |
| 719 | |
| 720 | def Load(self, mmap_info, code_map, options): |
| 721 | # Skip kernel mmaps when requested using the fact that their tid |
| 722 | # is 0. |
| 723 | if mmap_info.tid == 0 and not options.kernel: |
| 724 | return True |
| 725 | if OBJDUMP_SKIP_RE.match(mmap_info.filename): |
| 726 | return True |
| 727 | if PERF_KERNEL_ALLSYMS_RE.match(mmap_info.filename): |
| 728 | return self._LoadKernelSymbols(code_map) |
| 729 | self.infos.append(mmap_info) |
| 730 | mmap_info.ticks = 0 |
| 731 | mmap_info.unique_name = self._UniqueMmapName(mmap_info) |
| 732 | if not os.path.exists(mmap_info.filename): |
| 733 | return True |
| 734 | # Request section headers (-h), symbols (-t), and dynamic symbols |
| 735 | # (-T) from objdump. |
| 736 | # Unfortunately, section headers span two lines, so we have to |
| 737 | # keep the just seen section name (from the first line in each |
| 738 | # section header) in the after_section variable. |
| 739 | if self.HasDynamicSymbols(mmap_info.filename): |
| 740 | dynamic_symbols = "-T" |
| 741 | else: |
| 742 | dynamic_symbols = "" |
| 743 | process = subprocess.Popen( |
| 744 | "%s -h -t %s -C %s" % (OBJDUMP_BIN, dynamic_symbols, mmap_info.filename), |
| 745 | shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
| 746 | pipe = process.stdout |
| 747 | after_section = None |
| 748 | code_sections = set() |
| 749 | reloc_sections = set() |
| 750 | dynamic = False |
| 751 | try: |
| 752 | for line in pipe: |
| 753 | line = line.decode() |
| 754 | if after_section: |
| 755 | if line.find("CODE") != -1: |
| 756 | code_sections.add(after_section) |
| 757 | if line.find("RELOC") != -1: |
| 758 | reloc_sections.add(after_section) |
| 759 | after_section = None |
| 760 | continue |
| 761 | |
| 762 | match = OBJDUMP_SECTION_HEADER_RE.match(line) |
| 763 | if match: |
| 764 | after_section = match.group(1) |
| 765 | continue |
| 766 | |
| 767 | if OBJDUMP_DYNAMIC_SYMBOLS_START_RE.match(line): |
| 768 | dynamic = True |
| 769 | continue |
| 770 | |
| 771 | match = OBJDUMP_SYMBOL_LINE_RE.match(line) |
| 772 | if match: |
| 773 | start_address = int(match.group(1), 16) |
| 774 | origin_offset = start_address |
| 775 | flags = match.group(2) |
| 776 | section = match.group(3) |
| 777 | if section in code_sections: |
no test coverage detected