(self)
return mode
Retrieve the mode used by Unicorn for the current architecture.
Retrieve the mode used by Unicorn for the current architecture.
Retrieve the mode used by Unicorn for the current architecture .
def get_uc_mode(self):
        """
        Retrieve the mode used by Unicorn for the current architecture.
        """
        arch = pwndbg.arch.current
        mode = 0

        if arch == 'armcm':
            mode |= (U.UC_MODE_MCLASS | U.UC_MODE_THUMB) if (pwndbg.regs.xpsr & (1<<24)) else U.UC_MODE_MCLASS

        elif arch in ('arm', 'aarch64'):
            mode |= U.UC_MODE_THUMB if (pwndbg.regs.cpsr & (1<<5)) else U.UC_MODE_ARM

        elif arch == 'mips' and 'isa32r6' in gdb.newest_frame().architecture().name():
            mode |= U.UC_MODE_MIPS32R6

        else:
            mode |= {4:U.UC_MODE_32, 8:U.UC_MODE_64}[pwndbg.arch.ptrsize]

        if pwndbg.arch.endian == 'little':
            mode |= U.UC_MODE_LITTLE_ENDIAN
        else:
            mode |= U.UC_MODE_BIG_ENDIAN

        return mode
def get_uc_mode ( self ) : arch = pwndbg . arch . current mode = 0 if arch == 'armcm' : mode |= ( U . UC_MODE_MCLASS | U . UC_MODE_THUMB ) if ( pwndbg . regs . xpsr & ( 1 << 24 ) ) else U . UC_MODE_MCLASS elif arch in ( 'arm' , 'aarch64' ) : mode |= U . UC_MODE_THUMB if ( pwndbg . regs . cpsr & ( 1 << 5 ) ) else U . UC_MODE_ARM elif arch == 'mips' and 'isa32r6' in gdb . newest_frame ( ) . architecture ( ) . name ( ) : mode |= U . UC_MODE_MIPS32R6 else : mode |= { 4 : U . UC_MODE_32 , 8 : U . UC_MODE_64 } [ pwndbg . arch . ptrsize ] if pwndbg . arch . endian == 'little' : mode |= U . UC_MODE_LITTLE_ENDIAN else : mode |= U . UC_MODE_BIG_ENDIAN return mode