-
-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ghidra Decompiler Error: Could not finish collapsing block structure #203
Comments
It's related to relocs patching. It currently "works" with |
Indeed, I retried with the latest Rizin/Rz-Ghidra:
And then it prints a lot of endless garbage like that: // WARNING: Control flow encountered bad instruction data
undefined [16] sym.owWrite(int64_t arg1, int64_t arg2, int64_t arg3, int64_t arg4, int64_t arg5, int64_t arg6)
{
char cVar1;
code *pcVar2;
int32_t iVar3;
pcVar2 = reloc..text.231 + *(int32_t *)(reloc..text.231 + (uint64_t)(uint8_t)((*(uint8_t *)arg3 & 0x7f) - 4) * 4);
iVar3 = (int32_t)arg1;
cVar1 = (char)pcVar2;
// switch table (116 cases) at 0x8001dd4
switch(*(uint8_t *)arg3 & 0x7f) {
case 4:
case 6:
case 8:
case 10:
case 0xc:
case 0x18:
case 0x1a:
case 0x1d:
case 0x21:
case 0x23:
if (0 < iVar3) goto code_r0x08023298;
if (iVar3 != 0) goto code_r0x08000268;
goto code_r0x080232a0;
default:
code_r0x08000268:
return ZEXT816((uint64_t)arg4) << 0x40 & (undefined [16])0xffffffffffffffff;
case 9:
case 0xb:
case 0xf:
case 0x12:
case 0x13:
break;
case 0x14:
if (0 < iVar3) goto code_r0x080232b0;
if (iVar3 != 0) goto code_r0x08000268;
goto code_r0x08023288;
case 0x33:
*pcVar2 = (code)((char)*pcVar2 + cVar1);
*pcVar2 = (code)((char)*pcVar2 + cVar1);
*pcVar2 = (code)((char)*pcVar2 + cVar1);
*pcVar2 = (code)((char)*pcVar2 + cVar1);
break;
case 0x37:
case 0x77:
if (iVar3 < 1) {
if (iVar3 != 0) goto code_r0x08000268;
goto code_r0x08023290;
}
goto code_r0x080232a8;
}
*pcVar2 = (code)((char)*pcVar2 + cVar1);
*pcVar2 = (code)((char)*pcVar2 + cVar1);
*pcVar2 = (code)((char)*pcVar2 + cVar1);
*pcVar2 = (code)((char)*pcVar2 + cVar1);
code_r0x08023288:
*pcVar2 = (code)((char)*pcVar2 + cVar1);
*pcVar2 = (code)((char)*pcVar2 + cVar1);
*pcVar2 = (code)((char)*pcVar2 + cVar1);
*pcVar2 = (code)((char)*pcVar2 + cVar1);
.... (thousands of lines like that)
*pcVar2 = (code)((char)*pcVar2 + cVar1);
*pcVar2 = (code)((char)*pcVar2 + cVar1);
*pcVar2 = (code)((char)*pcVar2 + cVar1);
*pcVar2 = (code)((char)*pcVar2 + cVar1);
// WARNING: Bad instruction - Truncating control flow here
halt_baddata(); Attaching the full output here: |
Despite all fixes in relocations it is still happening. |
Since the binary is the unlinked object file, be sure to use rizinorg/rizin#799 for the Rizin
And it stuck for a loooooooong time, after that returning the following error message:
rawmem.c-gcc-x64-O3.o.zip
Ghidra 10.0 output:
Ghidra 10.0 disassembly:
The text was updated successfully, but these errors were encountered: