[Lldb-commits] [PATCH] D52941: NativeProcessProtocol: Simplify breakpoint setting code

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 5 12:37:31 PDT 2018


labath created this revision.
labath added reviewers: krytarowski, zturner, clayborg.
Herald added a subscriber: mgorny.

A fairly simple operation as setting a breakpoint (writing a breakpoint
opcode) at a given address was going through three classes:
NativeProcessProtocol which called NativeBreakpointList, which then
called SoftwareBrekpoint, only to end up again in NativeProcessProtocol
to do the actual writing itself. This is unnecessarily complex and can
be simplified by moving all of the logic into NativeProcessProtocol
class itself, removing a lot of boilerplate.

One of the reeasons for this complexity was that (it seems)
NativeBreakpointList class was meant to hold both software and hardware
breakpoints. However, that never materialized, and hardware breakpoints
are stored in a separate map holding only hardware breakpoints.
Essentially, this patch makes software breakpoints follow that approach
by replacing the heavy SoftwareBraekpoint with a light struct of the
same name, which holds only the data necessary to describe one
breakpoint. The rest of the logic is in the main class. As, at the
lldb-server level, handling software and hardware breakpoints is very
different, this seems like a reasonable state of things.


https://reviews.llvm.org/D52941

Files:
  include/lldb/Host/common/NativeBreakpoint.h
  include/lldb/Host/common/NativeBreakpointList.h
  include/lldb/Host/common/NativeProcessProtocol.h
  include/lldb/Host/common/SoftwareBreakpoint.h
  include/lldb/lldb-private-forward.h
  lldb.xcodeproj/project.pbxproj
  source/Host/CMakeLists.txt
  source/Host/common/NativeBreakpoint.cpp
  source/Host/common/NativeBreakpointList.cpp
  source/Host/common/NativeProcessProtocol.cpp
  source/Host/common/NativeThreadProtocol.cpp
  source/Host/common/SoftwareBreakpoint.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.cpp
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52941.168507.patch
Type: text/x-patch
Size: 55329 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20181005/179ab5c4/attachment-0001.bin>


More information about the lldb-commits mailing list