Exemplo n.º 1
0
 def __init__(self, obj):
     '''
     Private constructor, called by L{Symptom.fromJSONObject}. Do not use directly.
     '''
     Symptom.__init__(self, obj)
     self.address = NumberMatch(
         JSONHelper.getNumberOrStringChecked(obj, "address", True))
Exemplo n.º 2
0
    def __init__(self, obj):
        '''
        Private constructor, called by L{Symptom.fromJSONObject}. Do not use directly.
        '''
        Symptom.__init__(self, obj)
        self.functionName = StringMatch(JSONHelper.getNumberOrStringChecked(obj, "functionName", True))
        self.frameNumber = JSONHelper.getNumberOrStringChecked(obj, "frameNumber")

        if self.frameNumber != None:
            self.frameNumber = NumberMatch(self.frameNumber)
        else:
            # Default to 0
            self.frameNumber = NumberMatch(0)
Exemplo n.º 3
0
    def __init__(self, obj):
        '''
        Private constructor, called by L{Symptom.fromJSONObject}. Do not use directly.
        '''
        Symptom.__init__(self, obj)
        self.functionName = StringMatch(JSONHelper.getNumberOrStringChecked(obj, "functionName", True))        
        self.frameNumber = JSONHelper.getNumberOrStringChecked(obj, "frameNumber")

        if self.frameNumber != None:
            self.frameNumber = NumberMatch(self.frameNumber)
        else:
            # Default to 0
            self.frameNumber = NumberMatch(0)
Exemplo n.º 4
0
class StackFrameSymptom(Symptom):
    def __init__(self, obj):
        '''
        Private constructor, called by L{Symptom.fromJSONObject}. Do not use directly.
        '''
        Symptom.__init__(self, obj)
        self.functionName = StringMatch(
            JSONHelper.getNumberOrStringChecked(obj, "functionName", True))
        self.frameNumber = JSONHelper.getNumberOrStringChecked(
            obj, "frameNumber")

        if self.frameNumber is not None:
            self.frameNumber = NumberMatch(self.frameNumber)
        else:
            # Default to 0
            self.frameNumber = NumberMatch(0)

    def matches(self, crashInfo):
        '''
        Check if the symptom matches the given crash information

        @type crashInfo: CrashInfo
        @param crashInfo: The crash information to check against

        @rtype: bool
        @return: True if the symptom matches, False otherwise
        '''

        for idx in range(len(crashInfo.backtrace)):
            # Not the most efficient way for very long stacks with a small match area
            if self.frameNumber.matches(idx):
                if self.functionName.matches(crashInfo.backtrace[idx]):
                    return True

        return False
Exemplo n.º 5
0
class StackFrameSymptom(Symptom):
    def __init__(self, obj):
        '''
        Private constructor, called by L{Symptom.fromJSONObject}. Do not use directly.
        '''
        Symptom.__init__(self, obj)
        self.functionName = StringMatch(JSONHelper.getNumberOrStringChecked(obj, "functionName", True))        
        self.frameNumber = JSONHelper.getNumberOrStringChecked(obj, "frameNumber")

        if self.frameNumber != None:
            self.frameNumber = NumberMatch(self.frameNumber)
        else:
            # Default to 0
            self.frameNumber = NumberMatch(0)
    
    def matches(self, crashInfo):
        '''
        Check if the symptom matches the given crash information
        
        @type crashInfo: CrashInfo
        @param crashInfo: The crash information to check against 
        
        @rtype: bool
        @return: True if the symptom matches, False otherwise
        '''
        
        for idx in range(len(crashInfo.backtrace)):
            # Not the most efficient way for very long stacks with a small match area
            if self.frameNumber.matches(idx):
                if self.functionName.matches(crashInfo.backtrace[idx]):
                    return True
        
        return False
Exemplo n.º 6
0
class StackSizeSymptom(Symptom):
    def __init__(self, obj):
        '''
        Private constructor, called by L{Symptom.fromJSONObject}. Do not use directly.
        '''
        Symptom.__init__(self, obj)
        self.stackSize = NumberMatch(JSONHelper.getNumberOrStringChecked(obj, "size", True))

    def matches(self, crashInfo):
        '''
        Check if the symptom matches the given crash information

        @type crashInfo: CrashInfo
        @param crashInfo: The crash information to check against

        @rtype: bool
        @return: True if the symptom matches, False otherwise
        '''
        return self.stackSize.matches(len(crashInfo.backtrace))
Exemplo n.º 7
0
class StackSizeSymptom(Symptom):
    def __init__(self, obj):
        '''
        Private constructor, called by L{Symptom.fromJSONObject}. Do not use directly.
        '''
        Symptom.__init__(self, obj)
        self.stackSize = NumberMatch(JSONHelper.getNumberOrStringChecked(obj, "size", True))
    
    def matches(self, crashInfo):
        '''
        Check if the symptom matches the given crash information
        
        @type crashInfo: CrashInfo
        @param crashInfo: The crash information to check against 
        
        @rtype: bool
        @return: True if the symptom matches, False otherwise
        '''
        return self.stackSize.matches(len(crashInfo.backtrace))
Exemplo n.º 8
0
class CrashAddressSymptom(Symptom):
    def __init__(self, obj):
        '''
        Private constructor, called by L{Symptom.fromJSONObject}. Do not use directly.
        '''
        Symptom.__init__(self, obj)
        self.address = NumberMatch(JSONHelper.getNumberOrStringChecked(obj, "address", True))

    def matches(self, crashInfo):
        '''
        Check if the symptom matches the given crash information

        @type crashInfo: CrashInfo
        @param crashInfo: The crash information to check against

        @rtype: bool
        @return: True if the symptom matches, False otherwise
        '''
        # In case the crash address is not available,
        # the NumberMatch class will return false to not match.
        return self.address.matches(crashInfo.crashAddress)
Exemplo n.º 9
0
class CrashAddressSymptom(Symptom):
    def __init__(self, obj):
        '''
        Private constructor, called by L{Symptom.fromJSONObject}. Do not use directly.
        '''
        Symptom.__init__(self, obj)
        self.address = NumberMatch(JSONHelper.getNumberOrStringChecked(obj, "address", True))
    
    def matches(self, crashInfo):
        '''
        Check if the symptom matches the given crash information
        
        @type crashInfo: CrashInfo
        @param crashInfo: The crash information to check against 
        
        @rtype: bool
        @return: True if the symptom matches, False otherwise
        '''
        # In case the crash address is not available,
        # the NumberMatch class will return false to not match.
        return self.address.matches(crashInfo.crashAddress)
Exemplo n.º 10
0
 def __init__(self, obj):
     '''
     Private constructor, called by L{Symptom.fromJSONObject}. Do not use directly.
     '''
     Symptom.__init__(self, obj)
     self.address = NumberMatch(JSONHelper.getNumberOrStringChecked(obj, "address", True))