Esempio n. 1
0
def get_chain(value, limit=config.deref_limit):
    count = 0
    stop = False
    result = [value]

    if not idaapi.is_loaded(value):
        return result, False

    next_val = dbg.get_ptr(value)
    while not stop and count < limit:
        if result.count(next_val) >= 2 or not idaapi.is_loaded(next_val):
            stop = True
            continue

        result.append(next_val)
        next_val = dbg.get_ptr(next_val)
        count += 1

    exceeded = not stop
    return result, exceeded
Esempio n. 2
0
    def reload_info(self):
        if not dbg.is_process_suspended():
            return False

        base_addr = None
        if self.base_expr is None:
            base_addr = idc.get_reg_value(dbg.registers.stack)
        else:
            base_addr = idaapi.str2ea(self.base_expr)
            if base_addr == idc.BADADDR:
                idaapi.warning("Invalid base expr: %s" % self.base_expr)
                return False

            if not idaapi.is_loaded(base_addr):
                idaapi.warning("Memory address is not loaded: $#x" % base_addr)
                return False

        self.ClearLines()
        dbg.set_thread_info()

        try:
            segm_end = idc.get_segm_end(base_addr)
            n_entries = config.n_stack_entries or ((segm_end - base_addr) //
                                                   dbg.ptr_size)

            for i in range(n_entries):
                offset = i * dbg.ptr_size
                ptr = base_addr + offset

                if not idaapi.is_loaded(ptr):
                    break

                value = dbg.get_ptr(ptr)
                self.add_line("%02d:%04X  %s" %
                              (i, offset, self.parse_value(ptr)))

        except Exception as e:
            idaapi.warning(str(e))
            return False
        return True
Esempio n. 3
0
 def get_ptr_value(self, v):
     ptr_val = dbg.get_ptr(v.value)
     cval = ChainValue(v.level + 1, ptr_val, T_VALUE)
     return self.as_ptr(cval) + self.get_printable(cval.value)