aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Host/common/NativeProcessProtocol.cpp
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2018-09-30 15:58:52 +0000
committerPavel Labath <pavel@labath.sk>2018-09-30 15:58:52 +0000
commit99f436b0554a0ba1bf276eae93d83db3a7f674f2 (patch)
tree0014d8715349f5b3784187521642f74536cb8c77 /lldb/source/Host/common/NativeProcessProtocol.cpp
parentc37e58cc19272304e88611a4b838b01890d982cf (diff)
downloadllvm-99f436b0554a0ba1bf276eae93d83db3a7f674f2.zip
llvm-99f436b0554a0ba1bf276eae93d83db3a7f674f2.tar.gz
llvm-99f436b0554a0ba1bf276eae93d83db3a7f674f2.tar.bz2
Pull GetSoftwareBreakpointPCOffset into base class
Summary: This function encodes the knowledge of whether the PC points to the breakpoint instruction of the one following it after the breakpoint is "hit". This behavior mainly(*) depends on the architecture and not on the OS, so it makes sense for it to be implemented in the base class, where it can be shared between different implementations (Linux and NetBSD atm). (*) It is possible for an OS to expose a different API, perhaps by doing some fixups in the kernel. In this case, the implementation can override this function to implement custom behavior. Reviewers: krytarowski, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D52532 llvm-svn: 343409
Diffstat (limited to 'lldb/source/Host/common/NativeProcessProtocol.cpp')
-rw-r--r--lldb/source/Host/common/NativeProcessProtocol.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/lldb/source/Host/common/NativeProcessProtocol.cpp b/lldb/source/Host/common/NativeProcessProtocol.cpp
index 17098fd..ef063d5 100644
--- a/lldb/source/Host/common/NativeProcessProtocol.cpp
+++ b/lldb/source/Host/common/NativeProcessProtocol.cpp
@@ -409,6 +409,29 @@ NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode(size_t size_hint) {
}
}
+size_t NativeProcessProtocol::GetSoftwareBreakpointPCOffset() {
+ switch (GetArchitecture().GetMachine()) {
+ case llvm::Triple::x86:
+ case llvm::Triple::x86_64:
+ case llvm::Triple::systemz:
+ // These architectures report increment the PC after breakpoint is hit.
+ return cantFail(GetSoftwareBreakpointTrapOpcode(0)).size();
+
+ case llvm::Triple::arm:
+ case llvm::Triple::aarch64:
+ case llvm::Triple::mips64:
+ case llvm::Triple::mips64el:
+ case llvm::Triple::mips:
+ case llvm::Triple::mipsel:
+ case llvm::Triple::ppc64le:
+ // On these architectures the PC doesn't get updated for breakpoint hits.
+ return 0;
+
+ default:
+ llvm_unreachable("CPU type not supported!");
+ }
+}
+
Status NativeProcessProtocol::RemoveBreakpoint(lldb::addr_t addr,
bool hardware) {
if (hardware)