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
Unhandled NullPointerException in GhidraHelpService.install #3374
Comments
Edit: This message only applies to using Ghidra from the repo The implication is that the help artifacts were not built. This usually happens with the
Whether or not this is a 'real' bug may be a philosophical distinction, but if this an env misconfiguration, then it should be fixed when the env is fixed. From that perspective, this is not a bug that we need to fix. On the other hand, if your env is built correctly, but you have a valid path through the code that we have not tested, then that is a bug we need to look into. If help is built, after refreshing all Eclipse projects, you will see help content, for example, at the path: |
Which directory should gradle prepDev be run from? It fails for me with the error: Task 'prepDev' not found in root project. |
No need. This was my mistake in assuming you were running from a full dev env using our repo. Contrastingly, you are in an install dev mode, so the debugging will be a bit different. @ryanmkurtz Can you help with the debugging here? |
Correct, I did not build Ghidra itself from source, I downloaded the official 10.0.1 release build from https://github.com/NationalSecurityAgency/ghidra/releases/tag/Ghidra_10.0.1_build. When I launch it normally, I have no issue, it only produces the NPE when trying to launch it from Eclipse while debugging a loader plugin I'm currently developing. |
So you downloaded Ghidra 10.0.1, installed the GhidraDev plugin into your Eclipse, created a new Ghidra Module Project with the GhidraDev plugin's wizard, and then when you launch/debug Ghidra via your new Eclipse project, you get the exception? |
Almost, here's exactly what I did:
Both Run As and Debug As result in the NPE at "Populating Ghidra help" |
These 2 steps are being supported independently by the author of the extension. Unfortunately Ghidra/GhidraDev does not currently provide a means to import an extension's source into Eclipse. It only provides the ability to create new projects. For now, can you try creating a new Ghidra Module project named SnesLoader, and then manually copying the author's |
I won't be able to try anything for a couple of weeks, but I'll give it a try and report back my findings. However, creating a new project and manually copying over sources isn't a solution that I can upstream cleanly to the original project, so I'd prefer to figure out exactly what it is that Ghidra is missing so I can fix it, rather than going the nuclear option route. Alternatively, it would only be a 1-line fix to check
and avoid the problem altogether, but I can understand if this is one of those "no, you fix it on your end" situations, in which case any help in determining exactly what Ghidra is looking for that it's not finding would be appreciated. |
They don't have any eclipse project files checked in, so you could create the project like I described, copy all of their files in, and just ignore the gradle parts of their instructions. I'll look into the |
Ok, so I've finally had a chance to try generating a new Eclipse project the way you suggested, and the error did not occur. I will try to diff out the project directories and see if I can figure anything out from that. |
I think you got your issue resolved, so I will close this. We can always reopen it if you need more help. |
I have the same issue with Ghidra 10.3.3 – 100% identical. I can add this bit: it does not happen with a new project, but once you do one Ghidra Project Export, starting at that point I have the crash always. I have no idea to get around that without adding this one line in Ghidra. |
This is currently fixed in GhidraDev 3.0.1, which will be included in the Ghidra 10.4 release. If you delete the build directory created by the export, it will work. |
Describe the bug
I am trying to debug a loader plugin using Eclipse, but Ghidra itself crashes upon load. This crash does not occur when launching Ghidra normally, so it is possible that there is a problem with my Eclipse environment, however, I have traced the root problem to an actual unhandled NullPointerException case.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Ghidra should load correctly
Screenshots
N/A
Attachments
N/A
Environment (please complete the following information):
Additional context
Full trace log from the exception details:
Breakpointing right before and stepping through the file here: https://github.com/NationalSecurityAgency/ghidra/blob/master/Ghidra/Features/Base/src/main/java/ghidra/base/help/GhidraHelpService.java#L101
it looks like what's happening is that the iterator is containing an empty HashSet, which causes the it->hasNext() check to return true (because an empty HashMapNode is still a non-null object itself), but when you assign URL url = it.next(), you get a null url, which then fires off the NPE when you attempt to call url.toExternalForm().
So, while this may be an issue with my eclipse environment causing it to not find something that should exist, it does also expose a real NPE bug. The hasNext() check is insufficient, you also need to check the url object after assigning it from it.next().
The text was updated successfully, but these errors were encountered: