MSVC support and sample project, frida debugging api updates #6347
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
this is not really a full PR as it doesn't work and I left debug code in incase useful for testing . This needs someone who knows ghidra's debug system for better than myself.
So I don't think frida windows debug link was ever compiled with MSVC. In addition the ghidra_wrapper.c seems out of date by a good bit for the API calls. The big one it was missing was the
GH_frida_session_enable_debugger_sync
that doesn't really exist any more. The only similar one isfrida_script_enable_debugger_sync
so I have a bit of a hack to make the old call work (but clearly we should revise to actually call the script version. Sadly while this works to build the frida-core.dll without an issue and ghidra can connect both inside and outside the VM i don't get past stage 3. I can see it starts the process but thats about it. I have a debug logger added right now as most (but not all) the time the external debugger agent would close. It showed the following calls before failing:I did verify my frida_script_enable_debugger_sync does seem to start the debugger (I see it listening). I left their sample app with some modifications calling this code which also seemed to work (could inject their script).
Anyway this clearly isn't working but builds the dll and at least gets closer to working along with providing a MSVC solution to easily compile on windows. The DLL should go in
Ghidra\patch\win32-x86-64
and it is statically compiled against frida so no other deps are needed.To remove the debugger just remove the include and it will ifdef to nothing.