Ghidra: How to retype global?

Created on 24 Apr 2019  路  3Comments  路  Source: NationalSecurityAgency/ghidra

I am looking at the following memory layout:

2019-04-24 14_19_41-CodeBrowser_ ISI-5679__e03063ff5cbd787129a1c3bd34ec6f88dbb8a5c06073e7fb4ff1d8f60

... and I know that GLOBAL_STRING is an std::string. I created the following structure:

2019-04-24 14_19_02-Structure Editor - std_string (e03063ff5cbd787129a1c3bd34ec6f88dbb8a5c06073e7fb4

But retyping the global GLOBAL_STRING to std_string yields the following error message:

2019-04-24 14_19_29-Retype Failed

I assume this is because Ghidra has recorded references to the capacity and size field as well and is unwilling to remove these labels. I found no way to manually remove them, what is the proper way to do this?

Question

Most helpful comment

Just clear any data types that are already defined in the memory locations covered by the structure. Ghidra won't clear data out unless they are UNDEFINEDxx data types.

The references don't matter.

All 3 comments

Just clear any data types that are already defined in the memory locations covered by the structure. Ghidra won't clear data out unless they are UNDEFINEDxx data types.

The references don't matter.

Ah, thank you so much. That worked flawlessly.

Also, if you select the correct number of bytes, then you can apply the desired type

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Barakat picture Barakat  路  3Comments

awsaba picture awsaba  路  3Comments

ghost picture ghost  路  3Comments

pd0wm picture pd0wm  路  3Comments

marcushall42 picture marcushall42  路  3Comments