Replies: 10 comments 17 replies
-
Wow, ok - that is spectacularly uninformative. :) The immediate thing that confuses me is the JNA error, given our implementation of the gdb agent doesn't use JNA directly. Any chance you could walk me through the exact steps you took? I.e. did Targets->Connect throw this error immediately? One thing to try for sure - try using double-slashes in your path (Java is not a fan of the backslash). |
Beta Was this translation helpful? Give feedback.
-
Ah, right - you jogged my memory. Apologies for not remembering this right off the bat - the issue is the lack of Pty support on Windows. I'd suggest checking out the previous issues #2908 and #3102)in Issues, and #2721 in Discussions. The basic workaround is to use the "GDB over SSH" agent rather than "IN-VM GDB" and either a WSL client or separate Linux VM running a gdbserver. Definitely, too complicated by half, but....let us know if neither of those will work for you or if you get stuck. |
Beta Was this translation helpful? Give feedback.
-
OK, I think I've reproduced the error, but I'd like to confirm with you. If you run "k:\msys64\mingw64\bin\gdb.exe -i-mi2" from the cmd line, what is the first line of output? Am guessing it's some flavor of a python error message that doesn't begin with "=". |
Beta Was this translation helpful? Give feedback.
-
Hmmm, that's unfortunate. I still think we're close to the issue, but, on my machine, I get a line that doesn't begin with "=" whether I run gdb from cmd or Ghidra. I suppose there's some possibility your Ghidra environment differs from your cmd environment, but.... Basically, I think the logic is GdbManagerImpl::PtyThread:run (line 139 and ff) is a little weak. We default to CLI if the first line returned by gdb does not start with "=". There are many reasons why this could happen, e.g. gdb is accessed via a wrapper, gdb has a header in MI2 mode, or, as in my case, gdb throws an error when loading python. I'm assuming you're running from the distribution versus Eclipse, and are probably not eager to debug our code. :) |
Beta Was this translation helpful? Give feedback.
-
Ah, sorry....let me take a shot at the questions/comments: (1) The "GetLastError blasphemy" is a direct result of the unescaped path, i.e. somewhere we pass your input through some bit of code that we probably shouldn't have and it insists on escapes. Putting in a ticket for that - @nsadeveloper789 has volunteered to take that one on. I think that's most of your questions - yell if I missed some. With respect to debugging Java, if you're really interested, the "Advanced Development" section on the Ghidra GitHub main page has all the details. Short version: you would clone the public repo, run the init script to load dependencies, build Ghidra via Gradle, and then set up the debug environment in Eclipse. It's very straightforward and am happy to help if you're interested, but the build process does take awhile. Let me know if you decide you have time/interest and/or you get stuck on any of our instructions. |
Beta Was this translation helpful? Give feedback.
-
I have found the time and motivation for building Ghidra. So far I've cloned the repo (no submodules), installed
Is this error related to the Java VM version? If so, I'd like to mention that I didn't specify any installations myself. If it picked something wrong, I gotta fix that somehow. |
Beta Was this translation helpful? Give feedback.
-
For running w/o Eclipse, the relevant scripts live in Ghidra/RuntimeScripts/. For debugging stuff: |
Beta Was this translation helpful? Give feedback.
-
I have erased the whole git folder along with the Eclipse workspace, then rebuilt everything and reimported the project. The project presentation is "Flat" now. Is this alright now? |
Beta Was this translation helpful? Give feedback.
-
Okaaayyy... Looks like the new Trace RMI has rendered this whole thread outdated... Guess I'll have to start over. Hopefully this new API is less buggy. |
Beta Was this translation helpful? Give feedback.
-
Fingers crossed - trickiest part is making sure the version of python you’re using matches that compiled into gdb. |
Beta Was this translation helpful? Give feedback.
-
I want to discuss the related stuff here. But first and foremost, I've run into some weird bugs with the first option:
gdb
.The "stack trace":
This happened when I entered the path to my local MinGW GDB and tried to connect. For context, that's how it looks like:
I find it very odd that replacing
gdb.exe
withlol.exe
doesn't change anything.The platform is... Oh wait, the "stack trace" already has this info.
Beta Was this translation helpful? Give feedback.
All reactions