See title.
Discussed in #3006
Originally posted by saruman9 March 9, 2022
I have a type definition for example:
>>> old_t = [t for t in bv.types if "std::__cxx11::string" == '::'.join(t[0].name)][0]
>>> old_t
('std::__cxx11::string', <type: immutable:NamedTypeReferenceClass 'typedef std::__cxx11::string'>)
Yes, it's a cycle type (typedef std::__cxx11::string std::__cxx11::string;), but it's a example. I don't use get_type_by_name method, because it's don't work for C++ types.
I tried to change the type definition:
>>> t = [t for t in bv.types if "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >" == '::'.join(t[0].name)][0]
>>> t
('std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >', <type: immutable:StructureTypeClass 'class'>)
>>> new_t = NamedTypeReferenceType.create_from_type("std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >", type = t[1])
>>> new_t
<type: immutable:NamedTypeReferenceClass 'class std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >'>
>>> bv.define_type(old_t[1].type_id, "std::__cxx11::string", new_t)
'std::__cxx11::string'
But nothing happens. If I will undefine std::__cxx11::string using UI, than Binary Ninja will crash (segmentation fault).
How I can change a type definition using API?
See title.
Discussed in #3006
Originally posted by saruman9 March 9, 2022
I have a type definition for example:
Yes, it's a cycle type (
typedef std::__cxx11::string std::__cxx11::string;), but it's a example. I don't useget_type_by_namemethod, because it's don't work for C++ types.I tried to change the type definition:
But nothing happens. If I will undefine
std::__cxx11::stringusing UI, than Binary Ninja will crash (segmentation fault).How I can change a type definition using API?