예제 #1
0
    def exit(self):
        if self.name in PREFORMAT_ARGUMENTS:
            preformat = set(PREFORMAT_ARGUMENTS[self.name])
        else:
            preformat = set()

        # Data pointed by arguments may have changed during the syscall
        # e.g. uname() syscall
        for index, argument in enumerate(self.arguments):
            if index in preformat:
                # Don't lose preformatted arguments
                continue
            if argument.type and not argument.type.endswith("*"):
                continue
            argument.text = None

        self.result = self.process.getreg(RETURN_VALUE_REGISTER)

        if self.restype.endswith("*"):
            text = formatAddress(self.result)
        else:
            uresult = self.result
            self.result = ulong2long(self.result)
            if self.result < 0 and (-self.result) in errorcode:
                errcode = -self.result
                text = "%s %s (%s)" % (
                    self.result, errorcode[errcode], strerror(errcode))
            elif not(0 <= self.result <= 9):
                text = "%s (%s)" % (self.result, formatWordHex(uresult))
            else:
                text = str(self.result)
        self.result_text = text
        return text
예제 #2
0
    def exit(self):
        if self.name in PREFORMAT_ARGUMENTS:
            preformat = set(PREFORMAT_ARGUMENTS[self.name])
        else:
            preformat = set()

        # Data pointed by arguments may have changed during the syscall
        # eg. uname() syscall
        for index, argument in enumerate(self.arguments):
            if index in preformat:
                # Don't lose preformatted arguments
                continue
            if argument.type and not argument.type.endswith("*"):
                continue
            argument.text = None

        self.result = self.process.getreg(RETURN_VALUE_REGISTER)

        if self.restype.endswith("*"):
            text = formatAddress(self.result)
        else:
            uresult = self.result
            self.result = ulong2long(self.result)
            if self.result < 0:
                text = "%s %s (%s)" % (
                    self.result, errorcode[-self.result], strerror(-self.result))
            elif not(0 <= self.result <= 9):
                text = "%s (%s)" % (self.result, formatWordHex(uresult))
            else:
                text = str(self.result)
        self.result_text = text
        return text
예제 #3
0
    def exit(self):
        if self.name in PREFORMAT_ARGUMENTS:
            preformat = set(PREFORMAT_ARGUMENTS[self.name])
        else:
            preformat = set()

        # Data pointed by arguments may have changed during the syscall
        # eg. uname() syscall
        for index, argument in enumerate(self.arguments):
            if index in preformat:
                # Don't lose preformatted arguments
                continue
            if argument.type and not argument.type.endswith("*"):
                continue
            argument.text = None

        if CPU_ARM:
            regname = "r0"
        elif CPU_I386:
            regname = "eax"
        elif CPU_X86_64:
            regname = "rax"
        elif CPU_POWERPC:
            regname = "result"
        else:
            raise NotImplementedError()
        self.result = self.process.getreg(regname)

        if self.restype.endswith("*"):
            text = formatAddress(self.result)
        else:
            uresult = self.result
            self.result = ulong2long(self.result)
            if self.result < 0:
                text = "%s (%s)" % (
                    self.result, strerror(-self.result))
            elif not(0 <= self.result <= 9):
                text = "%s (%s)" % (self.result, formatWordHex(uresult))
            else:
                text = str(self.result)
        self.result_text = text
        return text
예제 #4
0
    def exit(self):
        if self.name in PREFORMAT_ARGUMENTS:
            preformat = set(PREFORMAT_ARGUMENTS[self.name])
        else:
            preformat = set()

        # Data pointed by arguments may have changed during the syscall
        # eg. uname() syscall
        for index, argument in enumerate(self.arguments):
            if index in preformat:
                # Don't lose preformatted arguments
                continue
            if argument.type and not argument.type.endswith("*"):
                continue
            argument.text = None

        if CPU_I386:
            regname = "eax"
        elif CPU_X86_64:
            regname = "rax"
        elif CPU_POWERPC:
            regname = "result"
        else:
            raise NotImplementedError()
        self.result = self.process.getreg(regname)

        if self.restype.endswith("*"):
            text = formatAddress(self.result)
        else:
            uresult = self.result
            self.result = ulong2long(self.result)
            if self.result < 0:
                text = "%s (%s)" % (self.result, strerror(-self.result))
            elif not (0 <= self.result <= 9):
                text = "%s (%s)" % (self.result, formatWordHex(uresult))
            else:
                text = str(self.result)
        self.result_text = text
        return text
예제 #5
0
    def formatExit(self, process):
        if CPU_I386:
            regname = "eax"
        elif CPU_X86_64:
            regname = "rax"
        elif CPU_PPC:
            regname = "result"
        else:
            raise NotImplementedError()
        self.result = process.getreg(regname)

        if self.restype.endswith("*"):
            text = formatAddress(self.result)
        else:
            uresult = self.result
            self.result = ulong2long(self.result)
            if self.result < 0:
                text = "%s (%s)" % (self.result, strerror(-self.result))
            elif not (0 <= self.result <= 9):
                text = "%s (%s)" % (self.result, formatWordHex(uresult))
            else:
                text = str(self.result)
        return text
예제 #6
0
    def formatExit(self, process):
        if CPU_I386:
            regname = "eax"
        elif CPU_X86_64:
            regname = "rax"
        elif CPU_PPC:
            regname = "result"
        else:
            raise NotImplementedError()
        self.result = process.getreg(regname)

        if self.restype.endswith("*"):
            text = formatAddress(self.result)
        else:
            uresult = self.result
            self.result = ulong2long(self.result)
            if self.result < 0:
                text = "%s (%s)" % (
                    self.result, strerror(-self.result))
            elif not(0 <= self.result <= 9):
                text = "%s (%s)" % (self.result, formatWordHex(uresult))
            else:
                text = str(self.result)
        return text