ghidra
ghidra copied to clipboard
Converting a namespace into a class causes a low-level decopiler error
Describe the bug Turning a namespace into a class causes low-level errors.
Low-level Error: Unable to resolve type: Radio
To Reproduce Steps to reproduce the behavior:
- Analyze this file:
LEGO1.DLL - Go to
0x1002c8e0 - Create a funtion (press f in listing)
- change calling convention to
__thiscall - Rename to Radio::GetClassName
- Click in Symbol Tree on Namespaces -> R -> Radio
- Right click and choose 'Convert to Class'
Expected behavior
A class Radio is created, and the this parameter of the just-tagged function becomes Radio *.
Screenshots No screenshot for you, but the text in the decompile window is:
Low-level Error: Unable to resolve type: Radio
Attachments If applicable, please attach any files that caused problems or log files generated by the software.
Environment (please complete the following information):
- OS: Fedora 38
- Java Version: OpenJDK 20.0.1
- Ghidra Version: 10.3.1
- Ghidra Origin: official GitHub distro
Additional context That's all folks
Additionally, I see Bad structure definition errors in functions where these "re-namespaced" functions are used.
I believe this is the origin:
https://github.com/NationalSecurityAgency/ghidra/blob/5719632656e71757f507fe9ab89510e90e96a5ca/Ghidra/Features/Decompiler/src/decompile/cpp/grammar.y#L1047
Have you created the structure Radio?
@Wall-AF I haven't.
When I make sure a struct named Radio exists when turning the Namespace into a Class, then everything is fine.
But once the namespace is converted into a class, creating a struct does not fix the error anymore.
This is related to #5403