diff options
Diffstat (limited to 'source/Plugins/Process/Darwin')
10 files changed, 183 insertions, 180 deletions
diff --git a/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp b/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp index feb7a11584f8..6845a36730c9 100644 --- a/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp +++ b/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp @@ -32,8 +32,8 @@ #include "lldb/Host/PseudoTerminal.h" #include "lldb/Target/ProcessLaunchInfo.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/StreamString.h" #include "CFBundle.h" @@ -131,10 +131,10 @@ static bool ResolveExecutablePath(const char *path, char *resolved_path, // TODO check if we have a general purpose fork and exec. We may be // able to get rid of this entirely. -static Error ForkChildForPTraceDebugging(const char *path, char const *argv[], - char const *envp[], ::pid_t *pid, - int *pty_fd) { - Error error; +static Status ForkChildForPTraceDebugging(const char *path, char const *argv[], + char const *envp[], ::pid_t *pid, + int *pty_fd) { + Status error; if (!path || !argv || !envp || !pid || !pty_fd) { error.SetErrorString("invalid arguments"); return error; @@ -149,7 +149,7 @@ static Error ForkChildForPTraceDebugging(const char *path, char const *argv[], *pid = static_cast<::pid_t>(pty.Fork(fork_error, sizeof(fork_error))); if (*pid < 0) { //-------------------------------------------------------------- - // Error during fork. + // Status during fork. //-------------------------------------------------------------- *pid = static_cast<::pid_t>(LLDB_INVALID_PROCESS_ID); error.SetErrorStringWithFormat("%s(): fork failed: %s", __FUNCTION__, @@ -205,10 +205,10 @@ static Error ForkChildForPTraceDebugging(const char *path, char const *argv[], return error; } -static Error +static Status CreatePosixSpawnFileAction(const FileAction &action, posix_spawn_file_actions_t *file_actions) { - Error error; + Status error; // Log it. Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); @@ -270,11 +270,11 @@ CreatePosixSpawnFileAction(const FileAction &action, return error; } -static Error PosixSpawnChildForPTraceDebugging(const char *path, - ProcessLaunchInfo &launch_info, - ::pid_t *pid, - cpu_type_t *actual_cpu_type) { - Error error; +static Status PosixSpawnChildForPTraceDebugging(const char *path, + ProcessLaunchInfo &launch_info, + ::pid_t *pid, + cpu_type_t *actual_cpu_type) { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); if (!pid) { @@ -436,9 +436,9 @@ static Error PosixSpawnChildForPTraceDebugging(const char *path, return error; } -Error LaunchInferior(ProcessLaunchInfo &launch_info, int *pty_master_fd, - LaunchFlavor *launch_flavor) { - Error error; +Status LaunchInferior(ProcessLaunchInfo &launch_info, int *pty_master_fd, + LaunchFlavor *launch_flavor) { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); if (!launch_flavor) { diff --git a/source/Plugins/Process/Darwin/DarwinProcessLauncher.h b/source/Plugins/Process/Darwin/DarwinProcessLauncher.h index d1af4d09f8b7..a0e8ce5cb9dc 100644 --- a/source/Plugins/Process/Darwin/DarwinProcessLauncher.h +++ b/source/Plugins/Process/Darwin/DarwinProcessLauncher.h @@ -39,8 +39,9 @@ namespace darwin_process_launcher { /// @param[out] launch_flavor /// Contains the launch flavor used when launching the process. // ============================================================================= -Error LaunchInferior(ProcessLaunchInfo &launch_info, int *pty_master_fd, - lldb_private::process_darwin::LaunchFlavor *launch_flavor); +Status +LaunchInferior(ProcessLaunchInfo &launch_info, int *pty_master_fd, + lldb_private::process_darwin::LaunchFlavor *launch_flavor); } // darwin_process_launcher } // lldb_private diff --git a/source/Plugins/Process/Darwin/MachException.cpp b/source/Plugins/Process/Darwin/MachException.cpp index 5a97a4b01be3..7d956dfc6506 100644 --- a/source/Plugins/Process/Darwin/MachException.cpp +++ b/source/Plugins/Process/Darwin/MachException.cpp @@ -23,9 +23,9 @@ // LLDB includes #include "lldb/Target/UnixSignals.h" -#include "lldb/Utility/Error.h" #include "lldb/Utility/LLDBAssert.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" using namespace lldb; @@ -211,11 +211,11 @@ bool MachException::Data::GetStopInfo(struct ThreadStopInfo *stop_info, return true; } -Error MachException::Message::Receive(mach_port_t port, - mach_msg_option_t options, - mach_msg_timeout_t timeout, - mach_port_t notify_port) { - Error error; +Status MachException::Message::Receive(mach_port_t port, + mach_msg_option_t options, + mach_msg_timeout_t timeout, + mach_port_t notify_port) { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE)); mach_msg_timeout_t mach_msg_timeout = @@ -312,10 +312,10 @@ bool MachException::Message::CatchExceptionRaise(task_t task) { return success; } -Error MachException::Message::Reply(::pid_t inferior_pid, task_t inferior_task, - int signal) { +Status MachException::Message::Reply(::pid_t inferior_pid, task_t inferior_task, + int signal) { // Reply to the exception... - Error error; + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE)); @@ -412,8 +412,8 @@ Error MachException::Message::Reply(::pid_t inferior_pid, task_t inferior_task, #define LLDB_EXC_MASK (EXC_MASK_ALL & ~EXC_MASK_RESOURCE) -Error MachException::PortInfo::Save(task_t task) { - Error error; +Status MachException::PortInfo::Save(task_t task) { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE)); if (log) @@ -471,8 +471,8 @@ Error MachException::PortInfo::Save(task_t task) { return error; } -Error MachException::PortInfo::Restore(task_t task) { - Error error; +Status MachException::PortInfo::Restore(task_t task) { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE)); diff --git a/source/Plugins/Process/Darwin/MachException.h b/source/Plugins/Process/Darwin/MachException.h index ac8cd7030c55..2da6a36a921e 100644 --- a/source/Plugins/Process/Darwin/MachException.h +++ b/source/Plugins/Process/Darwin/MachException.h @@ -40,9 +40,9 @@ public: thread_state_flavor_t flavors[EXC_TYPES_COUNT]; mach_msg_type_number_t count; - Error Save(task_t task); + Status Save(task_t task); - Error Restore(task_t task); + Status Restore(task_t task); }; struct Data { @@ -96,11 +96,11 @@ public: bool CatchExceptionRaise(task_t task); - Error Reply(::pid_t inferior_pid, task_t inferior_task, int signal); + Status Reply(::pid_t inferior_pid, task_t inferior_task, int signal); - Error Receive(mach_port_t receive_port, mach_msg_option_t options, - mach_msg_timeout_t timeout, - mach_port_t notify_port = MACH_PORT_NULL); + Status Receive(mach_port_t receive_port, mach_msg_option_t options, + mach_msg_timeout_t timeout, + mach_port_t notify_port = MACH_PORT_NULL); void Dump(Stream &stream) const; diff --git a/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp b/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp index 65ab12fe1adf..f6c8c78ccb73 100644 --- a/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp +++ b/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp @@ -53,13 +53,13 @@ struct hack_task_dyld_info { // Public Static Methods // ----------------------------------------------------------------------------- -Error NativeProcessProtocol::Launch( +Status NativeProcessProtocol::Launch( ProcessLaunchInfo &launch_info, NativeProcessProtocol::NativeDelegate &native_delegate, MainLoop &mainloop, NativeProcessProtocolSP &native_process_sp) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); - Error error; + Status error; // Verify the working directory is valid if one was specified. FileSpec working_dir(launch_info.GetWorkingDirectory()); @@ -120,7 +120,7 @@ Error NativeProcessProtocol::Launch( return error; } -Error NativeProcessProtocol::Attach( +Status NativeProcessProtocol::Attach( lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate, MainLoop &mainloop, NativeProcessProtocolSP &native_process_sp) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); @@ -130,7 +130,7 @@ Error NativeProcessProtocol::Attach( // 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; @@ -174,9 +174,9 @@ NativeProcessDarwin::~NativeProcessDarwin() {} // Instance methods // ----------------------------------------------------------------------------- -Error NativeProcessDarwin::FinalizeLaunch(LaunchFlavor launch_flavor, - MainLoop &main_loop) { - Error error; +Status NativeProcessDarwin::FinalizeLaunch(LaunchFlavor launch_flavor, + MainLoop &main_loop) { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); #if 0 @@ -261,7 +261,7 @@ Error NativeProcessDarwin::FinalizeLaunch(LaunchFlavor launch_flavor, return error; } -Error NativeProcessDarwin::SaveExceptionPortInfo() { +Status NativeProcessDarwin::SaveExceptionPortInfo() { return m_exc_port_info.Save(m_task); } @@ -348,7 +348,7 @@ void *NativeProcessDarwin::DoExceptionThread() { // polling is expensive. On devices, we need to minimize overhead caused // by the process monitor. uint32_t num_exceptions_received = 0; - Error error; + Status error; task_t task = m_task; mach_msg_timeout_t periodic_timeout = 0; @@ -550,8 +550,8 @@ void *NativeProcessDarwin::DoExceptionThread() { return nullptr; } -Error NativeProcessDarwin::StartExceptionThread() { - Error error; +Status NativeProcessDarwin::StartExceptionThread() { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); if (log) log->Printf("NativeProcessDarwin::%s() called", __FUNCTION__); @@ -640,7 +640,7 @@ Error NativeProcessDarwin::StartExceptionThread() { } lldb::addr_t -NativeProcessDarwin::GetDYLDAllImageInfosAddress(Error &error) const { +NativeProcessDarwin::GetDYLDAllImageInfosAddress(Status &error) const { error.Clear(); struct hack_task_dyld_info dyld_info; @@ -694,7 +694,7 @@ uint32_t NativeProcessDarwin::GetCPUType() const { task_t NativeProcessDarwin::ExceptionMessageBundleComplete() { // We have a complete bundle of exceptions for our child process. - Error error; + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE)); std::lock_guard<std::recursive_mutex> locker(m_exception_messages_mutex); @@ -737,7 +737,7 @@ task_t NativeProcessDarwin::ExceptionMessageBundleComplete() { const addr_t info_array_count_addr = aii_addr + 4; uint32_t info_array_count = 0; size_t bytes_read = 0; - Error read_error; + Status read_error; read_error = ReadMemory(info_array_count_addr, // source addr &info_array_count, // dest addr 4, // byte count @@ -885,8 +885,8 @@ void NativeProcessDarwin::StartSTDIOThread() { // TODO implement } -Error NativeProcessDarwin::StartWaitpidThread(MainLoop &main_loop) { - Error error; +Status NativeProcessDarwin::StartWaitpidThread(MainLoop &main_loop) { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); // Strategy: create a thread that sits on waitpid(), waiting for the @@ -973,7 +973,7 @@ void *NativeProcessDarwin::DoWaitpidThread() { // Ensure we don't get CPU starved. MaybeRaiseThreadPriority(); - Error error; + Status error; int status = -1; while (1) { @@ -1038,9 +1038,9 @@ void *NativeProcessDarwin::DoWaitpidThread() { return nullptr; } -Error NativeProcessDarwin::SendInferiorExitStatusToMainLoop(::pid_t pid, - int status) { - Error error; +Status NativeProcessDarwin::SendInferiorExitStatusToMainLoop(::pid_t pid, + int status) { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); size_t bytes_written = 0; @@ -1069,8 +1069,8 @@ Error NativeProcessDarwin::SendInferiorExitStatusToMainLoop(::pid_t pid, return error; } -Error NativeProcessDarwin::HandleWaitpidResult() { - Error error; +Status NativeProcessDarwin::HandleWaitpidResult() { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); // Read the pid. @@ -1126,7 +1126,7 @@ Error NativeProcessDarwin::HandleWaitpidResult() { return error; } -task_t NativeProcessDarwin::TaskPortForProcessID(Error &error, +task_t NativeProcessDarwin::TaskPortForProcessID(Status &error, bool force) const { if ((m_task == TASK_NULL) || force) { Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); @@ -1178,12 +1178,12 @@ task_t NativeProcessDarwin::TaskPortForProcessID(Error &error, } void NativeProcessDarwin::AttachToInferior(MainLoop &mainloop, lldb::pid_t pid, - Error &error) { + Status &error) { error.SetErrorString("TODO: implement"); } -Error NativeProcessDarwin::PrivateResume() { - Error error; +Status NativeProcessDarwin::PrivateResume() { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); std::lock_guard<std::recursive_mutex> locker(m_exception_messages_mutex); @@ -1225,8 +1225,8 @@ Error NativeProcessDarwin::PrivateResume() { return error; } -Error NativeProcessDarwin::ReplyToAllExceptions() { - Error error; +Status NativeProcessDarwin::ReplyToAllExceptions() { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_VERBOSE)); TaskPortForProcessID(error); @@ -1282,8 +1282,8 @@ Error NativeProcessDarwin::ReplyToAllExceptions() { return error; } -Error NativeProcessDarwin::ResumeTask() { - Error error; +Status NativeProcessDarwin::ResumeTask() { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); TaskPortForProcessID(error); @@ -1364,9 +1364,10 @@ bool NativeProcessDarwin::IsExceptionPortValid() const { return MACH_PORT_VALID(m_exception_port); } -Error NativeProcessDarwin::GetTaskBasicInfo( - task_t task, struct task_basic_info *info) const { - Error error; +Status +NativeProcessDarwin::GetTaskBasicInfo(task_t task, + struct task_basic_info *info) const { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); // Validate args. @@ -1412,8 +1413,8 @@ Error NativeProcessDarwin::GetTaskBasicInfo( return error; } -Error NativeProcessDarwin::SuspendTask() { - Error error; +Status NativeProcessDarwin::SuspendTask() { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); if (m_task == TASK_NULL) { @@ -1432,8 +1433,8 @@ Error NativeProcessDarwin::SuspendTask() { return error; } -Error NativeProcessDarwin::Resume(const ResumeActionList &resume_actions) { - Error error; +Status NativeProcessDarwin::Resume(const ResumeActionList &resume_actions) { + Status error; Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS)); if (log) @@ -1461,74 +1462,74 @@ Error NativeProcessDarwin::Resume(const ResumeActionList &resume_actions) { return error; } -Error NativeProcessDarwin::Halt() { - Error error; +Status NativeProcessDarwin::Halt() { + Status error; error.SetErrorString("TODO: implement"); return error; } -Error NativeProcessDarwin::Detach() { - Error error; +Status NativeProcessDarwin::Detach() { + Status error; error.SetErrorString("TODO: implement"); return error; } -Error NativeProcessDarwin::Signal(int signo) { - Error error; +Status NativeProcessDarwin::Signal(int signo) { + Status error; error.SetErrorString("TODO: implement"); return error; } -Error NativeProcessDarwin::Interrupt() { - Error error; +Status NativeProcessDarwin::Interrupt() { + Status error; error.SetErrorString("TODO: implement"); return error; } -Error NativeProcessDarwin::Kill() { - Error error; +Status NativeProcessDarwin::Kill() { + Status error; error.SetErrorString("TODO: implement"); return error; } -Error NativeProcessDarwin::GetMemoryRegionInfo(lldb::addr_t load_addr, - MemoryRegionInfo &range_info) { - Error error; +Status NativeProcessDarwin::GetMemoryRegionInfo(lldb::addr_t load_addr, + MemoryRegionInfo &range_info) { + Status error; error.SetErrorString("TODO: implement"); return error; } -Error NativeProcessDarwin::ReadMemory(lldb::addr_t addr, void *buf, size_t size, - size_t &bytes_read) { - Error error; +Status NativeProcessDarwin::ReadMemory(lldb::addr_t addr, void *buf, + size_t size, size_t &bytes_read) { + Status error; error.SetErrorString("TODO: implement"); return error; } -Error NativeProcessDarwin::ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, - size_t size, - size_t &bytes_read) { - Error error; +Status NativeProcessDarwin::ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, + size_t size, + size_t &bytes_read) { + Status error; error.SetErrorString("TODO: implement"); return error; } -Error NativeProcessDarwin::WriteMemory(lldb::addr_t addr, const void *buf, - size_t size, size_t &bytes_written) { - Error error; +Status NativeProcessDarwin::WriteMemory(lldb::addr_t addr, const void *buf, + size_t size, size_t &bytes_written) { + Status error; error.SetErrorString("TODO: implement"); return error; } -Error NativeProcessDarwin::AllocateMemory(size_t size, uint32_t permissions, - lldb::addr_t &addr) { - Error error; +Status NativeProcessDarwin::AllocateMemory(size_t size, uint32_t permissions, + lldb::addr_t &addr) { + Status error; error.SetErrorString("TODO: implement"); return error; } -Error NativeProcessDarwin::DeallocateMemory(lldb::addr_t addr) { - Error error; +Status NativeProcessDarwin::DeallocateMemory(lldb::addr_t addr) { + Status error; error.SetErrorString("TODO: implement"); return error; } @@ -1543,25 +1544,25 @@ bool NativeProcessDarwin::GetArchitecture(ArchSpec &arch) const { return false; } -Error NativeProcessDarwin::SetBreakpoint(lldb::addr_t addr, uint32_t size, - bool hardware) { - Error error; +Status NativeProcessDarwin::SetBreakpoint(lldb::addr_t addr, uint32_t size, + bool hardware) { + Status error; error.SetErrorString("TODO: implement"); return error; } void NativeProcessDarwin::DoStopIDBumped(uint32_t newBumpId) {} -Error NativeProcessDarwin::GetLoadedModuleFileSpec(const char *module_path, - FileSpec &file_spec) { - Error error; +Status NativeProcessDarwin::GetLoadedModuleFileSpec(const char *module_path, + FileSpec &file_spec) { + Status error; error.SetErrorString("TODO: implement"); return error; } -Error NativeProcessDarwin::GetFileLoadAddress(const llvm::StringRef &file_name, - lldb::addr_t &load_addr) { - Error error; +Status NativeProcessDarwin::GetFileLoadAddress(const llvm::StringRef &file_name, + lldb::addr_t &load_addr) { + Status error; error.SetErrorString("TODO: implement"); return error; } @@ -1569,10 +1570,10 @@ Error NativeProcessDarwin::GetFileLoadAddress(const llvm::StringRef &file_name, // ----------------------------------------------------------------- // NativeProcessProtocol protected interface // ----------------------------------------------------------------- -Error NativeProcessDarwin::GetSoftwareBreakpointTrapOpcode( +Status NativeProcessDarwin::GetSoftwareBreakpointTrapOpcode( size_t trap_opcode_size_hint, size_t &actual_opcode_size, const uint8_t *&trap_opcode_bytes) { - Error error; + Status error; error.SetErrorString("TODO: implement"); return error; } diff --git a/source/Plugins/Process/Darwin/NativeProcessDarwin.h b/source/Plugins/Process/Darwin/NativeProcessDarwin.h index 01fdd64b1273..2214bbc52ca4 100644 --- a/source/Plugins/Process/Darwin/NativeProcessDarwin.h +++ b/source/Plugins/Process/Darwin/NativeProcessDarwin.h @@ -37,7 +37,7 @@ #include "NativeThreadListDarwin.h" namespace lldb_private { -class Error; +class Status; class Scalar; namespace process_darwin { @@ -50,11 +50,11 @@ namespace process_darwin { /// /// Changes in the inferior process state are broadcasted. class NativeProcessDarwin : public NativeProcessProtocol { - friend Error NativeProcessProtocol::Launch( + friend Status NativeProcessProtocol::Launch( ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate, MainLoop &mainloop, NativeProcessProtocolSP &process_sp); - friend Error NativeProcessProtocol::Attach( + friend Status NativeProcessProtocol::Attach( lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate, MainLoop &mainloop, NativeProcessProtocolSP &process_sp); @@ -64,34 +64,34 @@ public: // ----------------------------------------------------------------- // NativeProcessProtocol Interface // ----------------------------------------------------------------- - Error Resume(const ResumeActionList &resume_actions) override; + Status Resume(const ResumeActionList &resume_actions) override; - Error Halt() override; + Status Halt() override; - Error Detach() override; + Status Detach() override; - Error Signal(int signo) override; + Status Signal(int signo) override; - Error Interrupt() override; + Status Interrupt() override; - Error Kill() override; + Status Kill() override; - Error GetMemoryRegionInfo(lldb::addr_t load_addr, - MemoryRegionInfo &range_info) override; + Status GetMemoryRegionInfo(lldb::addr_t load_addr, + MemoryRegionInfo &range_info) override; - Error ReadMemory(lldb::addr_t addr, void *buf, size_t size, - size_t &bytes_read) override; + Status ReadMemory(lldb::addr_t addr, void *buf, size_t size, + size_t &bytes_read) override; - Error ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size, - size_t &bytes_read) override; + Status ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size, + size_t &bytes_read) override; - Error WriteMemory(lldb::addr_t addr, const void *buf, size_t size, - size_t &bytes_written) override; + Status WriteMemory(lldb::addr_t addr, const void *buf, size_t size, + size_t &bytes_written) override; - Error AllocateMemory(size_t size, uint32_t permissions, - lldb::addr_t &addr) override; + Status AllocateMemory(size_t size, uint32_t permissions, + lldb::addr_t &addr) override; - Error DeallocateMemory(lldb::addr_t addr) override; + Status DeallocateMemory(lldb::addr_t addr) override; lldb::addr_t GetSharedLibraryInfoAddress() override; @@ -99,15 +99,16 @@ public: bool GetArchitecture(ArchSpec &arch) const override; - Error SetBreakpoint(lldb::addr_t addr, uint32_t size, bool hardware) override; + Status SetBreakpoint(lldb::addr_t addr, uint32_t size, + bool hardware) override; void DoStopIDBumped(uint32_t newBumpId) override; - Error GetLoadedModuleFileSpec(const char *module_path, - FileSpec &file_spec) override; + Status GetLoadedModuleFileSpec(const char *module_path, + FileSpec &file_spec) override; - Error GetFileLoadAddress(const llvm::StringRef &file_name, - lldb::addr_t &load_addr) override; + Status GetFileLoadAddress(const llvm::StringRef &file_name, + lldb::addr_t &load_addr) override; NativeThreadDarwinSP GetThreadByID(lldb::tid_t id); @@ -116,9 +117,9 @@ public: // ----------------------------------------------------------------- // Interface used by NativeRegisterContext-derived classes. // ----------------------------------------------------------------- - static Error PtraceWrapper(int req, lldb::pid_t pid, void *addr = nullptr, - void *data = nullptr, size_t data_size = 0, - long *result = nullptr); + static Status PtraceWrapper(int req, lldb::pid_t pid, void *addr = nullptr, + void *data = nullptr, size_t data_size = 0, + long *result = nullptr); bool SupportHardwareSingleStepping() const; @@ -126,7 +127,7 @@ protected: // ----------------------------------------------------------------- // NativeProcessProtocol protected interface // ----------------------------------------------------------------- - Error + Status GetSoftwareBreakpointTrapOpcode(size_t trap_opcode_size_hint, size_t &actual_opcode_size, const uint8_t *&trap_opcode_bytes) override; @@ -236,19 +237,19 @@ private: /// operations. Failure here will force termination of the /// launched process and debugging session. // ----------------------------------------------------------------- - Error FinalizeLaunch(LaunchFlavor launch_flavor, MainLoop &main_loop); + Status FinalizeLaunch(LaunchFlavor launch_flavor, MainLoop &main_loop); - Error SaveExceptionPortInfo(); + Status SaveExceptionPortInfo(); void ExceptionMessageReceived(const MachException::Message &message); void MaybeRaiseThreadPriority(); - Error StartExceptionThread(); + Status StartExceptionThread(); - Error SendInferiorExitStatusToMainLoop(::pid_t pid, int status); + Status SendInferiorExitStatusToMainLoop(::pid_t pid, int status); - Error HandleWaitpidResult(); + Status HandleWaitpidResult(); bool ProcessUsingSpringBoard() const; @@ -258,7 +259,7 @@ private: void *DoExceptionThread(); - lldb::addr_t GetDYLDAllImageInfosAddress(Error &error) const; + lldb::addr_t GetDYLDAllImageInfosAddress(Status &error) const; static uint32_t GetCPUTypeForLocalProcess(::pid_t pid); @@ -268,25 +269,25 @@ private: void StartSTDIOThread(); - Error StartWaitpidThread(MainLoop &main_loop); + Status StartWaitpidThread(MainLoop &main_loop); static void *WaitpidThread(void *arg); void *DoWaitpidThread(); - task_t TaskPortForProcessID(Error &error, bool force = false) const; + task_t TaskPortForProcessID(Status &error, bool force = false) const; /// Attaches to an existing process. Forms the /// implementation of Process::DoAttach. - void AttachToInferior(MainLoop &mainloop, lldb::pid_t pid, Error &error); + void AttachToInferior(MainLoop &mainloop, lldb::pid_t pid, Status &error); - ::pid_t Attach(lldb::pid_t pid, Error &error); + ::pid_t Attach(lldb::pid_t pid, Status &error); - Error PrivateResume(); + Status PrivateResume(); - Error ReplyToAllExceptions(); + Status ReplyToAllExceptions(); - Error ResumeTask(); + Status ResumeTask(); bool IsTaskValid() const; @@ -296,11 +297,11 @@ private: bool IsExceptionPortValid() const; - Error GetTaskBasicInfo(task_t task, struct task_basic_info *info) const; + Status GetTaskBasicInfo(task_t task, struct task_basic_info *info) const; - Error SuspendTask(); + Status SuspendTask(); - static Error SetDefaultPtraceOpts(const lldb::pid_t); + static Status SetDefaultPtraceOpts(const lldb::pid_t); static void *MonitorThread(void *baton); @@ -319,7 +320,7 @@ private: void MonitorSignal(const siginfo_t &info, NativeThreadDarwin &thread, bool exited); - Error SetupSoftwareSingleStepping(NativeThreadDarwin &thread); + Status SetupSoftwareSingleStepping(NativeThreadDarwin &thread); #if 0 static ::ProcessMessage::CrashReason @@ -341,22 +342,22 @@ private: NativeThreadDarwinSP AddThread(lldb::tid_t thread_id); - Error GetSoftwareBreakpointPCOffset(uint32_t &actual_opcode_size); + Status GetSoftwareBreakpointPCOffset(uint32_t &actual_opcode_size); - Error FixupBreakpointPCAsNeeded(NativeThreadDarwin &thread); + Status FixupBreakpointPCAsNeeded(NativeThreadDarwin &thread); /// Writes a siginfo_t structure corresponding to the given thread /// ID to the memory region pointed to by @p siginfo. - Error GetSignalInfo(lldb::tid_t tid, void *siginfo); + Status GetSignalInfo(lldb::tid_t tid, void *siginfo); /// Writes the raw event message code (vis-a-vis PTRACE_GETEVENTMSG) /// corresponding to the given thread ID to the memory pointed to /// by @p message. - Error GetEventMessage(lldb::tid_t tid, unsigned long *message); + Status GetEventMessage(lldb::tid_t tid, unsigned long *message); void NotifyThreadDeath(lldb::tid_t tid); - Error Detach(lldb::tid_t tid); + Status Detach(lldb::tid_t tid); // This method is requests a stop on all threads which are still // running. It sets up a deferred delegate notification, which will @@ -370,8 +371,8 @@ private: // Resume the given thread, optionally passing it the given signal. // The type of resume operation (continue, single-step) depends on // the state parameter. - Error ResumeThread(NativeThreadDarwin &thread, lldb::StateType state, - int signo); + Status ResumeThread(NativeThreadDarwin &thread, lldb::StateType state, + int signo); void ThreadWasCreated(NativeThreadDarwin &thread); diff --git a/source/Plugins/Process/Darwin/NativeThreadDarwin.cpp b/source/Plugins/Process/Darwin/NativeThreadDarwin.cpp index b04f9053136b..07398ab7b678 100644 --- a/source/Plugins/Process/Darwin/NativeThreadDarwin.cpp +++ b/source/Plugins/Process/Darwin/NativeThreadDarwin.cpp @@ -94,15 +94,15 @@ NativeRegisterContextSP NativeThreadDarwin::GetRegisterContext() { return NativeRegisterContextSP(); } -Error NativeThreadDarwin::SetWatchpoint(lldb::addr_t addr, size_t size, - uint32_t watch_flags, bool hardware) { - Error error; +Status NativeThreadDarwin::SetWatchpoint(lldb::addr_t addr, size_t size, + uint32_t watch_flags, bool hardware) { + Status error; error.SetErrorString("not yet implemented"); return error; } -Error NativeThreadDarwin::RemoveWatchpoint(lldb::addr_t addr) { - Error error; +Status NativeThreadDarwin::RemoveWatchpoint(lldb::addr_t addr) { + Status error; error.SetErrorString("not yet implemented"); return error; } diff --git a/source/Plugins/Process/Darwin/NativeThreadDarwin.h b/source/Plugins/Process/Darwin/NativeThreadDarwin.h index b8d9089e673e..f66f8fe8738c 100644 --- a/source/Plugins/Process/Darwin/NativeThreadDarwin.h +++ b/source/Plugins/Process/Darwin/NativeThreadDarwin.h @@ -58,10 +58,10 @@ public: NativeRegisterContextSP GetRegisterContext() override; - Error SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, - bool hardware) override; + Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, + bool hardware) override; - Error RemoveWatchpoint(lldb::addr_t addr) override; + Status RemoveWatchpoint(lldb::addr_t addr) override; // ----------------------------------------------------------------- // New methods that are fine for others to call. @@ -75,11 +75,11 @@ private: /// Resumes the thread. If @p signo is anything but /// LLDB_INVALID_SIGNAL_NUMBER, deliver that signal to the thread. - Error Resume(uint32_t signo); + Status Resume(uint32_t signo); /// Single steps the thread. If @p signo is anything but /// LLDB_INVALID_SIGNAL_NUMBER, deliver that signal to the thread. - Error SingleStep(uint32_t signo); + Status SingleStep(uint32_t signo); bool NotifyException(MachException::Data &exc); @@ -117,7 +117,7 @@ private: void SetExited(); - Error RequestStop(); + Status RequestStop(); // ------------------------------------------------------------------------- /// Return the mach thread port number for this thread. diff --git a/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp b/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp index fa06fb8b2a5f..7d44adeec375 100644 --- a/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp +++ b/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp @@ -20,8 +20,8 @@ #include <sys/sysctl.h> // LLDB includes -#include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" +#include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" #include "lldb/lldb-enumerations.h" @@ -343,7 +343,7 @@ uint32_t NativeThreadListDarwin::UpdateThreadList(NativeProcessDarwin &process, mach_msg_type_number_t thread_list_count = 0; task_t task = process.GetTask(); - Error error; + Status error; auto mach_err = ::task_threads(task, &thread_list, &thread_list_count); error.SetError(mach_err, eErrorTypeMachKernel); if (error.Fail()) { diff --git a/source/Plugins/Process/Darwin/NativeThreadListDarwin.h b/source/Plugins/Process/Darwin/NativeThreadListDarwin.h index 2b194bcc1537..7b59afb96e95 100644 --- a/source/Plugins/Process/Darwin/NativeThreadListDarwin.h +++ b/source/Plugins/Process/Darwin/NativeThreadListDarwin.h @@ -123,7 +123,7 @@ protected: typedef collection::iterator iterator; typedef collection::const_iterator const_iterator; - // Consider having this return an lldb_private::Error. + // Consider having this return an lldb_private::Status. uint32_t UpdateThreadList(NativeProcessDarwin &process, bool update, collection *num_threads = nullptr); |