[cpp decompiler, decomp_dbg] Could not discover root of Ghidra installation
Describe the bug
I am trying to work on the decompiler using decomp_dbg on my local clone. Running it using a relative path (./decomp_dbg) throws an exception caused by FileManage::discoverGhidraRoot (filemanage.cc) not checking if cur is an empty string before splitting (which afaik seems to happen in every case when decomp_dbg is run using a relative path?).
Anyways, even when using an absolute path, ghidra root is still not being found, because the tests FileManage::testDevelopmentPath and FileManage::testInstallPath are not returning true. I guess in this case I want the development check to be true which looks like the following:
bool FileManage::testDevelopmentPath(const vector<string> &pathels,int level,string &root)
{ // Given pathels[level] is "Ghidra", determine if this is a Ghidra development layout
if (level + 2 >= pathels.size()) return false;
string parent = pathels[level + 1];
if (parent.size() < 11) return false;
string piecestr = parent.substr(0,7);
if (piecestr != "ghidra.") return false;
piecestr = parent.substr(parent.size() - 4);
if (piecestr != ".git") return false;
root = buildPath(pathels,level+2);
vector<string> testpaths1;
vector<string> testpaths2;
scanDirectoryRecursive(testpaths1,"ghidra.git",root,1);
if (testpaths1.size() != 1) return false;
scanDirectoryRecursive(testpaths2,"Ghidra",testpaths1[0],1);
return (testpaths2.size() == 1);
}So having found the Ghidra directory it expects it to have a parent that starts with "ghidra." and ends with ".git" but also be more that 10 characters? And then the ghidra root is 2 directories higher than that and contains "ghidra.git"?
I am willing to fix those errors if someone can help me understand what those tests are intended to verify. Thanks
To Reproduce Steps to reproduce the behavior:
- Clone ghidra
- Go to the cpp decompiler and build
decomp_dbg - Run it
decomp_dbgexits withCould not discover root of Ghidra installation
Expected behavior The decompiler console terminal interface starts
Environment (please complete the following information):
- OS: Linux
- Java Version: 17
- Ghidra Version: master branch HEAD
- Ghidra Origin: locally built
Source: NationalSecurityAgency/ghidra