Exemplo n.º 1
0
    def load_all_symbols(self):
        # Load all the XIP symbols attached to the Firmware Volume
        for (fv_base, fv_size) in self.platform.fvs:
            if self.firmware_volumes.has_key(fv_base) == False:
                self.firmware_volumes[
                    fv_base] = firmware_volume.FirmwareVolume(
                        self.ec, fv_base, fv_size)
            self.firmware_volumes[fv_base].load_all_symbols(self.verbose)

        try:
            # Load all symbols of module loaded into System Memory
            if self.system_table is None:
                # Find the System Table
                self.system_table = system_table.SystemTable(
                    self.ec, self.platform.sysmembase,
                    self.platform.sysmemsize)

                # Find the Debug Info Table
                debug_info_table_base = self.system_table.get_configuration_table(
                    system_table.DebugInfoTable.CONST_DEBUG_INFO_TABLE_GUID)
                self.debug_info_table = system_table.DebugInfoTable(
                    self.ec, debug_info_table_base)

            self.debug_info_table.load_all_symbols(self.verbose)
        except:
            # Debugger exception could be excepted if DRAM has not been initialized or if we have not started to run from DRAM yet
            print "Note: no symbols have been found in System Memory (possible cause: the UEFI permanent memory has been installed yet)"
Exemplo n.º 2
0
def dump_system_table(ec, mem_base, mem_size):
    st = system_table.SystemTable(ec, mem_base, mem_size)

    debug_info_table_base = st.get_configuration_table(system_table.DebugInfoTable.CONST_DEBUG_INFO_TABLE_GUID)

    debug_info_table = system_table.DebugInfoTable(ec, debug_info_table_base)
    debug_info_table.dump()
Exemplo n.º 3
0
    def load_current_symbols(self):
        pc = int(self.ec.getRegisterService().getValue('PC')) & 0xFFFFFFFF
        if self.in_fv(pc):
            debug_infos = []

            (fv_base, fv_size) = self.get_fv_at(pc)

            if self.firmware_volumes.has_key(fv_base) == False:
                self.firmware_volumes[
                    fv_base] = firmware_volume.FirmwareVolume(
                        self.ec, fv_base, fv_size)

            stack_frame = self.ec.getTopLevelStackFrame()
            info = self.firmware_volumes[fv_base].load_symbols_at(
                int(stack_frame.getRegisterService().getValue('PC'))
                & 0xFFFFFFFF, self.verbose)
            debug_infos.append(info)
            while stack_frame.next() is not None:
                stack_frame = stack_frame.next()

                # Stack frame attached to 'PC'
                pc = int(stack_frame.getRegisterService().getValue(
                    'PC')) & 0xFFFFFFFF

                # Check if the symbols for this stack frame have already been loaded
                found = False
                for debug_info in debug_infos:
                    if (pc >= debug_info[0]) and (
                            pc < debug_info[0] + debug_info[1]):
                        found = True
                if found == False:
                    info = self.firmware_volumes[fv_base].load_symbols_at(pc)
                    debug_infos.append(info)

            #self.firmware_volumes[fv_base].load_symbols_at(pc)
        elif self.in_sysmem(pc):
            debug_infos = []

            if self.system_table is None:
                # Find the System Table
                self.system_table = system_table.SystemTable(
                    self.ec, self.platform.sysmembase,
                    self.platform.sysmemsize)

                # Find the Debug Info Table
                debug_info_table_base = self.system_table.get_configuration_table(
                    system_table.DebugInfoTable.CONST_DEBUG_INFO_TABLE_GUID)
                self.debug_info_table = system_table.DebugInfoTable(
                    self.ec, debug_info_table_base)

            stack_frame = self.ec.getTopLevelStackFrame()
            info = self.debug_info_table.load_symbols_at(
                int(stack_frame.getRegisterService().getValue('PC'))
                & 0xFFFFFFFF, self.verbose)
            debug_infos.append(info)
            while stack_frame.next() is not None:
                stack_frame = stack_frame.next()

                # Stack frame attached to 'PC'
                pc = int(stack_frame.getRegisterService().getValue(
                    'PC')) & 0xFFFFFFFF

                # Check if the symbols for this stack frame have already been loaded
                found = False
                for debug_info in debug_infos:
                    if (pc >= debug_info[0]) and (
                            pc < debug_info[0] + debug_info[1]):
                        found = True
                if found == False:
                    try:
                        info = self.debug_info_table.load_symbols_at(pc)
                        debug_infos.append(info)
                    except:
                        pass

            #self.debug_info_table.load_symbols_at(pc)
        else:
            raise Exception('ArmPlatformDebugger', "Not supported region")