Skip to content
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

Some structures from symbols not being applied #18

Open
MrSapps opened this issue Jan 26, 2020 · 21 comments
Open

Some structures from symbols not being applied #18

MrSapps opened this issue Jan 26, 2020 · 21 comments
Assignees
Labels
bug Something isn't working SYM SYM files support

Comments

@MrSapps
Copy link

MrSapps commented Jan 26, 2020

Ghidra/plugin output:

/* File: E:\DATA\MGS\MGS_REVERSING\SRC\JIMCTRL_KILL_8003853C.C */

void jimctrl_kill_8003853C(void *pJimCtrl)
{
  sub_80038004();
  dword_8009E280.m[2]._0_4_ = 0;
  sub_80024098();
  return;
}

Original code:

typedef struct
{
    int dword_8009E280;
    int dword_8009E284;
    int dword_8009E288;
    int dword_8009E28C;
} unk_8009E280;

unk_8009E280 dword_8009E280 = {0, 0, 0, 0};

void jimctrl_kill_8003853C(void *pJimCtrl)
{
    sub_80038004(pJimCtrl);
    dword_8009E280.dword_8009E28C = 0;
    sub_80024098();
}

Binary and symbol file attached for repro.

ghidra.zip

@lab313ru
Copy link
Owner

Thanks, I'll check it.

@lab313ru lab313ru self-assigned this Jan 26, 2020
@lab313ru lab313ru added the bug Something isn't working label Jan 26, 2020
@lab313ru
Copy link
Owner

Fixed via d8c76ac.
Check the project's new release.

@lab313ru
Copy link
Owner

May I ask you: how did you get this SYM file? How it was generated?

@MrSapps
Copy link
Author

MrSapps commented Jan 28, 2020

by compiling this source https://github.com/FoxdieTeam/mgs_reversing

@lab313ru
Copy link
Owner

Thanks. If you will find some other problems, feel free to create an issue with a bunch of mistakes related to mgs_reversing.

@MrSapps
Copy link
Author

MrSapps commented Jan 28, 2020

There still seems to be something strange going on here, the output is now:

void FUN_8003853c(void)
{
  FUN_80038004();
  unk_8009E280.dword_8009E28C = 0;
  FUN_80024098();
  return;
}

However as you can see some function names are now missing and also the correct name of the var is missing (it should be dword_8009E280 not unk_8009E280).

There is maybe another existing issue where some function names do not get applied too:

ghidra.util.exception.InvalidInputException: Symbol name matches possible default symbol name: MENU_GetPrimInfo_80038D68
ghidra.util.exception.InvalidInputException: Symbol name matches possible default symbol name: MENU_JimakuWrite_800494E8
ghidra.util.exception.InvalidInputException: Symbol name matches possible default symbol name: MENU_GetRadioCode_800497C4
ghidra.util.exception.InvalidInputException: Symbol name matches possible default symbol name: MENU_DrawBar_80038D74
ghidra.util.exception.InvalidInputException: Symbol name matches possible default symbol name: MENU_SetLoad_800427E8
ghidra.util.exception.InvalidInputException: Symbol name matches possible default symbol name: MENU_DrawBar2_80038DE0
ghidra.util.exception.InvalidInputException: Symbol name matches possible default symbol name: MENU_AreaNameWrite_80049534
ghidra.util.exception.InvalidInputException: Symbol name matches possible default symbol name: MENU_Text_XY_Flags_80038B34
ghidra.util.exception.InvalidInputException: Symbol name matches possible default symbol name: MENU_RadioCall_80042730
ghidra.util.exception.InvalidInputException: Symbol name matches possible default symbol name: MENU_InitRadioTable_80049644
ghidra.util.exception.InvalidInputException: Symbol name matches possible default symbol name: MENU_ResetCall_80042814
ghidra.util.exception.InvalidInputException: Symbol name matches possible default symbol name: MENU_Text_80038C38
ghidra.util.exception.InvalidInputException: Symbol name matches possible default symbol name: MENU_set_chara_code_800471AC
ghidra.util.exception.InvalidInputException: Symbol name matches possible default symbol name: MENU_Text_Init_80038b98
ghidra.util.exception.InvalidInputException: Symbol name matches possible default symbol name: MENU_SetRadioCallbackProc_8004283C
ghidra.util.exception.InvalidInputException: Symbol name matches possible default symbol name: MENU_ClearRadioTable_8004967C
ghidra.util.exception.InvalidInputException: Symbol name matches possible default symbol name: MENU_Color_80038B4C
ghidra.util.exception.InvalidInputException: Symbol name matches possible default symbol name: MENU_InitRadioMemory_8004E0EC
ghidra.util.exception.InvalidInputException: Symbol name matches possible default symbol name: MENU_JimakuClear_80049518

When checking say MENU_JimakuClear_80049518 its name is FUN_80049518 which is not correct in respect to the symbol file.

@lab313ru lab313ru reopened this Jan 28, 2020
@lab313ru
Copy link
Owner

FUN_8003853c - but I have jimctrl_kill_8003853 here.

@MrSapps
Copy link
Author

MrSapps commented Jan 28, 2020

hmm let me try again...

@MrSapps
Copy link
Author

MrSapps commented Jan 28, 2020

it always repros with this sym for me, might not be the same as the one I originally used in this bug

asm.zip

@lab313ru
Copy link
Owner

lab313ru commented Jan 28, 2020

You've modified your sym file, so...:

03c450: $800382ec 94 Def class EXT type FCN VOID size 0 name jimctrl_kill_8003853C

jimctrl_kill_8003853C has now 0x800382ec address

@MrSapps
Copy link
Author

MrSapps commented Jan 28, 2020

damn by bad, I'll try again with the original

@lab313ru
Copy link
Owner

As I understand your current situation: your sym file was modified, but you're still using the original executable.

@MrSapps
Copy link
Author

MrSapps commented Jan 28, 2020

Yeah I rebuilt from a bad version of the code, sorry about wasting your time on that. However even with the original symbol file the global var name is still incorrect?

/* File: E:\DATA\MGS\MGS_REVERSING\SRC\JIMCTRL_KILL_8003853C.C */

void jimctrl_kill_8003853C(void *pJimCtrl)
{
  sub_80038004();
  unk_8009E280.dword_8009E28C = 0;
  sub_80024098();
  return;
}

Edit: Issue with the names not applying from the exception messages still seems to stand too.

@lab313ru
Copy link
Owner

Yes, fixing it...

@MrSapps
Copy link
Author

MrSapps commented Jan 28, 2020

I also noticed another possible regression, in function 80018384 the first argument is undefined but it should be DRAWENV pointer

@lab313ru
Copy link
Owner

New fixes via: 7f76770.
Check new release.

@MrSapps
Copy link
Author

MrSapps commented Jan 28, 2020

/* File: E:\DATA\MGS\MGS_REVERSING\SRC\JIMCTRL_KILL_8003853C.C */

void jimctrl_kill_8003853C(void *pJimCtrl)
{
  sub_80038004();
  DAT_8009e28c = 0;
  sub_80024098();
  return;
}

Still looks like it isn't working?

@lab313ru lab313ru reopened this Jan 29, 2020
@lab313ru
Copy link
Owner

It's strange, but not all structures defined in SYM file: HzdMap, for example.

@MrSapps
Copy link
Author

MrSapps commented Jan 29, 2020

Maybe you can add verbose loading option so its easier for noob user like me to understand what is wrong. Right now I can't know if the structure for DAT_8009e28c is in sym file or not.

@MrSapps
Copy link
Author

MrSapps commented Feb 16, 2020

Any progress? I've created a fork so I can build this and the latest code has a null pointer exception. I've also been trying to hack in a menu item to re-apply symbols after creating the ghidra DB.

@lab313ru
Copy link
Owner

lab313ru commented Feb 17, 2020 via email

@lab313ru lab313ru added the SYM SYM files support label Jan 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working SYM SYM files support
Projects
None yet
Development

No branches or pull requests

2 participants