diommsantos / Gx64Sync

A set of plugins for Ghidra and x64Dbg synchronization. A faster, more flexible ret-sync.
Other
27 stars 2 forks source link

Bug when debugging multiple dlls #8

Closed idan-h closed 1 month ago

idan-h commented 2 months ago

When I debug multiple dlls with hyper sync, it does not automatically show me the current binary. Also, when I manually go to the binary, it throws an error message: Error in plugin event listener

Cannot invoke "ghidra.program.util.ProgramLocation.getAddress()" because "loc" is null
java.lang.NullPointerException: Cannot invoke "ghidra.program.util.ProgramLocation.getAddress()" because "loc" is null
    at gsync.HyperSync.GhidraRVAHandler(HyperSync.java:113)
    at gsync.GSyncPlugin.locationChanged(GSyncPlugin.java:122)
    at ghidra.app.plugin.ProgramPlugin.processEvent(ProgramPlugin.java:123)
    at ghidra.framework.plugintool.Plugin.eventSent(Plugin.java:293)
    at ghidra.framework.plugintool.mgr.EventManager.sendEvents(EventManager.java:286)
    at ghidra.framework.plugintool.mgr.EventManager.lambda$new$3(EventManager.java:49)
    at ghidra.util.Swing.doRun(Swing.java:292)
    at ghidra.util.Swing.runNow(Swing.java:208)
    at ghidra.util.Swing.runNow(Swing.java:163)
    at ghidra.framework.plugintool.mgr.EventManager.fireEvent(EventManager.java:216)
    at ghidra.framework.plugintool.PluginTool.firePluginEvent(PluginTool.java:537)
    at ghidra.framework.plugintool.Plugin.firePluginEvent(Plugin.java:456)
    at ghidra.app.plugin.core.progmgr.MultiProgramManager.fireActivatedEvent(MultiProgramManager.java:272)
    at ghidra.app.plugin.core.progmgr.MultiProgramManager.setCurrentProgram(MultiProgramManager.java:249)
    at ghidra.app.plugin.core.progmgr.MultiProgramManager.setCurrentProgram(MultiProgramManager.java:191)
    at ghidra.app.plugin.core.progmgr.ProgramManagerPlugin.lambda$setCurrentProgram$5(ProgramManagerPlugin.java:453)
    at ghidra.util.Swing.doRun(Swing.java:292)
    at ghidra.util.Swing.runNow(Swing.java:208)
    at ghidra.util.Swing.runNow(Swing.java:163)
    at ghidra.app.plugin.core.progmgr.ProgramManagerPlugin.setCurrentProgram(ProgramManagerPlugin.java:456)
    at ghidra.app.plugin.core.progmgr.MultiTabPlugin.programSelected(MultiTabPlugin.java:304)
    at ghidra.app.plugin.core.progmgr.MultiTabPlugin.lambda$init$7(MultiTabPlugin.java:263)
    at docking.widgets.tab.GTabPanel.selectTab(GTabPanel.java:208)
    at docking.widgets.tab.GTab$GTabMouseListener.mousePressed(GTab.java:163)
    at java.desktop/java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:288)
    at java.desktop/java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:287)
    at java.desktop/java.awt.Component.processMouseEvent(Component.java:6623)
    at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3389)
    at java.desktop/java.awt.Component.processEvent(Component.java:6391)
    at java.desktop/java.awt.Container.processEvent(Container.java:2266)
    at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5001)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4572)
    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
    at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:775)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:747)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:745)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:744)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

---------------------------------------------------
Build Date: 2024-Jun-14 1025 EDT
Ghidra Version: 11.1.1
Java Home: C:\Program Files\Amazon Corretto\jdk17.0.12_7
JVM Version: Amazon.com Inc. 17.0.12
OS: Windows 11 10.0 amd64
Workstation: IDAN

and changes the location to (what I think is) the start location of the binary.

After that it's cool tho, works normally (event on the current binary). When I change back to the previous binary, it happens again

diommsantos commented 2 months ago

I have fixed the exception. In my machine when changing binaries in Ghidra they sync fine in x64Dbg. As for automatically change binaries in Ghidra (when a new module is entered in x64Dbg) is going to take a bit of work, I've been busy lately but I'll get to work on it as soon as I have the time.

diommsantos commented 2 months ago

HyperSync should now automatically show the current binary in Ghidra. You need to have the binaries you want to view in Ghidra's listing view.