Get the section containing the given address.
(self, rva)
| 6038 | return None |
| 6039 | |
| 6040 | def get_section_by_rva(self, rva): |
| 6041 | """Get the section containing the given address.""" |
| 6042 | |
| 6043 | # if we look a lot of times at RVA in the same section, "cache" the last used section |
| 6044 | # to speedup lookups (very useful when parsing import table) |
| 6045 | if self._get_section_by_rva_last_used is not None: |
| 6046 | if self._get_section_by_rva_last_used.contains_rva(rva): |
| 6047 | return self._get_section_by_rva_last_used |
| 6048 | |
| 6049 | for section in self.sections: |
| 6050 | if section.contains_rva(rva): |
| 6051 | self._get_section_by_rva_last_used = section |
| 6052 | return section |
| 6053 | |
| 6054 | return None |
| 6055 | |
| 6056 | def __str__(self): |
| 6057 | return self.dump_info() |
no test coverage detected