Rename Error -> Status.
This renames the LLDB error class to Status, as discussed
on the lldb-dev mailing list.
A change of this magnitude cannot easily be done without
find and replace, but that has potential to catch unwanted
occurrences of common strings such as "Error". Every effort
was made to find all the obvious things such as the word "Error"
appearing in a string, etc, but it's possible there are still
some lingering occurences left around. Hopefully nothing too
serious.
llvm-svn: 302872
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
index 914d690..15e7c9b 100644
--- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
@@ -40,8 +40,8 @@
#include "lldb/Target/Process.h"
#include "lldb/Target/ProcessLaunchInfo.h"
#include "lldb/Target/Target.h"
-#include "lldb/Utility/Error.h"
#include "lldb/Utility/LLDBAssert.h"
+#include "lldb/Utility/Status.h"
#include "lldb/Utility/StringExtractor.h"
#include "NativeThreadLinux.h"
@@ -193,8 +193,8 @@
// Simple helper function to ensure flags are enabled on the given file
// descriptor.
-static Error EnsureFDFlags(int fd, int flags) {
- Error error;
+static Status EnsureFDFlags(int fd, int flags) {
+ Status error;
int status = fcntl(fd, F_GETFL);
if (status == -1) {
@@ -214,13 +214,13 @@
// Public Static Methods
// -----------------------------------------------------------------------------
-Error NativeProcessProtocol::Launch(
+Status NativeProcessProtocol::Launch(
ProcessLaunchInfo &launch_info,
NativeProcessProtocol::NativeDelegate &native_delegate, MainLoop &mainloop,
NativeProcessProtocolSP &native_process_sp) {
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
- Error error;
+ Status error;
// Verify the working directory is valid if one was specified.
FileSpec working_dir{launch_info.GetWorkingDirectory()};
@@ -254,7 +254,7 @@
return error;
}
-Error NativeProcessProtocol::Attach(
+Status NativeProcessProtocol::Attach(
lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate,
MainLoop &mainloop, NativeProcessProtocolSP &native_process_sp) {
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
@@ -262,7 +262,7 @@
// Retrieve the architecture for the running process.
ArchSpec process_arch;
- Error error = ResolveProcessArchitecture(pid, process_arch);
+ Status error = ResolveProcessArchitecture(pid, process_arch);
if (!error.Success())
return error;
@@ -292,7 +292,7 @@
m_pending_notification_tid(LLDB_INVALID_THREAD_ID) {}
void NativeProcessLinux::AttachToInferior(MainLoop &mainloop, lldb::pid_t pid,
- Error &error) {
+ Status &error) {
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
LLDB_LOG(log, "pid = {0:x}", pid);
@@ -314,9 +314,9 @@
Attach(pid, error);
}
-Error NativeProcessLinux::LaunchInferior(MainLoop &mainloop,
- ProcessLaunchInfo &launch_info) {
- Error error;
+Status NativeProcessLinux::LaunchInferior(MainLoop &mainloop,
+ ProcessLaunchInfo &launch_info) {
+ Status error;
m_sigchld_handle = mainloop.RegisterSignal(
SIGCHLD, [this](MainLoopBase &) { SigchldHandler(); }, error);
if (!m_sigchld_handle)
@@ -402,7 +402,7 @@
return error;
}
-::pid_t NativeProcessLinux::Attach(lldb::pid_t pid, Error &error) {
+::pid_t NativeProcessLinux::Attach(lldb::pid_t pid, Status &error) {
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
// Use a map to keep track of the threads which we have attached/need to
@@ -484,7 +484,7 @@
return pid;
}
-Error NativeProcessLinux::SetDefaultPtraceOpts(lldb::pid_t pid) {
+Status NativeProcessLinux::SetDefaultPtraceOpts(lldb::pid_t pid) {
long ptrace_opts = 0;
// Have the child raise an event on exit. This is used to keep the child in
@@ -857,7 +857,7 @@
{
// If a watchpoint was hit, report it
uint32_t wp_index;
- Error error = thread.GetRegisterContext()->GetWatchpointHitIndex(
+ Status error = thread.GetRegisterContext()->GetWatchpointHitIndex(
wp_index, (uintptr_t)info.si_addr);
if (error.Fail())
LLDB_LOG(log,
@@ -894,7 +894,7 @@
{
// If a watchpoint was hit, report it
uint32_t wp_index;
- Error error = thread.GetRegisterContext()->GetWatchpointHitIndex(
+ Status error = thread.GetRegisterContext()->GetWatchpointHitIndex(
wp_index, LLDB_INVALID_ADDRESS);
if (error.Fail())
LLDB_LOG(log,
@@ -950,7 +950,7 @@
// Mark the thread as stopped at breakpoint.
thread.SetStoppedByBreakpoint();
- Error error = FixupBreakpointPCAsNeeded(thread);
+ Status error = FixupBreakpointPCAsNeeded(thread);
if (error.Fail())
LLDB_LOG(log, "pid = {0} fixup: {1}", thread.GetID(), error);
@@ -1032,7 +1032,7 @@
} else {
// We can end up here if stop was initiated by LLGS but by this time a
// thread stop has occurred - maybe initiated by another event.
- Error error = ResumeThread(thread, thread.GetState(), 0);
+ Status error = ResumeThread(thread, thread.GetState(), 0);
if (error.Fail())
LLDB_LOG(log, "failed to resume thread {0}: {1}", thread.GetID(),
error);
@@ -1108,7 +1108,7 @@
emulator_baton->m_reg_context->GetRegisterInfo(
eRegisterKindDWARF, reg_info->kinds[eRegisterKindDWARF]);
- Error error =
+ Status error =
emulator_baton->m_reg_context->ReadRegister(full_reg_info, reg_value);
if (error.Success())
return true;
@@ -1140,9 +1140,9 @@
LLDB_INVALID_ADDRESS);
}
-Error NativeProcessLinux::SetupSoftwareSingleStepping(
- NativeThreadLinux &thread) {
- Error error;
+Status
+NativeProcessLinux::SetupSoftwareSingleStepping(NativeThreadLinux &thread) {
+ Status error;
NativeRegisterContextSP register_context_sp = thread.GetRegisterContext();
std::unique_ptr<EmulateInstruction> emulator_ap(
@@ -1150,7 +1150,7 @@
nullptr));
if (emulator_ap == nullptr)
- return Error("Instruction emulator not found!");
+ return Status("Instruction emulator not found!");
EmulatorBaton baton(this, register_context_sp.get());
emulator_ap->SetBaton(&baton);
@@ -1160,7 +1160,7 @@
emulator_ap->SetWriteRegCallback(&WriteRegisterCallback);
if (!emulator_ap->ReadInstruction())
- return Error("Read instruction failed!");
+ return Status("Read instruction failed!");
bool emulation_result =
emulator_ap->EvaluateInstruction(eEmulateInstructionOptionAutoAdvancePC);
@@ -1198,7 +1198,7 @@
// The instruction emulation failed after it modified the PC. It is an
// unknown error where we can't continue because the next instruction is
// modifying the PC but we don't know how.
- return Error("Instruction emulation failed unexpectedly.");
+ return Status("Instruction emulation failed unexpectedly.");
}
if (m_arch.GetMachine() == llvm::Triple::arm) {
@@ -1222,13 +1222,13 @@
// If setting the breakpoint fails because next_pc is out of
// the address space, ignore it and let the debugee segfault.
if (error.GetError() == EIO || error.GetError() == EFAULT) {
- return Error();
+ return Status();
} else if (error.Fail())
return error;
m_threads_stepping_with_breakpoint.insert({thread.GetID(), next_pc});
- return Error();
+ return Status();
}
bool NativeProcessLinux::SupportHardwareSingleStepping() const {
@@ -1241,7 +1241,7 @@
return true;
}
-Error NativeProcessLinux::Resume(const ResumeActionList &resume_actions) {
+Status NativeProcessLinux::Resume(const ResumeActionList &resume_actions) {
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
LLDB_LOG(log, "pid {0}", GetID());
@@ -1257,7 +1257,7 @@
continue;
if (action->state == eStateStepping) {
- Error error = SetupSoftwareSingleStepping(
+ Status error = SetupSoftwareSingleStepping(
static_cast<NativeThreadLinux &>(*thread_sp));
if (error.Fail())
return error;
@@ -1295,18 +1295,18 @@
llvm_unreachable("Unexpected state");
default:
- return Error("NativeProcessLinux::%s (): unexpected state %s specified "
- "for pid %" PRIu64 ", tid %" PRIu64,
- __FUNCTION__, StateAsCString(action->state), GetID(),
- thread_sp->GetID());
+ return Status("NativeProcessLinux::%s (): unexpected state %s specified "
+ "for pid %" PRIu64 ", tid %" PRIu64,
+ __FUNCTION__, StateAsCString(action->state), GetID(),
+ thread_sp->GetID());
}
}
- return Error();
+ return Status();
}
-Error NativeProcessLinux::Halt() {
- Error error;
+Status NativeProcessLinux::Halt() {
+ Status error;
if (kill(GetID(), SIGSTOP) != 0)
error.SetErrorToErrno();
@@ -1314,8 +1314,8 @@
return error;
}
-Error NativeProcessLinux::Detach() {
- Error error;
+Status NativeProcessLinux::Detach() {
+ Status error;
// Stop monitoring the inferior.
m_sigchld_handle.reset();
@@ -1325,7 +1325,7 @@
return error;
for (auto thread_sp : m_threads) {
- Error e = Detach(thread_sp->GetID());
+ Status e = Detach(thread_sp->GetID());
if (e.Fail())
error =
e; // Save the error, but still attempt to detach from other threads.
@@ -1334,8 +1334,8 @@
return error;
}
-Error NativeProcessLinux::Signal(int signo) {
- Error error;
+Status NativeProcessLinux::Signal(int signo) {
+ Status error;
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
LLDB_LOG(log, "sending signal {0} ({1}) to pid {1}", signo,
@@ -1347,7 +1347,7 @@
return error;
}
-Error NativeProcessLinux::Interrupt() {
+Status NativeProcessLinux::Interrupt() {
// Pick a running thread (or if none, a not-dead stopped thread) as
// the chosen thread that will be the stop-reason thread.
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
@@ -1375,8 +1375,8 @@
}
if (!running_thread_sp && !stopped_thread_sp) {
- Error error("found no running/stepping or live stopped threads as target "
- "for interrupt");
+ Status error("found no running/stepping or live stopped threads as target "
+ "for interrupt");
LLDB_LOG(log, "skipping due to error: {0}", error);
return error;
@@ -1391,14 +1391,14 @@
StopRunningThreads(deferred_signal_thread_sp->GetID());
- return Error();
+ return Status();
}
-Error NativeProcessLinux::Kill() {
+Status NativeProcessLinux::Kill() {
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
LLDB_LOG(log, "pid {0}", GetID());
- Error error;
+ Status error;
switch (m_state) {
case StateType::eStateInvalid:
@@ -1430,7 +1430,7 @@
return error;
}
-static Error
+static Status
ParseMemoryRegionInfoFromProcMapsLine(llvm::StringRef &maps_line,
MemoryRegionInfo &memory_region_info) {
memory_region_info.Clear();
@@ -1447,7 +1447,7 @@
// Parse out hyphen separating start and end address from range.
if (!line_extractor.GetBytesLeft() || (line_extractor.GetChar() != '-'))
- return Error(
+ return Status(
"malformed /proc/{pid}/maps entry, missing dash between address range");
// Parse out the ending address
@@ -1455,7 +1455,8 @@
// Parse out the space after the address.
if (!line_extractor.GetBytesLeft() || (line_extractor.GetChar() != ' '))
- return Error("malformed /proc/{pid}/maps entry, missing space after range");
+ return Status(
+ "malformed /proc/{pid}/maps entry, missing space after range");
// Save the range.
memory_region_info.GetRange().SetRangeBase(start_address);
@@ -1467,8 +1468,8 @@
// Parse out each permission entry.
if (line_extractor.GetBytesLeft() < 4)
- return Error("malformed /proc/{pid}/maps entry, missing some portion of "
- "permissions");
+ return Status("malformed /proc/{pid}/maps entry, missing some portion of "
+ "permissions");
// Handle read permission.
const char read_perm_char = line_extractor.GetChar();
@@ -1477,7 +1478,7 @@
else if (read_perm_char == '-')
memory_region_info.SetReadable(MemoryRegionInfo::OptionalBool::eNo);
else
- return Error("unexpected /proc/{pid}/maps read permission char");
+ return Status("unexpected /proc/{pid}/maps read permission char");
// Handle write permission.
const char write_perm_char = line_extractor.GetChar();
@@ -1486,7 +1487,7 @@
else if (write_perm_char == '-')
memory_region_info.SetWritable(MemoryRegionInfo::OptionalBool::eNo);
else
- return Error("unexpected /proc/{pid}/maps write permission char");
+ return Status("unexpected /proc/{pid}/maps write permission char");
// Handle execute permission.
const char exec_perm_char = line_extractor.GetChar();
@@ -1495,7 +1496,7 @@
else if (exec_perm_char == '-')
memory_region_info.SetExecutable(MemoryRegionInfo::OptionalBool::eNo);
else
- return Error("unexpected /proc/{pid}/maps exec permission char");
+ return Status("unexpected /proc/{pid}/maps exec permission char");
line_extractor.GetChar(); // Read the private bit
line_extractor.SkipSpaces(); // Skip the separator
@@ -1511,11 +1512,11 @@
if (name)
memory_region_info.SetName(name);
- return Error();
+ return Status();
}
-Error NativeProcessLinux::GetMemoryRegionInfo(lldb::addr_t load_addr,
- MemoryRegionInfo &range_info) {
+Status NativeProcessLinux::GetMemoryRegionInfo(lldb::addr_t load_addr,
+ MemoryRegionInfo &range_info) {
// FIXME review that the final memory region returned extends to the end of
// the virtual address space,
// with no perms if it is not mapped.
@@ -1526,10 +1527,10 @@
if (m_supports_mem_region == LazyBool::eLazyBoolNo) {
// We're done.
- return Error("unsupported");
+ return Status("unsupported");
}
- Error error = PopulateMemoryRegionCache();
+ Status error = PopulateMemoryRegionCache();
if (error.Fail()) {
return error;
}
@@ -1585,7 +1586,7 @@
return error;
}
-Error NativeProcessLinux::PopulateMemoryRegionCache() {
+Status NativeProcessLinux::PopulateMemoryRegionCache() {
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
// If our cache is empty, pull the latest. There should always be at least
@@ -1593,7 +1594,7 @@
if (!m_mem_region_cache.empty()) {
LLDB_LOG(log, "reusing {0} cached memory region entries",
m_mem_region_cache.size());
- return Error();
+ return Status();
}
auto BufferOrError = getProcFile(GetID(), "maps");
@@ -1606,7 +1607,8 @@
StringRef Line;
std::tie(Line, Rest) = Rest.split('\n');
MemoryRegionInfo info;
- const Error parse_error = ParseMemoryRegionInfoFromProcMapsLine(Line, info);
+ const Status parse_error =
+ ParseMemoryRegionInfoFromProcMapsLine(Line, info);
if (parse_error.Fail()) {
LLDB_LOG(log, "failed to parse proc maps line '{0}': {1}", Line,
parse_error);
@@ -1625,7 +1627,7 @@
LLDB_LOG(log,
"failed to find any procfs maps entries, assuming no support "
"for memory region metadata retrieval");
- return Error("not supported");
+ return Status("not supported");
}
LLDB_LOG(log, "read {0} memory region entries from /proc/{1}/maps",
@@ -1633,7 +1635,7 @@
// We support memory retrieval, remember that.
m_supports_mem_region = LazyBool::eLazyBoolYes;
- return Error();
+ return Status();
}
void NativeProcessLinux::DoStopIDBumped(uint32_t newBumpId) {
@@ -1644,13 +1646,13 @@
m_mem_region_cache.clear();
}
-Error NativeProcessLinux::AllocateMemory(size_t size, uint32_t permissions,
- lldb::addr_t &addr) {
+Status NativeProcessLinux::AllocateMemory(size_t size, uint32_t permissions,
+ lldb::addr_t &addr) {
// FIXME implementing this requires the equivalent of
// InferiorCallPOSIX::InferiorCallMmap, which depends on
// functional ThreadPlans working with Native*Protocol.
#if 1
- return Error("not implemented yet");
+ return Status("not implemented yet");
#else
addr = LLDB_INVALID_ADDRESS;
@@ -1668,20 +1670,20 @@
if (InferiorCallMmap(this, addr, 0, size, prot,
eMmapFlagsAnon | eMmapFlagsPrivate, -1, 0)) {
m_addr_to_mmap_size[addr] = size;
- return Error();
+ return Status();
} else {
addr = LLDB_INVALID_ADDRESS;
- return Error("unable to allocate %" PRIu64
- " bytes of memory with permissions %s",
- size, GetPermissionsAsCString(permissions));
+ return Status("unable to allocate %" PRIu64
+ " bytes of memory with permissions %s",
+ size, GetPermissionsAsCString(permissions));
}
#endif
}
-Error NativeProcessLinux::DeallocateMemory(lldb::addr_t addr) {
+Status NativeProcessLinux::DeallocateMemory(lldb::addr_t addr) {
// FIXME see comments in AllocateMemory - required lower-level
// bits not in place yet (ThreadPlans)
- return Error("not implemented");
+ return Status("not implemented");
}
lldb::addr_t NativeProcessLinux::GetSharedLibraryInfoAddress() {
@@ -1702,7 +1704,7 @@
return true;
}
-Error NativeProcessLinux::GetSoftwareBreakpointPCOffset(
+Status NativeProcessLinux::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.
@@ -1713,11 +1715,11 @@
case llvm::Triple::x86:
case llvm::Triple::x86_64:
actual_opcode_size = static_cast<uint32_t>(sizeof(g_i386_opcode));
- return Error();
+ return Status();
case llvm::Triple::systemz:
actual_opcode_size = static_cast<uint32_t>(sizeof(g_s390x_opcode));
- return Error();
+ return Status();
case llvm::Triple::arm:
case llvm::Triple::aarch64:
@@ -1727,30 +1729,30 @@
case llvm::Triple::mipsel:
// On these architectures the PC don't get updated for breakpoint hits
actual_opcode_size = 0;
- return Error();
+ return Status();
default:
assert(false && "CPU type not supported!");
- return Error("CPU type not supported");
+ return Status("CPU type not supported");
}
}
-Error NativeProcessLinux::SetBreakpoint(lldb::addr_t addr, uint32_t size,
- bool hardware) {
+Status NativeProcessLinux::SetBreakpoint(lldb::addr_t addr, uint32_t size,
+ bool hardware) {
if (hardware)
return SetHardwareBreakpoint(addr, size);
else
return SetSoftwareBreakpoint(addr, size);
}
-Error NativeProcessLinux::RemoveBreakpoint(lldb::addr_t addr, bool hardware) {
+Status NativeProcessLinux::RemoveBreakpoint(lldb::addr_t addr, bool hardware) {
if (hardware)
return RemoveHardwareBreakpoint(addr);
else
return NativeProcessProtocol::RemoveBreakpoint(addr);
}
-Error NativeProcessLinux::GetSoftwareBreakpointTrapOpcode(
+Status NativeProcessLinux::GetSoftwareBreakpointTrapOpcode(
size_t trap_opcode_size_hint, size_t &actual_opcode_size,
const uint8_t *&trap_opcode_bytes) {
// FIXME put this behind a breakpoint protocol class that can be set per
@@ -1769,49 +1771,49 @@
case llvm::Triple::aarch64:
trap_opcode_bytes = g_aarch64_opcode;
actual_opcode_size = sizeof(g_aarch64_opcode);
- return Error();
+ return Status();
case llvm::Triple::arm:
switch (trap_opcode_size_hint) {
case 2:
trap_opcode_bytes = g_thumb_breakpoint_opcode;
actual_opcode_size = sizeof(g_thumb_breakpoint_opcode);
- return Error();
+ return Status();
case 4:
trap_opcode_bytes = g_arm_breakpoint_opcode;
actual_opcode_size = sizeof(g_arm_breakpoint_opcode);
- return Error();
+ return Status();
default:
assert(false && "Unrecognised trap opcode size hint!");
- return Error("Unrecognised trap opcode size hint!");
+ return Status("Unrecognised trap opcode size hint!");
}
case llvm::Triple::x86:
case llvm::Triple::x86_64:
trap_opcode_bytes = g_i386_opcode;
actual_opcode_size = sizeof(g_i386_opcode);
- return Error();
+ return Status();
case llvm::Triple::mips:
case llvm::Triple::mips64:
trap_opcode_bytes = g_mips64_opcode;
actual_opcode_size = sizeof(g_mips64_opcode);
- return Error();
+ return Status();
case llvm::Triple::mipsel:
case llvm::Triple::mips64el:
trap_opcode_bytes = g_mips64el_opcode;
actual_opcode_size = sizeof(g_mips64el_opcode);
- return Error();
+ return Status();
case llvm::Triple::systemz:
trap_opcode_bytes = g_s390x_opcode;
actual_opcode_size = sizeof(g_s390x_opcode);
- return Error();
+ return Status();
default:
assert(false && "CPU type not supported!");
- return Error("CPU type not supported");
+ return Status("CPU type not supported");
}
}
@@ -1964,8 +1966,8 @@
}
#endif
-Error NativeProcessLinux::ReadMemory(lldb::addr_t addr, void *buf, size_t size,
- size_t &bytes_read) {
+Status NativeProcessLinux::ReadMemory(lldb::addr_t addr, void *buf, size_t size,
+ size_t &bytes_read) {
if (ProcessVmReadvSupported()) {
// The process_vm_readv path is about 50 times faster than ptrace api. We
// want to use
@@ -1989,7 +1991,7 @@
size, addr, success ? "Success" : strerror(errno));
if (success)
- return Error();
+ return Status();
// else the call failed for some reason, let's retry the read using ptrace
// api.
}
@@ -2002,7 +2004,7 @@
LLDB_LOG(log, "addr = {0}, buf = {1}, size = {2}", addr, buf, size);
for (bytes_read = 0; bytes_read < size; bytes_read += remainder) {
- Error error = NativeProcessLinux::PtraceWrapper(
+ Status error = NativeProcessLinux::PtraceWrapper(
PTRACE_PEEKDATA, GetID(), (void *)addr, nullptr, 0, &data);
if (error.Fail())
return error;
@@ -2017,23 +2019,23 @@
addr += k_ptrace_word_size;
dst += k_ptrace_word_size;
}
- return Error();
+ return Status();
}
-Error NativeProcessLinux::ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf,
- size_t size,
- size_t &bytes_read) {
- Error error = ReadMemory(addr, buf, size, bytes_read);
+Status NativeProcessLinux::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);
}
-Error NativeProcessLinux::WriteMemory(lldb::addr_t addr, const void *buf,
- size_t size, size_t &bytes_written) {
+Status NativeProcessLinux::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);
size_t remainder;
- Error error;
+ Status error;
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_MEMORY));
LLDB_LOG(log, "addr = {0}, buf = {1}, size = {2}", addr, buf, size);
@@ -2075,18 +2077,18 @@
return error;
}
-Error NativeProcessLinux::GetSignalInfo(lldb::tid_t tid, void *siginfo) {
+Status NativeProcessLinux::GetSignalInfo(lldb::tid_t tid, void *siginfo) {
return PtraceWrapper(PTRACE_GETSIGINFO, tid, nullptr, siginfo);
}
-Error NativeProcessLinux::GetEventMessage(lldb::tid_t tid,
- unsigned long *message) {
+Status NativeProcessLinux::GetEventMessage(lldb::tid_t tid,
+ unsigned long *message) {
return PtraceWrapper(PTRACE_GETEVENTMSG, tid, nullptr, message);
}
-Error NativeProcessLinux::Detach(lldb::tid_t tid) {
+Status NativeProcessLinux::Detach(lldb::tid_t tid) {
if (tid == LLDB_INVALID_THREAD_ID)
- return Error();
+ return Status();
return PtraceWrapper(PTRACE_DETACH, tid);
}
@@ -2137,10 +2139,11 @@
return thread_sp;
}
-Error NativeProcessLinux::FixupBreakpointPCAsNeeded(NativeThreadLinux &thread) {
+Status
+NativeProcessLinux::FixupBreakpointPCAsNeeded(NativeThreadLinux &thread) {
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_BREAKPOINTS));
- Error error;
+ Status error;
// Find out the size of a breakpoint (might depend on where we are in the
// code).
@@ -2179,7 +2182,7 @@
"pid {0} no lldb breakpoint found at current pc with "
"adjustment: {1}",
GetID(), breakpoint_addr);
- return Error();
+ return Status();
}
// If the breakpoint is not a software breakpoint, nothing to do.
@@ -2188,7 +2191,7 @@
log,
"pid {0} breakpoint found at {1:x}, not software, nothing to adjust",
GetID(), breakpoint_addr);
- return Error();
+ return Status();
}
//
@@ -2202,7 +2205,7 @@
"pid {0} breakpoint found at {1:x}, it is software, but the "
"size is zero, nothing to do (unexpected)",
GetID(), breakpoint_addr);
- return Error();
+ return Status();
}
// Change the program counter.
@@ -2219,9 +2222,9 @@
return error;
}
-Error NativeProcessLinux::GetLoadedModuleFileSpec(const char *module_path,
- FileSpec &file_spec) {
- Error error = PopulateMemoryRegionCache();
+Status NativeProcessLinux::GetLoadedModuleFileSpec(const char *module_path,
+ FileSpec &file_spec) {
+ Status error = PopulateMemoryRegionCache();
if (error.Fail())
return error;
@@ -2231,17 +2234,17 @@
for (const auto &it : m_mem_region_cache) {
if (it.second.GetFilename() == module_file_spec.GetFilename()) {
file_spec = it.second;
- return Error();
+ return Status();
}
}
- return Error("Module file (%s) not found in /proc/%" PRIu64 "/maps file!",
- module_file_spec.GetFilename().AsCString(), GetID());
+ return Status("Module file (%s) not found in /proc/%" PRIu64 "/maps file!",
+ module_file_spec.GetFilename().AsCString(), GetID());
}
-Error NativeProcessLinux::GetFileLoadAddress(const llvm::StringRef &file_name,
- lldb::addr_t &load_addr) {
+Status NativeProcessLinux::GetFileLoadAddress(const llvm::StringRef &file_name,
+ lldb::addr_t &load_addr) {
load_addr = LLDB_INVALID_ADDRESS;
- Error error = PopulateMemoryRegionCache();
+ Status error = PopulateMemoryRegionCache();
if (error.Fail())
return error;
@@ -2249,10 +2252,10 @@
for (const auto &it : m_mem_region_cache) {
if (it.second == file) {
load_addr = it.first.GetRange().GetRangeBase();
- return Error();
+ return Status();
}
}
- return Error("No load address found for specified file.");
+ return Status("No load address found for specified file.");
}
NativeThreadLinuxSP NativeProcessLinux::GetThreadByID(lldb::tid_t tid) {
@@ -2260,8 +2263,8 @@
NativeProcessProtocol::GetThreadByID(tid));
}
-Error NativeProcessLinux::ResumeThread(NativeThreadLinux &thread,
- lldb::StateType state, int signo) {
+Status NativeProcessLinux::ResumeThread(NativeThreadLinux &thread,
+ lldb::StateType state, int signo) {
Log *const log = ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_THREAD);
LLDB_LOG(log, "tid: {0}", thread.GetID());
@@ -2336,7 +2339,7 @@
// Clear any temporary breakpoints we used to implement software single
// stepping.
for (const auto &thread_info : m_threads_stepping_with_breakpoint) {
- Error error = RemoveBreakpoint(thread_info.second);
+ Status error = RemoveBreakpoint(thread_info.second);
if (error.Fail())
LLDB_LOG(log, "pid = {0} remove stepping breakpoint: {1}",
thread_info.first, error);
@@ -2376,7 +2379,7 @@
if (errno == EINTR)
continue;
- Error error(errno, eErrorTypePOSIX);
+ Status error(errno, eErrorTypePOSIX);
LLDB_LOG(log, "waitpid (-1, &status, _) failed: {0}", error);
break;
}
@@ -2414,10 +2417,10 @@
// Wrapper for ptrace to catch errors and log calls.
// Note that ptrace sets errno on error because -1 can be a valid result (i.e.
// for PTRACE_PEEK*)
-Error NativeProcessLinux::PtraceWrapper(int req, lldb::pid_t pid, void *addr,
- void *data, size_t data_size,
- long *result) {
- Error error;
+Status NativeProcessLinux::PtraceWrapper(int req, lldb::pid_t pid, void *addr,
+ void *data, size_t data_size,
+ long *result) {
+ Status error;
long int ret;
Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PTRACE));