XboxDev / ghidra-xbe

Xbox Executable Format (XBE) Loader Extension for Ghidra SRE framework
82 stars 17 forks source link

Failed to run XbSymbolDatabaseTool" error upon analysis. #67

Open databoose opened 5 days ago

databoose commented 5 days ago

This is in reference to the closed issue https://github.com/XboxDev/ghidra-xbe/issues/27

I am re opening this issue as i believe this is could be a bug.

Here is my include setup for the headers : image

The documentation says " In the Data Type Manager window, right click on your default.xbe and select Apply Function Datatypes."

Once i do this, this error shows up. The same also happens during analysis.

image

The build process does chmod +x XbSymbolDatabaseTool properly, and when i had checked, the file had already been set to executable.

OP's workaround on the original issue thread did not work for me., so i figured this should be investigated further.

Upon looking through ghidra user debug logs, i could find nothing actually referrencing XBSymbolDatabaseTool to maybe get an idea as to what is going on, so my next step was to download the source of this repo and grep the string.

image

Essentially, to my understanding at least, XbSymbolDatabaseTool is within the following file :

https://github.com/XboxDev/ghidra-xbe/blob/master/src/main/java/XbeLoader/XbeXbSymbolDatabaseAnalyzer.java

In the following code here, starting from line 123 , some type of exception is caught, and thus this exact error message is displayed (i could not find an occurence of this error message anywhere else within the entire repo, so pretty sure we narrowed it down here)

I presume perhaps this is a configuration error or some type of ghidra issue, but i thought this would be important enough to re-open as an issue.


                } catch (InterruptedException e) {
            log.appendMsg("Failed to run " + toolExec);
            return false;
        } catch (IOException e) {
            log.appendMsg("Failed to run " + toolExec);
            return false;
        } catch (InvalidInputException e) {
            log.appendMsg("Failed to run " + toolExec);
            return false;
               }
RadWolfie commented 5 days ago

Hi there, can you check your currently installed Ghidra's "Extensions" folder to verify the XBSymbolDatabaseTool binary do exist? The information to find your installed Extension folder can be found on Ghidra's Installation Guide.

If they do exist with permission applied correctly (for double check purpose). Then you may want to manually run XBSymbolDatabaseTool on your preferred terminal to find out if the cli tool do output error.

databoose commented 4 days ago

Hi there, can you check your currently installed Ghidra's "Extensions" folder to verify the XBSymbolDatabaseTool binary do exist? The information to find your installed Extension folder can be found on Ghidra's Installation Guide.

If they do exist with permission applied correctly (for double check purpose). Then you may want to manually run XBSymbolDatabaseTool on your preferred terminal to find out if the cli tool do output error.

Yes, the XbSymbolDatabaseTool does exist, under /ghidra_11.1.2_PUBLIC/Extensions/ghidra-xbe/os/linux_x86_64/

The SHA1 hash for the binary is 468de43f56393809bdf076d839e4bd658872717c , which matches as the same hash when i manually build the project from the build.shfile and go to the executable.

Now, i tried importing the project in intellij and building it to perhaps debug in runtime, however i am encountering a build issue.

/home/databoose/Desktop/external-projects/ghidra-xbe/src/main/java/XbeLoader/XbeXtlidAnalyzer.java:60: error: package XbeXtlidDb does not exist String[] name_namespace = XbeXtlidDb.xtlids.get(id);

Apologies if this is a simple thing that i'm misunderstanding, for context i hadn't touched java in years, but i'm not sure how to resolve this issue, i atttempted a gradle sync, to no avail of solving the problem to getting it to build and run.

Also; another thing.

Do you guys have a public communications channel by chance? Like a discord or matrix perhaps? I am banned from the XEMU discord from a while back, and i do not remember why or by who, but for whatever it may be i am completely and fully willing to apologize for any past behavior that may have led to the ban. I understand the importance of the server rules and would like to make amends if possible, i want to contribute to the overall OG xbox emulation space, If there's another platform or channel where I can reach out and discuss this further, I'd be grateful for the information.

Thanks and have a good one.

RadWolfie commented 4 days ago

Yes, the XbSymbolDatabaseTool does exist, under /ghidra_11.1.2_PUBLIC/Extensions/ghidra-xbe/os/linux_x86_64/

Okay, the next thing I can think of is xbe you had imported xbe's original file either got moved or no longer exist. If this is not the issue, then I have no idea what may be the cause at this time.

Now, i tried importing the project in intellij and building it to perhaps debug in runtime, however i am encountering a build issue.

/home/databoose/Desktop/external-projects/ghidra-xbe/src/main/java/XbeLoader/XbeXtlidAnalyzer.java:60: error: package XbeXtlidDb does not exist String[] name_namespace = XbeXtlidDb.xtlids.get(id);

Please verify if you have installed xsltproc on your operating system. It is part of the requirement for generate XbeXtlidDb.java file. Then run build.sh script again, hopefully this will resolve your issue. Apologizes if it's still not working, I'm not native to Linux operating systems. Except I do use GitHub's workspace to build ghidra-xbe which require xsltproc to be installed before able to successfully generate XbeXtlidDb.java file.

In the following code here, starting from line 123 , some type of exception is caught, and thus this exact error message is displayed (i could not find an occurence of this error message anywhere else within the entire repo, so pretty sure we narrowed it down here)

Yes, that is where the fault occurred. Except it doesn't include depth information about the cause of crash. Hopefully someday, we will have more details about the cause of crash.

databoose commented 4 days ago

Please verify if you have installed xsltproc on your operating system. It is part of the requirement for generate XbeXtlidDb.java file. Then run build.sh script again, hopefully this will resolve your issue.

Installing this package on my system, then rebuilding with the build.sh file resolves the issue fully for me, no error when applying function types, or (just to make sure), no error during the entirety of ghidra's analysis.

I had made a pull request regarding this issue to fix it for further users who may have the same issues with the package missing. https://github.com/XboxDev/ghidra-xbe/pull/68

Thank you for the help, much appreciated.