Commit b3eb8b66 by devttys0

Added display-once keyword

parent 64160326
...@@ -60,6 +60,7 @@ class Signature(object): ...@@ -60,6 +60,7 @@ class Signature(object):
Tag(name='string-len', keyword='string-len', type=str, handler='parse_string_len'), Tag(name='string-len', keyword='string-len', type=str, handler='parse_string_len'),
Tag(name='math', keyword='math', type=int, handler='parse_math'), Tag(name='math', keyword='math', type=int, handler='parse_math'),
Tag(name='one-of-many', keyword='one-of-many', handler='one_of_many'), Tag(name='one-of-many', keyword='one-of-many', handler='one_of_many'),
Tag(name='display-once', keyword='display-once', handler='display_once'),
Tag(name='jump', keyword='jump-to-offset', type=int), Tag(name='jump', keyword='jump-to-offset', type=int),
Tag(name='name', keyword='file-name', type=str), Tag(name='name', keyword='file-name', type=str),
...@@ -85,6 +86,7 @@ class Signature(object): ...@@ -85,6 +86,7 @@ class Signature(object):
''' '''
self.filter = filter self.filter = filter
self.last_one_of_many = None self.last_one_of_many = None
self.valid_once_already_seen = set()
self.ignore_smart_signatures = ignore_smart_signatures self.ignore_smart_signatures = ignore_smart_signatures
def parse(self, data): def parse(self, data):
...@@ -164,6 +166,26 @@ class Signature(object): ...@@ -164,6 +166,26 @@ class Signature(object):
data = data.replace('"' + quoted_string + '"', "") data = data.replace('"' + quoted_string + '"', "")
return data return data
def display_once(self, data, tag):
'''
Determines if a given data string should be printed if {display-once} was specified.
@data - String result data.
Returns False if the string result should not be displayed.
Returns True if the string result should be displayed.
'''
if self.filter.valid_result(data):
signature = data.split(',')[0]
if signature in self.valid_once_already_seen:
self.display = False
return (data, False)
else:
self.valid_once_already_seen.add(signature)
return (data, True)
return (data, True)
def one_of_many(self, data, tag): def one_of_many(self, data, tag):
''' '''
Determines if a given data string is one result of many. Determines if a given data string is one result of many.
......
...@@ -585,7 +585,7 @@ ...@@ -585,7 +585,7 @@
# Signatures to identify the start of a VxWorks symbol table # Signatures to identify the start of a VxWorks symbol table
8 string \x00\x00\x05\x00\x00\x00\x00\x00 VxWorks symbol table, big endian, 8 string \x00\x00\x05\x00\x00\x00\x00\x00 VxWorks symbol table, big endian,
>4 belong x first entry: [type: function, code address: 0x%X, >4 belong x first entry: [type: function, code address: 0x%X,
>0 belong x symbol address: 0x%X]{one-of-many} >0 belong x symbol address: 0x%X]{display-once}
>24 belong !0x500 >24 belong !0x500
>>24 belong !0x700 >>24 belong !0x700
>>>24 belong !0x900 \b, invalid >>>24 belong !0x900 \b, invalid
...@@ -601,7 +601,7 @@ ...@@ -601,7 +601,7 @@
8 string \x00\x00\x07\x00\x00\x00\x00\x00 VxWorks symbol table, big endian, 8 string \x00\x00\x07\x00\x00\x00\x00\x00 VxWorks symbol table, big endian,
>4 belong x first entry: [type: initialized data, code address: 0x%X, >4 belong x first entry: [type: initialized data, code address: 0x%X,
>0 belong x symbol address: 0x%X]{one-of-many} >0 belong x symbol address: 0x%X]{display-once}
>24 belong !0x500 >24 belong !0x500
>>24 belong !0x700 >>24 belong !0x700
>>>24 belong !0x900 \b, invalid >>>24 belong !0x900 \b, invalid
...@@ -617,7 +617,7 @@ ...@@ -617,7 +617,7 @@
8 string \x00\x00\x09\x00\x00\x00\x00\x00 VxWorks symbol table, big endian, 8 string \x00\x00\x09\x00\x00\x00\x00\x00 VxWorks symbol table, big endian,
>4 belong x first entry: [type: uninitialized data, code address: 0x%X, >4 belong x first entry: [type: uninitialized data, code address: 0x%X,
>0 belong x symbol address: 0x%X]{one-of-many} >0 belong x symbol address: 0x%X]{display-once}
>24 belong !0x500 >24 belong !0x500
>>24 belong !0x700 >>24 belong !0x700
>>>24 belong !0x900 \b, invalid >>>24 belong !0x900 \b, invalid
...@@ -633,7 +633,7 @@ ...@@ -633,7 +633,7 @@
8 string \x00\x05\x00\x00\x00\x00\x00\x00 VxWorks symbol table, little endian, 8 string \x00\x05\x00\x00\x00\x00\x00\x00 VxWorks symbol table, little endian,
>4 lelong x first entry: [type: function, code address: 0x%X, >4 lelong x first entry: [type: function, code address: 0x%X,
>0 lelong x symbol address: 0x%X]{one-of-many} >0 lelong x symbol address: 0x%X]{display-once}
>24 lelong !0x500 >24 lelong !0x500
>>24 lelong !0x700 >>24 lelong !0x700
>>>24 lelong !0x900 \b, invalid >>>24 lelong !0x900 \b, invalid
...@@ -649,7 +649,7 @@ ...@@ -649,7 +649,7 @@
8 string \x00\x07\x00\x00\x00\x00\x00\x00 VxWorks symbol table, little endian, 8 string \x00\x07\x00\x00\x00\x00\x00\x00 VxWorks symbol table, little endian,
>4 lelong x first entry: [type: initialized data, code address: 0x%X, >4 lelong x first entry: [type: initialized data, code address: 0x%X,
>0 lelong x symbol address: 0x%X]{one-of-many} >0 lelong x symbol address: 0x%X]{display-once}
>24 lelong !0x500 >24 lelong !0x500
>>24 lelong !0x700 >>24 lelong !0x700
>>>24 lelong !0x900 \b, invalid >>>24 lelong !0x900 \b, invalid
...@@ -665,7 +665,7 @@ ...@@ -665,7 +665,7 @@
8 string \x00\x09\x00\x00\x00\x00\x00\x00 VxWorks symbol table, little endian, 8 string \x00\x09\x00\x00\x00\x00\x00\x00 VxWorks symbol table, little endian,
>4 lelong x first entry: [type: uninitialized data, code address: 0x%X, >4 lelong x first entry: [type: uninitialized data, code address: 0x%X,
>0 lelong x symbol address: 0x%X]{one-of-many} >0 lelong x symbol address: 0x%X]{display-once}
>24 lelong !0x500 >24 lelong !0x500
>>24 lelong !0x700 >>24 lelong !0x700
>>>24 lelong !0x900 \b, invalid >>>24 lelong !0x900 \b, invalid
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment