Page MenuHomePhabricator

[lldb] Skip overlapping hardware and external breakpoints when writing memory
ClosedPublic

Authored by tatyana-krasnukha on Jul 21 2020, 11:21 AM.

Details

Summary

This fixes the assertion assert(intersects); in the Process::WriteMemory function.

Diff Detail

Event Timeline

labath added a subscriber: labath.Jul 22 2020, 1:15 AM

When does this assertion fire? Is this breaking an existing test? Should we be adding a new one?

BreakpointSite::IntersectsRange returns false for hardware breakpoints, that's why the assertion fails.

Since my bare-metal target loads process's memory via Process::WriteMemory, I have 200+ unresolved tests without this change.

The added test should reproduce the issue for other targets too.

labath accepted this revision.Jul 23 2020, 4:32 AM

BreakpointSite::IntersectsRange returns false for hardware breakpoints, that's why the assertion fails.

Since my bare-metal target loads process's memory via Process::WriteMemory, I have 200+ unresolved tests without this change.

The added test should reproduce the issue for other targets too.

I see. That makes sense, thanks for the test.

My eyes nearly popped out when I saw that we were debugging a process from _inside_ a decorator (to determine watchpoint support status). I don't know when this stuff was introduced -- it sounds like a bad idea to me -- but I don't want to hold up your patch over that.

lldb/test/API/functionalities/breakpoint/hardware_breakpoints/write_memory_with_hw_breakpoint/TestWriteMemoryWithHWBreakpoint.py
23–34

These days we have helper functions for this typical test setup. I guess this could be lldbutil.run_to_name_breakpoint

51

We also have a new assertSuccess helper with better error messages. It would be better to write this as assertSuccess(error); assertEquals(result, len(bytes))

This revision is now accepted and ready to land.Jul 23 2020, 4:32 AM
This revision was landed with ongoing or failed builds.Jul 29 2020, 11:27 AM
This revision was automatically updated to reflect the committed changes.