Beispiel #1
0
    def _resolve_var_addr(self, s, allregions, values):
        val = s
        split = s.split('.')
        trysymbol = False
        if '.'.join(split[:-1]) in allregions.iterkeys():
            val = self._resolve_region_relative(s, allregions)
            return val

        if values and s in values.iterkeys():
            val = values[s]
            return val
        if config.Main.stage_from_name(split[0]):
            stage = config.Main.stage_from_name(split[0])
            if len(split) > 1:
                attr = split[1]
                val = getattr(stage, attr, val)
                return val
        if s.startswith('.'):
            end = '.end'
            start = '.start'
            if s.endswith(end):
                (start, val) = utils.get_section_location(re.sub(end, '', s), self.stage)
            elif s.endswith(start):
                (val, end) = utils.get_section_location(re.sub(start, '', s), self.stage)
            if type(val) == int and val < 0:
                val = s
            return val
        if not s.startswith('0x'):
            val = utils.get_symbol_location(s, self.stage)
            if val < 0:
                val = s
            return val
        else:
            val = int(s, 16)
        return val
 def __init__(self, fnname, substagenum, controller, stage):
     self.fnname = fnname
     self.substagenum = substagenum
     self.controller = controller
     self.fnloc = utils.get_symbol_location(fnname, stage)
     if self.fnloc < 0:
         raise Exception("not such function named %s, cannot be a substage entrypoint" % fnname)
     if self.fnloc:
         spec = "*(0x%x)" % self.fnloc
     else:
         spec = fnname
     TargetBreak.__init__(self, spec, controller, True, stage)