'Define ad as an offset. If the value is an address to a
code location, an analysis will be done. ty should be in
[WORD, DWORD, QWORD], if not set the type at the address
ad is retrieved.
async_analysis and dont_analyze should be used internally ONLY.
returns True if ok'

def set_offset(self, ad, ty=None, async_analysis=True, dont_analyze=False):

    if (ty is None):
        ty = self.mem.get_type(ad)
        sz = self.mem.get_size(ad)
    else:
        sz = self.mem.get_size_from_type(ty)
    if ((ty == (-1)) or (ty < MEM_WORD) or (ty > MEM_QWORD)):
        return False
    s = self.__binary.get_section(ad)
    off = s.read_int(ad, sz)
    if (off is None):
        return False
    s = self.__binary.get_section(off)
    if (s is None):
        return False
    head = self.mem.get_head_addr(off)
    if (not self.mem.exists(head)):
        self.mem.add(off, 1, MEM_UNK)
    self.add_xref(ad, off)
    if (not self.__undefine(ad)):
        return False
    if (ty == MEM_WORD):
        self.mem.add(ad, sz, MEM_WOFFSET)
    elif (ty == MEM_DWORD):
        self.mem.add(ad, sz, MEM_DOFFSET)
    elif (ty == MEM_QWORD):
        self.mem.add(ad, sz, MEM_QOFFSET)
    if dont_analyze:
        return True
    if self.__analyzer.first_inst_are_code(off):
        if async_analysis:
            self.__analyzer.msg.put((off, self.__analyzer.has_prolog(off), False, True, self.__queue_wait))
            self.__queue_wait.get()
        else:
            self.__analyzer.analyze_flow(off, self.__analyzer.has_prolog(off), False, True)
    return True
