When a struct is renamed in Ghidra, it needs to be handled as if the old struct was deleted, and a new one is created with the new name. When the ProgramChangeRecord for this gets caught in the following code snippet, there isn't an obvious way to figure out what struct was renamed. We need to figure out how to access this value so that we can call self._interface.struct_changed() with deleted=True and pass it the old struct.
|
elif changeType in typeEvents: |
|
try: |
|
struct = self._interface.structs['/'+newValue.name] |
|
# TODO: access old name indicate deletion |
|
#self._interface.struct_changed(Struct(None, None, None), deleted=True) |
|
self._interface.struct_changed(struct) |
|
except KeyError: |
|
pass |
|
|
|
try: |
|
enum = self._interface.enums['/'+newValue.name] |
|
#self._interface.enum_changed(Enum(None, None), deleted=True) |
|
self._interface.enum_changed(enum) |
|
except KeyError: |
|
pass |
When a struct is renamed in Ghidra, it needs to be handled as if the old struct was deleted, and a new one is created with the new name. When the
ProgramChangeRecordfor this gets caught in the following code snippet, there isn't an obvious way to figure out what struct was renamed. We need to figure out how to access this value so that we can callself._interface.struct_changed()withdeleted=Trueand pass it the old struct.libbs/libbs/decompilers/ghidra/hooks.py
Lines 54 to 68 in 33a0114