diff options
Diffstat (limited to 'view/sharedcache/api/python')
| -rw-r--r-- | view/sharedcache/api/python/generator.cpp | 18 | ||||
| -rw-r--r-- | view/sharedcache/api/python/sharedcache.py | 3 | ||||
| -rw-r--r-- | view/sharedcache/api/python/sharedcache_enums.py | 7 |
3 files changed, 27 insertions, 1 deletions
diff --git a/view/sharedcache/api/python/generator.cpp b/view/sharedcache/api/python/generator.cpp index 81463b51..062f2e27 100644 --- a/view/sharedcache/api/python/generator.cpp +++ b/view/sharedcache/api/python/generator.cpp @@ -331,7 +331,23 @@ int main(int argc, char* argv[]) continue; } - fprintf(out, "%sEnum = ctypes.c_int\n", name.c_str()); + const char* ctypesType = nullptr; + switch (i.second->GetWidth()) + { + case 1: + ctypesType = i.second->IsSigned() ? "ctypes.c_int8" : "ctypes.c_uint8"; + break; + case 2: + ctypesType = i.second->IsSigned() ? "ctypes.c_int16" : "ctypes.c_uint16"; + break; + case 4: + ctypesType = i.second->IsSigned() ? "ctypes.c_int32" : "ctypes.c_uint32"; + break; + default: + ctypesType = i.second->IsSigned() ? "ctypes.c_int64" : "ctypes.c_uint64"; + break; + } + fprintf(out, "%sEnum = %s\n", name.c_str(), ctypesType); fprintf(enums, "\n\nclass %s(enum.IntEnum):\n", name.c_str()); for (auto& j : i.second->GetEnumeration()->GetMembers()) diff --git a/view/sharedcache/api/python/sharedcache.py b/view/sharedcache/api/python/sharedcache.py index dff9bcc3..cac4050e 100644 --- a/view/sharedcache/api/python/sharedcache.py +++ b/view/sharedcache/api/python/sharedcache.py @@ -40,6 +40,7 @@ class CacheImage: @dataclasses.dataclass class CacheSymbol: symbol_type: sccore.SymbolTypeEnum + symbol_binding: sccore.SymbolBindingEnum address: int name: str @@ -94,6 +95,7 @@ def image_to_api(image: CacheImage) -> sccore.BNSharedCacheImage: def symbol_from_api(symbol: sccore.BNSharedCacheSymbol) -> CacheSymbol: return CacheSymbol( symbol_type=symbol.symbolType, + symbol_binding=symbol.symbolBinding, address=symbol.address, name=symbol.name ) @@ -101,6 +103,7 @@ def symbol_from_api(symbol: sccore.BNSharedCacheSymbol) -> CacheSymbol: def symbol_to_api(symbol: CacheSymbol) -> sccore.BNSharedCacheSymbol: return sccore.BNSharedCacheSymbol( symbolType=symbol.symbol_type, + symbolBinding=symbol.symbol_binding, address=symbol.address, _name=BNAllocString(symbol.name) ) diff --git a/view/sharedcache/api/python/sharedcache_enums.py b/view/sharedcache/api/python/sharedcache_enums.py index 9a98eba4..d772adda 100644 --- a/view/sharedcache/api/python/sharedcache_enums.py +++ b/view/sharedcache/api/python/sharedcache_enums.py @@ -26,6 +26,13 @@ class SharedCacheRegionType(enum.IntEnum): SharedCacheRegionTypeNonImage = 3 +class SymbolBinding(enum.IntEnum): + NoBinding = 0 + LocalBinding = 1 + GlobalBinding = 2 + WeakBinding = 3 + + class SymbolType(enum.IntEnum): FunctionSymbol = 0 ImportAddressSymbol = 1 |
