Exemplo n.º 1
0
    def calculate_annotations(self, frames):
        """
        Create annotations using the frame list.
        @param frames: a list of stackframes
        @return a dict of stack address -> (value, annotation)
        """
        size = linux_process_info.address_size
        end = frames[-1].address
        start = frames[0].ebp_address
        l = linux_process_info.read_int_list(start, end, frames[0].proc_as)
        result = {}
        offset = start
        for value in l:
            result[offset] = (value, "")
            offset += size

        for frame in frames[::-1]:
            result[frame.ebp_address] = (frame.ebp, "")
            # print(frame)
            annotation = "return address"
            if frame.function:
                annotation += " for {:016x}".format(frame.function)
            if frame.symbol:
                annotation += " ( {} )".format(frame.symbol)

            result[frame.ret_address] = (frame.ret, annotation)
        return result
Exemplo n.º 2
0
 def get_locals(self):
     start = self.locals_end - linux_process_info.address_size
     end = self.ret_address - linux_process_info.address_size
     return linux_process_info.read_int_list(start, end, self.proc_as)