From 1584c0f2ae591eafe6b69a9d663dbff4d32beaff Mon Sep 17 00:00:00 2001 From: plafosse Date: Thu, 25 Aug 2016 00:22:43 +0100 Subject: adding gnu3 demangler apis --- python/__init__.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'python') diff --git a/python/__init__.py b/python/__init__.py index 26c8fb5d..f5a46798 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -4150,6 +4150,10 @@ class Type(object): def unknown_type(self, unknown_type): return Type(core.BNCreateUnknownType(unknown_type.handle)) + @classmethod + def unknown_type(self, s): + return Type(core.BNCreateUnknownType(s.handle)) + @classmethod def enumeration_type(self, arch, e, width = None): if width is None: @@ -10839,6 +10843,21 @@ def demangle_ms(arch, mangled_name): names.append(outName[i]) #core.BNFreeDemangledName(outName.value, outSize.value) return (Type(handle), names) + return (None, mangledName) + + +def demangle_gnu3(arch, mangledName): + handle = ctypes.POINTER(core.BNType)() + outName = ctypes.POINTER(ctypes.c_char_p)() + outSize = ctypes.c_ulonglong() + names = [] + if core.BNDemangleGNU3(arch.handle, mangledName, ctypes.byref(handle), ctypes.byref(outName), ctypes.byref(outSize)): + for i in xrange(outSize.value): + names.append(outName[i]) + #core.BNFreeDemangledName(outName.value, outSize.value) + if not handle: + return (None, names) + return (Type(handle), names) return (None, mangled_name) -- cgit v1.3.1