gdb+wine - What is the expected outcome? #9160
Replies: 6 comments
-
|
@rdepaoli2026 Will ping @nsadeveloper789 (who wrote this launcher) on Monday and get back to you with answers. Must admit, looking at it now, I too am confused by the intent, i.e. you do seem to be one step removed from what you would like to be observing. |
Beta Was this translation helpful? Give feedback.
-
|
Spoke with @nsadeveloper789 and what you're seeing is as intended. There are other ways to do this, but wine is essentially loading the target and relevant libraries into its process space. If you check out the wine.py file, you can see the logic for mapping the target PE(s) into the memory map. If you filter the Memory View on your executable name, you should see the relevant regions AFTER they have been loaded. Knowing the target's base address with allow you to set up a static mapping between your target program (via the Static Listing) and target (via the Dynamic Listing), set breakpoints/watchpoints, and view the target registers when executing the target code. However, the Module List, I believe, will still reflect only the wine64 library set, as wine does not expose this list to gdb. (I realize I forgot to ask him why you have to execute "starti" - maybe in the docs? Will check tomorrow.) |
Beta Was this translation helpful? Give feedback.
-
|
Good afternoon @d-millar.
Thanks for asking. You mention filtering, do you mean the Window | Debugger | Memview ? As an aside, I also have a strange effect that the termmines thread seems to be mostly called wine64, but sometimes it shows up as a termmines thread, and haven't been able yet to figure out, why that is. What setup are you using to test this? |
Beta Was this translation helpful? Give feedback.
-
|
Hey, sorry - I think of it as the Memory view, but it's really called Regions. (The Memview window is rather specialized - used for viewing trace events related to memory allocation, which you are unlikely to have.) Regions should have memory region info obviously related to your target after the target has loaded. Re threads, I think that is expected behavior, i.e. wine64 and the target are running in the same thread from gdb's standpoint. The thread gets renamed after the target has launched. I'm not sure I've ever seen it switch back, but again my experience using this launcher is a bit limited. Simplest test setup for gdb + wine: launch notepad.exe. As a test, it has several advantages, including (a) being obvious and easy to make active because of the GUI, and (b) not requiring any potentially missing DLLs for its launch. On the latter point, for any target you're testing, I would try running "gdb /path/to/wine64(or32) target.exe" from the command line before attempting it in Ghidra, as there may be missing DLL requirements and the Ghidra console obscures the messages a bit. So my test recs:
At this point, you should have /usr/lib/wine/x86_64-windows/notepad.exe entries in Regions. You could map these to the imported prorgam by right-clicking on any given region (although, in this case, probably not a good match as the executing target is internal to wine). |
Beta Was this translation helpful? Give feedback.
-
|
I think we're all on the same page, but just to add my two cents: I did examine a few different ways to try to create an out-of-the-box wine connector. Somewhat because it's an actual useful use case, but more so to demonstrate that the connector framework was extensible enough to support it. I don't remember all the different ways I tried, but for reference, I was testing with The method we went with is to launch Turns out some of this overview is documented in our help. From the gdb+wine connector dialog, press You shouldn't need to do I can really only speculate about what's gone wrong from here, so if the above is not enough to resolve the issue, I'd probably need you to capture text from the Terminal wine+gdb window, i.e., GDB's output. As always, start reading from the top. |
Beta Was this translation helpful? Give feedback.
-
|
Good afternoon @d-millar and @nsadeveloper789. I retried with notepad.exe following @d-millar 's sequence, attempting the most basic debugging, namely stopping at a breakpoint at the notepad's main(). The steps and Ghidra responses were as follows: 1) Setup
2) Start of Debugger
On launch, the Ghidra panels show the following:
3) Starting wine
This starts Wine the Ghidra panels are updated to show the following information:
4) Starting notepad.exe
The Ghidra panels show the following:
5) Interrupting notepad.exe
The Ghidra panels show the following:
6) Ghidra step into target The Ghidra panels show the following:
Findings/Conclusions
I would be interested to know, if you see the identical behaviour with your setup, and also a solution for setting the breakpoint to notepad's main (or before that, maybe at the point of "switch over" from wine to notepad. Thanks. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Given are:
On start of Debugger with termmines.exe:
Configure and Launch ... settings for gdb+wine:
What happens on Launch:
gdb command sequence:
Request for clarification:
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions