aboutsummaryrefslogtreecommitdiffstats
path: root/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-01-19 10:06:29 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-01-19 10:06:29 +0000
commit94994d372d014ce4c8758b9605d63fae651bd8aa (patch)
tree51c0b708bd59f205d6b35cb2a8c24d62f0c33d77 /source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
parent39be7ce23363d12ae3e49aeb1fdb2bfeb892e836 (diff)
downloadsrc-94994d372d014ce4c8758b9605d63fae651bd8aa.tar.gz
src-94994d372d014ce4c8758b9605d63fae651bd8aa.zip
Vendor import of lldb trunk r351319 (just before the release_80 branchvendor/lldb/lldb-trunk-r351319
Notes
Notes: svn path=/vendor/lldb/dist/; revision=343181 svn path=/vendor/lldb/lldb-trunk-r351319/; revision=343182; tag=vendor/lldb/lldb-trunk-r351319
Diffstat (limited to 'source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp')
-rw-r--r--source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp128
1 files changed, 2 insertions, 126 deletions
diff --git a/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp b/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
index 1a4cb21d000e..a1b7d7df4553 100644
--- a/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
+++ b/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
@@ -9,18 +9,14 @@
#include "NativeProcessNetBSD.h"
-// C Includes
-// C++ Includes
-// Other libraries and framework includes
#include "Plugins/Process/POSIX/ProcessPOSIXLog.h"
-#include "lldb/Core/State.h"
#include "lldb/Host/HostProcess.h"
-#include "lldb/Host/common/NativeBreakpoint.h"
#include "lldb/Host/common/NativeRegisterContext.h"
#include "lldb/Host/posix/ProcessLauncherPosixFork.h"
#include "lldb/Target/Process.h"
+#include "lldb/Utility/State.h"
#include "llvm/Support/Errno.h"
// System includes - They have to be included after framework includes because
@@ -322,100 +318,6 @@ Status NativeProcessNetBSD::PtraceWrapper(int req, lldb::pid_t pid, void *addr,
return error;
}
-Status NativeProcessNetBSD::GetSoftwareBreakpointPCOffset(
- uint32_t &actual_opcode_size) {
- // FIXME put this behind a breakpoint protocol class that can be
- // set per architecture. Need ARM, MIPS support here.
- static const uint8_t g_i386_opcode[] = {0xCC};
- switch (m_arch.GetMachine()) {
- case llvm::Triple::x86_64:
- actual_opcode_size = static_cast<uint32_t>(sizeof(g_i386_opcode));
- return Status();
- default:
- assert(false && "CPU type not supported!");
- return Status("CPU type not supported");
- }
-}
-
-Status
-NativeProcessNetBSD::FixupBreakpointPCAsNeeded(NativeThreadNetBSD &thread) {
- Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS));
- Status error;
- // Find out the size of a breakpoint (might depend on where we are in the
- // code).
- NativeRegisterContext& context = thread.GetRegisterContext();
- uint32_t breakpoint_size = 0;
- error = GetSoftwareBreakpointPCOffset(breakpoint_size);
- if (error.Fail()) {
- LLDB_LOG(log, "GetBreakpointSize() failed: {0}", error);
- return error;
- } else
- LLDB_LOG(log, "breakpoint size: {0}", breakpoint_size);
- // First try probing for a breakpoint at a software breakpoint location: PC -
- // breakpoint size.
- const lldb::addr_t initial_pc_addr =
- context.GetPCfromBreakpointLocation();
- lldb::addr_t breakpoint_addr = initial_pc_addr;
- if (breakpoint_size > 0) {
- // Do not allow breakpoint probe to wrap around.
- if (breakpoint_addr >= breakpoint_size)
- breakpoint_addr -= breakpoint_size;
- }
- // Check if we stopped because of a breakpoint.
- NativeBreakpointSP breakpoint_sp;
- error = m_breakpoint_list.GetBreakpoint(breakpoint_addr, breakpoint_sp);
- if (!error.Success() || !breakpoint_sp) {
- // We didn't find one at a software probe location. Nothing to do.
- LLDB_LOG(log,
- "pid {0} no lldb breakpoint found at current pc with "
- "adjustment: {1}",
- GetID(), breakpoint_addr);
- return Status();
- }
- // If the breakpoint is not a software breakpoint, nothing to do.
- if (!breakpoint_sp->IsSoftwareBreakpoint()) {
- LLDB_LOG(
- log,
- "pid {0} breakpoint found at {1:x}, not software, nothing to adjust",
- GetID(), breakpoint_addr);
- return Status();
- }
- //
- // We have a software breakpoint and need to adjust the PC.
- //
- // Sanity check.
- if (breakpoint_size == 0) {
- // Nothing to do! How did we get here?
- LLDB_LOG(log,
- "pid {0} breakpoint found at {1:x}, it is software, but the "
- "size is zero, nothing to do (unexpected)",
- GetID(), breakpoint_addr);
- return Status();
- }
- //
- // We have a software breakpoint and need to adjust the PC.
- //
- // Sanity check.
- if (breakpoint_size == 0) {
- // Nothing to do! How did we get here?
- LLDB_LOG(log,
- "pid {0} breakpoint found at {1:x}, it is software, but the "
- "size is zero, nothing to do (unexpected)",
- GetID(), breakpoint_addr);
- return Status();
- }
- // Change the program counter.
- LLDB_LOG(log, "pid {0} tid {1}: changing PC from {2:x} to {3:x}", GetID(),
- thread.GetID(), initial_pc_addr, breakpoint_addr);
- error = context.SetPC(breakpoint_addr);
- if (error.Fail()) {
- LLDB_LOG(log, "pid {0} tid {1}: failed to set PC: {2}", GetID(),
- thread.GetID(), error);
- return error;
- }
- return error;
-}
-
Status NativeProcessNetBSD::Resume(const ResumeActionList &resume_actions) {
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
LLDB_LOG(log, "pid {0}", GetID());
@@ -637,7 +539,7 @@ Status NativeProcessNetBSD::PopulateMemoryRegionCache() {
info.SetName(vm[i].kve_path);
m_mem_region_cache.emplace_back(
- info, FileSpec(info.GetName().GetCString(), true));
+ info, FileSpec(info.GetName().GetCString()));
}
free(vm);
@@ -682,23 +584,6 @@ Status NativeProcessNetBSD::SetBreakpoint(lldb::addr_t addr, uint32_t size,
return SetSoftwareBreakpoint(addr, size);
}
-Status NativeProcessNetBSD::GetSoftwareBreakpointTrapOpcode(
- size_t trap_opcode_size_hint, size_t &actual_opcode_size,
- const uint8_t *&trap_opcode_bytes) {
- static const uint8_t g_i386_opcode[] = {0xCC};
-
- switch (m_arch.GetMachine()) {
- case llvm::Triple::x86:
- case llvm::Triple::x86_64:
- trap_opcode_bytes = g_i386_opcode;
- actual_opcode_size = sizeof(g_i386_opcode);
- return Status();
- default:
- assert(false && "CPU type not supported!");
- return Status("CPU type not supported");
- }
-}
-
Status NativeProcessNetBSD::GetLoadedModuleFileSpec(const char *module_path,
FileSpec &file_spec) {
return Status("Unimplemented");
@@ -824,15 +709,6 @@ Status NativeProcessNetBSD::ReadMemory(lldb::addr_t addr, void *buf,
return Status();
}
-Status NativeProcessNetBSD::ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf,
- size_t size,
- size_t &bytes_read) {
- Status error = ReadMemory(addr, buf, size, bytes_read);
- if (error.Fail())
- return error;
- return m_breakpoint_list.RemoveTrapsFromBuffer(addr, buf, size);
-}
-
Status NativeProcessNetBSD::WriteMemory(lldb::addr_t addr, const void *buf,
size_t size, size_t &bytes_written) {
const unsigned char *src = static_cast<const unsigned char *>(buf);