zeroKilo / XEXLoaderWV

Ghidra Loader Module for X360 XEX Files
112 stars 13 forks source link

Error importing XEX with PDB #13

Closed mlleemiles closed 3 years ago

mlleemiles commented 3 years ago

When loading the xex alone, the loader successfully operated. However importing xex with pdb throws an error :(

log:

java.io.IOException
    at xexloaderwv.XEXLoaderWVLoader.load(XEXLoaderWVLoader.java:59)
    at ghidra.app.util.opinion.AbstractLibrarySupportLoader.doLoad(AbstractLibrarySupportLoader.java:347)
    at ghidra.app.util.opinion.AbstractLibrarySupportLoader.loadProgram(AbstractLibrarySupportLoader.java:83)
    at ghidra.app.util.opinion.AbstractProgramLoader.load(AbstractProgramLoader.java:112)
    at ghidra.plugin.importer.ImporterUtilities.importSingleFile(ImporterUtilities.java:400)
    at ghidra.plugin.importer.ImporterDialog.lambda$okCallback$7(ImporterDialog.java:349)
    at ghidra.util.task.TaskLauncher$1.run(TaskLauncher.java:88)
    at ghidra.util.task.Task.monitoredRun(Task.java:124)
    at ghidra.util.task.TaskRunner.lambda$startTaskThread$0(TaskRunner.java:104)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
    at java.base/java.lang.Thread.run(Thread.java:832)

---------------------------------------------------
Build Date: 2020-Dec-29 1701 EST
Ghidra Version: 9.2.2
Java Home: C:\Users\mllee\.jdks\openjdk-15.0.1
JVM Version: Oracle Corporation 15.0.1
OS: Windows 10 10.0 amd64
Workstation: DESKTOP-KI2MH9M.lan

xex + pdb: https://mega.nz/file/alF21BDQ#SGhbcPH_oevtP87PWC_UuWdfubZgRrlJakHRLVh3-VM

zeroKilo commented 3 years ago

have you given it the absolute path to the pdb? (i.e. "C:\somefolder\some.pdb")

mlleemiles commented 3 years ago

have you given it the absolute path to the pdb? (i.e. "C:\somefolder\some.pdb")

Still gives the same error unfortunately (path is already without space anyway)

zeroKilo commented 3 years ago

well for now you can use this, it loads ca. 400 symbols, but thats obviously not all thats stored in a 300mb pdb, I will have to dissect its format deeper, this also affects my other pdbtool.

replace in https://github.com/zeroKilo/XEXLoaderWV/blob/master/XEXLoaderWV/src/main/java/xexloaderwv/PDBFile.java#L133

        for(int i = 0; i < count; i++)
        {
            try
            {
                RootStream rs = rootStreams.get(i);
                int subcount = rs.size / dPageBytes;
                if ((rs.size % dPageBytes) != 0)
                    subcount++;
                rs.pages = new int[subcount];
                for(int j = 0; j < subcount; j++)
                {
                    rs.pages[j] = b.readInt(pos);
                    pos += 4;
                }
                rootStreams.set(i,  rs);
            }
            catch(Exception e) {}
        }

can you tell me about where the pdb is from? as this is a devkit xex I assume you compiled this?

mlleemiles commented 3 years ago

this pdb is recovered from a devkit that has Far Cry 4

zeroKilo commented 3 years ago

interesting, well give me a day or two to "debug" the pdb processing, Im currently pretty busy

zeroKilo commented 3 years ago

https://github.com/zeroKilo/PDBDumpWV/commit/39aa0713d4630c3feb0cf24b656f40a6330b7afe

updated my dump tool already, you can use this to peek at least at the symbol and type infos :)

zeroKilo commented 3 years ago

image this looks better, and takes alot longer to load. if it loads fine, I will commit my changes

zeroKilo commented 3 years ago

image seems to work, going to commit...

zeroKilo commented 3 years ago

https://github.com/zeroKilo/XEXLoaderWV/releases/tag/9.2.2

there you go, have fun

mlleemiles commented 3 years ago

Thanks!