summaryrefslogtreecommitdiff
path: root/python/binaryview.py
diff options
context:
space:
mode:
authorBrian Potchik <brian@vector35.com>2021-04-06 11:13:51 -0400
committerBrian Potchik <brian@vector35.com>2021-04-06 11:13:51 -0400
commitccc46ee23e8160231b1de739380bd7d808ec433d (patch)
tree3208f74e38691890aa6d5a77b3448df86021c8cf /python/binaryview.py
parent1f70e7091d198662ddebcd2398f0e0c1b2ecff24 (diff)
Add support for duplicate symbol handling.
Diffstat (limited to 'python/binaryview.py')
-rw-r--r--python/binaryview.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index 85fcd353..1fde4bcd 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -27,7 +27,7 @@ import numbers
import json
import inspect
-from collections import OrderedDict
+from collections import defaultdict, OrderedDict
# Binary Ninja components
from binaryninja import _binaryninjacore as core
@@ -1912,13 +1912,10 @@ class BinaryView(object):
"""Dict of symbols (read-only)"""
count = ctypes.c_ulonglong(0)
syms = core.BNGetSymbols(self.handle, count, None)
- result = {}
+ result = defaultdict(list)
for i in range(0, count.value):
sym = types.Symbol(None, None, None, handle=core.BNNewSymbolReference(syms[i]))
- if sym.raw_name in result:
- result[sym.raw_name] = [result[sym.raw_name], sym]
- else:
- result[sym.raw_name] = sym
+ result[sym.raw_name].append(sym)
core.BNFreeSymbolList(syms, count.value)
return result
@@ -3875,7 +3872,7 @@ class BinaryView(object):
:Example:
>>> bv.get_symbols(0x1000200c, 1)
- [<ImportAddressSymbol: "KERNEL32!IsProcessorFeaturePresent@IAT" @ 0x1000200c>]
+ [<ImportAddressSymbol: "KERNEL32!IsProcessorFeaturePresent" @ 0x1000200c>]
>>>
"""
count = ctypes.c_ulonglong(0)
@@ -3906,7 +3903,7 @@ class BinaryView(object):
:Example:
>>> bv.get_symbols_of_type(SymbolType.ImportAddressSymbol, 0x10002028, 1)
- [<ImportAddressSymbol: "KERNEL32!GetCurrentThreadId@IAT" @ 0x10002028>]
+ [<ImportAddressSymbol: "KERNEL32!GetCurrentThreadId" @ 0x10002028>]
>>>
"""
if isinstance(sym_type, str):