Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _select_segment(self, requested_position):
"""
"""
# check if we have semgnet for requested address in cache
for memory_segment in self.memory_segments:
if memory_segment.inrange(requested_position):
self.current_segment = memory_segment
self.current_position = requested_position
return
# not in cache, check if it's present in memory space. if yes then create a new buffered memeory object, and copy data
for memory_segment in self.reader.memory_segments:
if memory_segment.inrange(requested_position):
newsegment = MinidumpBufferedMemorySegment(memory_segment, self.reader.file_handle)
self.memory_segments.append(newsegment)
self.current_segment = newsegment
self.current_position = requested_position
return
raise Exception('Memory address 0x%08x is not in process memory space' % requested_position)