Skip to content
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

Breakpoints window can become unusable in Debugger #7497

Open
bukowa opened this issue Feb 13, 2025 · 3 comments
Open

Breakpoints window can become unusable in Debugger #7497

bukowa opened this issue Feb 13, 2025 · 3 comments
Assignees
Labels
Feature: Debugger Status: Internal This is being tracked internally by the Ghidra team

Comments

@bukowa
Copy link

bukowa commented Feb 13, 2025

Describe the bug

  1. Use windbg
  2. Set HW and SW breakpoint on the same address.
  3. Start randomly enabling/disabling them in the bookmarks window by clicking on the gray/blue circle when debugger is paused and can receive commands.
  4. Observe window starting to break and becoming unusable.

Image

Environment (please complete the following information):

  • OS: Win10
  • Java Version: 21.0.6
  • Ghidra Version: 11.3
  • Ghidra Origin: github release
@bukowa
Copy link
Author

bukowa commented Feb 13, 2025

While trying to reproduce I encountered another error that prevents me from enabling/disabling any breakpoints in the window

Target breakpoints must be requested at present snap
java.lang.AssertionError: Target breakpoints must be requested at present snap
	at ghidra.app.plugin.core.debug.service.breakpoint.TraceBreakpointSet.planPlaceTarget(TraceBreakpointSet.java:343)
	at ghidra.app.plugin.core.debug.service.breakpoint.TraceBreakpointSet.planEnable(TraceBreakpointSet.java:327)
	at ghidra.app.plugin.core.debug.service.breakpoint.MappedLogicalBreakpoint.planEnable(MappedLogicalBreakpoint.java:168)
	at ghidra.app.plugin.core.debug.service.breakpoint.MappedLogicalBreakpoint.enableForTraces(MappedLogicalBreakpoint.java:175)
	at ghidra.app.plugin.core.debug.service.breakpoint.MappedLogicalBreakpoint.enable(MappedLogicalBreakpoint.java:207)
	at ghidra.app.plugin.core.debug.gui.breakpoint.LogicalBreakpointRow.setEnabled(LogicalBreakpointRow.java:73)
	at ghidra.app.plugin.core.debug.gui.breakpoint.LogicalBreakpointRow.setState(LogicalBreakpointRow.java:56)
	at ghidra.app.plugin.core.debug.gui.breakpoint.DebuggerBreakpointsProvider$LogicalBreakpointTableColumns.setValueOf(DebuggerBreakpointsProvider.java:136)
	at ghidra.app.plugin.core.debug.gui.breakpoint.DebuggerBreakpointsProvider$LogicalBreakpointTableColumns.setValueOf(DebuggerBreakpointsProvider.java:66)
	at docking.widgets.table.DefaultEnumeratedColumnTableModel$EnumeratedDynamicTableColumn.setValueOf(DefaultEnumeratedColumnTableModel.java:199)
	at docking.widgets.table.DefaultEnumeratedColumnTableModel$EnumeratedDynamicTableColumn.setValueOf(DefaultEnumeratedColumnTableModel.java:164)
	at docking.widgets.table.DefaultEnumeratedColumnTableModel.setValueAt(DefaultEnumeratedColumnTableModel.java:272)
	at docking.widgets.table.TableModelWrapper.setValueAt(TableModelWrapper.java:301)
	at java.desktop/javax.swing.JTable.setValueAt(JTable.java:2793)
	at ghidra.util.table.GhidraTable.setValueAt(GhidraTable.java:315)
	at java.desktop/javax.swing.JTable.editingStopped(JTable.java:4791)
	at java.desktop/javax.swing.AbstractCellEditor.fireEditingStopped(AbstractCellEditor.java:152)
	at java.desktop/javax.swing.AbstractCellEditor.stopCellEditing(AbstractCellEditor.java:96)
	at java.desktop/javax.swing.plaf.basic.BasicTableUI$Handler.mousePressed(BasicTableUI.java:1040)
	at java.desktop/java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:287)
	at java.desktop/java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:287)
	at java.desktop/java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:287)
	at java.desktop/java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:287)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6618)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3398)
	at java.desktop/java.awt.Component.processEvent(Component.java:6386)
	at java.desktop/java.awt.Container.processEvent(Container.java:2266)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4996)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4828)
	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:4828)
	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:400)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:98)
	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:400)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87)
	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: 2025-Feb-05 1536 EST
Ghidra Version: 11.3
Java Home: C:\ghidra\ghidra_11.3\Contrib\jdk-21.0.6+7
JVM Version: Eclipse Adoptium 21.0.6
OS: Windows 10 10.0 amd64
Traceback (most recent call last):
  File "C:\ghidra\ghidra_11.3\Ghidra\Debug\Debugger-agent-dbgeng\pypkg\src\ghidradbg\hooks.py", line 156, in _func
    return func(*args, **kwargs)
  File "C:\ghidra\ghidra_11.3\Ghidra\Debug\Debugger-agent-dbgeng\pypkg\src\ghidradbg\hooks.py", line 190, in on_state_changed     
    return on_stop(args)
  File "C:\ghidra\ghidra_11.3\Ghidra\Debug\Debugger-agent-dbgeng\pypkg\src\ghidradbg\hooks.py", line 386, in on_stop
    state.record("Stopped")
    ~~~~~~~~~~~~^^^^^^^^^^^
  File "C:\ghidra\ghidra_11.3\Ghidra\Debug\Debugger-agent-dbgeng\pypkg\src\ghidradbg\hooks.py", line 102, in record
    commands.put_breakpoints()
    ~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "C:\ghidra\ghidra_11.3\Ghidra\Debug\Debugger-agent-dbgeng\pypkg\src\ghidradbg\util.py", line 290, in _func
    return func(*args, **kwargs)
  File "C:\ghidra\ghidra_11.3\Ghidra\Debug\Debugger-agent-dbgeng\pypkg\src\ghidradbg\commands.py", line 1137, in put_breakpoints  
    put_single_breakpoint(bp, ibobj, nproc, ikeys)
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ghidra\ghidra_11.3\Ghidra\Debug\Debugger-agent-dbgeng\pypkg\src\ghidradbg\util.py", line 290, in _func
    return func(*args, **kwargs)
  File "C:\ghidra\ghidra_11.3\Ghidra\Debug\Debugger-agent-dbgeng\pypkg\src\ghidradbg\commands.py", line 1073, in put_single_breakp
oint
    prot = {4: 'HW_EXECUTE', 2: 'READ', 1: 'WRITE'}[prot]
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
KeyError: 3
0:000>

I don't think I have enough power to push that further :D

@bukowa
Copy link
Author

bukowa commented Feb 13, 2025

It happens when this breakpoints is added with address 000000 (why is it added? )

Image

You try to clear it

Image

And there's the error.
And later everything breaks.
It may be related to dbgmodel (try with and without)

Error caused by front end
Traceback (most recent call last):
  File "C:\ghidra\ghidra_11.3\Ghidra\Debug\Debugger-agent-dbgeng\pypkg\src\ghidradbg\methods.py", line 169, in find_bpt_by_number 
    bp = dbg()._control.GetBreakpointById(breaknum)
  File "C:\ghidra\ghidra_11.3\Contrib\PYTHON\venv_windbg\Lib\site-packages\pybag\dbgeng\idebugcontrol.py", line 383, in GetBreakpo
intById
    exception.check_err(hr)
    ~~~~~~~~~~~~~~~~~~~^^^^
  File "C:\ghidra\ghidra_11.3\Contrib\PYTHON\venv_windbg\Lib\site-packages\pybag\dbgeng\exception.py", line 60, in check_err      
    raise err
pybag.dbgeng.exception.E_NOINTERFACE_Error: The object searched for was not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\ghidra\ghidra_11.3\Ghidra\Debug\Debugger-rmi-trace\pypkg\src\ghidratrace\client.py", line 65, in _handle_invoke_method 
    result = self.client._handle_invoke_method(request)
  File "C:\ghidra\ghidra_11.3\Ghidra\Debug\Debugger-rmi-trace\pypkg\src\ghidratrace\client.py", line 1146, in _handle_invoke_metho
d
    return method.callback(**kwargs)
           ~~~~~~~~~~~~~~~^^^^^^^^^^
  File "C:\ghidra\ghidra_11.3\Ghidra\Debug\Debugger-agent-dbgeng\pypkg\src\ghidradbg\util.py", line 292, in _func
    return self.run(func, *args, **kwargs)
           ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\ghidra\ghidra_11.3\Ghidra\Debug\Debugger-agent-dbgeng\pypkg\src\ghidradbg\util.py", line 261, in run
    return future.result(0.5)
           ~~~~~~~~~~~~~^^^^^
  File "C:\users\buk\appdata\local\programs\python\python313\Lib\concurrent\futures\_base.py", line 456, in result
    return self.__get_result()
           ~~~~~~~~~~~~~~~~~^^
  File "C:\users\buk\appdata\local\programs\python\python313\Lib\concurrent\futures\_base.py", line 401, in __get_result
    raise self._exception
  File "C:\ghidra\ghidra_11.3\Ghidra\Debug\Debugger-agent-dbgeng\pypkg\src\ghidradbg\util.py", line 119, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\ghidra\ghidra_11.3\Ghidra\Debug\Debugger-agent-dbgeng\pypkg\src\ghidradbg\methods.py", line 543, in delete_breakpoint  
    bpt = find_bpt_by_obj(breakpoint)
  File "C:\ghidra\ghidra_11.3\Ghidra\Debug\Debugger-agent-dbgeng\pypkg\src\ghidradbg\methods.py", line 184, in find_bpt_by_obj    
    return find_bpt_by_pattern(PROC_BREAKBPT_PATTERN, object, "a BreakpointSpec")
  File "C:\ghidra\ghidra_11.3\Ghidra\Debug\Debugger-agent-dbgeng\pypkg\src\ghidradbg\methods.py", line 180, in find_bpt_by_pattern
    return find_bpt_by_number(breaknum)
  File "C:\ghidra\ghidra_11.3\Ghidra\Debug\Debugger-agent-dbgeng\pypkg\src\ghidradbg\methods.py", line 172, in find_bpt_by_number 
    raise KeyError(f"Breakpoints[{breaknum}] does not exist")
KeyError: 'Breakpoints[1] does not exist'

@d-millar
Copy link
Collaborator

May have a lead on this or at least on a related issue - ticket in.

@d-millar d-millar added Feature: Debugger Status: Internal This is being tracked internally by the Ghidra team labels Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: Debugger Status: Internal This is being tracked internally by the Ghidra team
Projects
None yet
Development

No branches or pull requests

3 participants