-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Debugger not working for bare mips target. #3169
Comments
from release notes
|
Except this seems to be working with Game Boy Advance using bare-ARM at the moment? https://wrongbaud.github.io/posts/ghidra-debugger/ This doesn't seem very consistent overall. |
Would it be linked to #3071 ? |
LOL - if you're expecting consistency from gdb, you need to spend more time looking at its internals! We're working toward presenting a consistent interface to the user, but honestly gdb is less an API than a general set of guidelines that each project may or may not choose to follow. As the author of PCSX-Redux, am sure you've had some exposure to this. Also, per @mumbel's comment, for the moment we're really only trying to support local user-mode Linux and Windows applications. That said, if you're willing to work with us, we'd like to take a stab at fixing whatever issues you're hitting up against. So, first off, #3071, yes. Also, #3161, #3153, #3102, #3074, #2974, #2908, #2859, and the entire Discussion entitled "Connect to luma3ds..." are probably relevant. Sorry, a lot of reading. Might help us first, though, to diagnose your specific problem. So, judging from the screenshots you sent, the trace is not active. All of the window except the Objects view and the Interpreter are driven by the trace. So, if the trace isn't working, you'll see mostly empty windows. As mentioned in some of the other posts, e.g. #3161 and #3071, and as you correctly surmised, the typical root cause for the trace not working is lack of support for "info proc mappings". Does this work from the Interpreter for you? If not, you'll need to modify the define_info_proc_mappings script and run it from the Interpreter. (Yes, this is a crappy solution - we're working on it.) Am a bit surprised that you're not seeing the breakpoints you set in the Objects tree. Try selecting the root of the tree and hitting "Refresh". It may be that the requests are timing out and leaving you with empty nodes, a problem we've seen with slower connections. I realize @wrongbaud's post probably set your expectations a bit high. He deserves some serious credit for the time he put into that blog entry. He worked through some very rough bits with almost nothing to go on int terms of documentation. Keep us posted, and let's see what we can do! |
Oh, hey, just realized something else - you set the breakpoint on the static listing, yes? That breakpoint is a proper gdb logical breakpoint in the sense that it’s set and stored with the program, but the breakpoint only gets set on the target when the static image is mapped to memory. This is consistent with the other problems you are seeing, i.e. caused by the lack of a trace. Try setting the breakpoint in the Interpreter window - my guess is it will appear in the Objects view. If so, we can concentrate on getting the trace running. With luck, the breakpoint issue will resolve with it. |
Hey guys, just wanted to clarify a few things about that post. There were major inconsistencies across GDB versions and emulator versions, meaning that only subsets of certain features would work based on which combination of these two things I was using. For example - some versions of of GDB would provide register information and not be able to set breakpoints, and other versions would do the opposite. There is a small table at the end of the post under "Extra Information / Notes" that explains this. Note that I don't think any of these things were Ghidra related - but more a byproduct of the GDB stub that was in use by the emulator itself.
This pretty much sums it up :) |
Thanks a lot for the pointers, this gives me starting points to look at. I'll keep you updated. |
Describe the bug
In ghidra 10, I haven't been able to successfully use the debugger meaningfully while targeting a raw MIPS CPU (PlayStation 1)
To Reproduce
openbios.elf
that's provided with the Windows version of PCSX-Redux.openbios.bin
from the same folder you gotopenbios.elf
, and proceed to hard reset the emulator:target remote localhost:3333
to connect to the gdb server.Expected behavior
We should be able to see registers, place breakpoints, and trace through code generally.
Screenshots
![Ghidra debugger screenshot](https://user-images.githubusercontent.com/7281574/123713426-3dfa3a80-d829-11eb-8f5e-2de7f93c957c.png)
Here, you can see that, despite placing a breakpoint at bfc00164, no breakpoint is listed on the left "Objects" panel. You can also see that no register is being listed in the right "Registers" panel.
Environment (please complete the following information):
Additional context
![GDB log window](https://user-images.githubusercontent.com/7281574/123713230-cb895a80-d828-11eb-97ef-33f376305803.png)
![List of breakpoints](https://user-images.githubusercontent.com/7281574/123713243-cfb57800-d828-11eb-899f-3f4c8abc00e0.png)
PCSX-Redux has a special option that can dump the gdb protocol in the logs. It's clearly visible there that ghidra isn't even trying to set any sort of breakpoint command. On the other hand, registers are clearly being pulled from the emulator to gdb/ghidra. There is also a window that lists the available breakpoints set by gdb, and none were set.
There are some warning / errors in ghidra, but I have no clue whatsoever what they mean or how they came to be, as it's fairly opaque in its interaction with gdb here.
Note that I am the author of PCSX-Redux, and I can make any sort of change I want to the gdb server in order to help ghidra work it out. It has been reported to me that IDA is perfectly able to connect to it and will happily trace / place breakpoints, and gdb-multiarch itself is perfectly happy to drive it too.
The text was updated successfully, but these errors were encountered: