-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Ghidra connection to lldb: Timeout with larger binary #7866
Comments
@develorer Just say "Keep", the timeout doesn't really do anything - mostly a warning that something may have gone wrong. (We do have ticket in for making the timeout configurable, but....) |
Unfortunately when the timeout shows up, the connection closes (in the "Connections" window). And so the next command in the lldb terminal "ghidra trace connect "127.0.0.1:49252" fails with the error message "Connection refused", which makes sense since the connection was closed on Ghidra's side. So I cannot just ignore it. |
OK, so this is an actual error, i.e. if the connection closes, the connection failed (vs. timed out). Can you connect to the same target using lldb from a shell? With lldb, my first guess is always lack of permissions, so would like to rule that out. |
Yes, I can connect the same target from a shell. |
OK. Just running a few tests here for comparison, looks like failure on permissions would have happened after the "target create". Are there connections open in the Connections window? Generally, you're going to want to "Close All" before starting another. (We intend to support this, but right now it has issues.) Any messages in the "Debug Console" window that seem helpful and/or in the terminal if you start Ghidra using "support/ghidraDebug" instead of "ghidraRun"? |
Thanks a lot for looking into it. There are no connections open before I click on the bug icon to launch the debugging process.
In the Debug Console the detailed error message is this:
I am unable to try the "support/ghidraDebug" right now. I will when I can. However, to me it seems like a very simple Timeout. It seems the java code of ghidra waits for the connection and fails when it does not receive it soon. lldb only makes that connection when it does "ghidra trace connect", which it does only after "target create" I have thoroughly tested everything else, and all the "ghidra trace connect/start/sync-enabl" work perfectly fine. They can all connect fine in any case where the target create does not take too much time. This is unrelated to the binary path itself, only the size of the binary. |
OK, looking into it.... Your original post said you didn't make it to "ghidra trace connect", so was a little thrown off. |
Sorry for the confusion, when I said lldb "did not have time to move on to |
Yep, no problem - just didn't want you to think I was ignoring what you were saying. OK, going through the code, looks like no easy answer. :( I will put in a ticket for this - we may already have one, but, if so, will bump the priority. In the meantime, wrt workarounds, I think you have two options: I realize building Ghidra from scratch is probably not your idea of how to spend a Friday, but the instructions on the website are pretty good and relatively self-explanatory. |
Thanks, I appreciate it! I am looking forward to a more permanent fix, but will work with the workarounds you suggested in the meantime. They do make sense. I have to say I am super impressed by the quality of the tool and the support. It's exceptional to receive quality answers in such a short amount of time. Thanks a lot! |
Thanks - really appreciate the thumb up and your willingness to contribute and help us make a better product! |
Describe the bug
When I launch a binary with lldb and it tries to connect to ghidra, it fails with a java.net.SocketTimeoutException
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I would expect ghidra to wait longer, and attach correctly to lldb.
Environment (please complete the following information):
Additional context
The timeout happens inside ghidra.app.plugin.core.debug.service.tracermi.AbstractTraceRmiListener.doAccept (line 66).
When I try the same thing with a smaller binary, "target create" takes less time, and things work correctly.
The file "local-lldb.sh" shows clearly the steps, and we would need to have completed "target create" sooner, to reach "ghidra trace connect" and "ghidra trace start" before the ghidra java times out.
Note that when I try this on a faster machine, I also don't have a problem (for the same reason).
Does anyone have an idea for a quick fix for this? It would seem I just need to set a longer timeout parameter for the "DefaultTraceRmiAcceptor.accept" function, but can I do that without recompiling ghidra?
Thanks!
The text was updated successfully, but these errors were encountered: