aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp48
1 files changed, 27 insertions, 21 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 345f5cd..f6f13a8 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -261,8 +261,8 @@ Status GDBRemoteCommunicationServerLLGS::LaunchProcess() {
Log *log = GetLog(LLDBLog::Process);
if (!m_process_launch_info.GetArguments().GetArgumentCount())
- return Status("%s: no process command line specified to launch",
- __FUNCTION__);
+ return Status::FromErrorStringWithFormat(
+ "%s: no process command line specified to launch", __FUNCTION__);
const bool should_forward_stdio =
m_process_launch_info.GetFileActionForFD(STDIN_FILENO) == nullptr ||
@@ -348,10 +348,10 @@ Status GDBRemoteCommunicationServerLLGS::AttachToProcess(lldb::pid_t pid) {
// Before we try to attach, make sure we aren't already monitoring something
// else.
if (!m_debugged_processes.empty())
- return Status("cannot attach to process %" PRIu64
- " when another process with pid %" PRIu64
- " is being debugged.",
- pid, m_current_process->GetID());
+ return Status::FromErrorStringWithFormat(
+ "cannot attach to process %" PRIu64
+ " when another process with pid %" PRIu64 " is being debugged.",
+ pid, m_current_process->GetID());
// Try to attach.
auto process_or = m_process_manager.Attach(pid, *this);
@@ -447,7 +447,7 @@ Status GDBRemoteCommunicationServerLLGS::AttachWaitProcess(
error_stream.Format("{0}.", loop_process_list.back().GetProcessID());
Status error;
- error.SetErrorString(error_stream.GetString());
+ error = Status(error_stream.GetString().str());
return error;
}
}
@@ -1212,14 +1212,15 @@ Status GDBRemoteCommunicationServerLLGS::SetSTDIOFileDescriptor(int fd) {
std::unique_ptr<ConnectionFileDescriptor> conn_up(
new ConnectionFileDescriptor(fd, true));
if (!conn_up) {
- error.SetErrorString("failed to create ConnectionFileDescriptor");
+ error =
+ Status::FromErrorString("failed to create ConnectionFileDescriptor");
return error;
}
m_stdio_communication.SetCloseOnEOF(false);
m_stdio_communication.SetConnection(std::move(conn_up));
if (!m_stdio_communication.IsConnected()) {
- error.SetErrorString(
+ error = Status::FromErrorString(
"failed to set connection for inferior I/O communication");
return error;
}
@@ -1288,7 +1289,7 @@ GDBRemoteCommunicationServerLLGS::Handle_jLLDBTraceSupported(
// Fail if we don't have a current process.
if (!m_current_process ||
(m_current_process->GetID() == LLDB_INVALID_PROCESS_ID))
- return SendErrorResponse(Status("Process not running."));
+ return SendErrorResponse(Status::FromErrorString("Process not running."));
return SendJSONResponse(m_current_process->TraceSupported());
}
@@ -1299,7 +1300,7 @@ GDBRemoteCommunicationServerLLGS::Handle_jLLDBTraceStop(
// Fail if we don't have a current process.
if (!m_current_process ||
(m_current_process->GetID() == LLDB_INVALID_PROCESS_ID))
- return SendErrorResponse(Status("Process not running."));
+ return SendErrorResponse(Status::FromErrorString("Process not running."));
packet.ConsumeFront("jLLDBTraceStop:");
Expected<TraceStopRequest> stop_request =
@@ -1320,7 +1321,7 @@ GDBRemoteCommunicationServerLLGS::Handle_jLLDBTraceStart(
// Fail if we don't have a current process.
if (!m_current_process ||
(m_current_process->GetID() == LLDB_INVALID_PROCESS_ID))
- return SendErrorResponse(Status("Process not running."));
+ return SendErrorResponse(Status::FromErrorString("Process not running."));
packet.ConsumeFront("jLLDBTraceStart:");
Expected<TraceStartRequest> request =
@@ -1341,7 +1342,7 @@ GDBRemoteCommunicationServerLLGS::Handle_jLLDBTraceGetState(
// Fail if we don't have a current process.
if (!m_current_process ||
(m_current_process->GetID() == LLDB_INVALID_PROCESS_ID))
- return SendErrorResponse(Status("Process not running."));
+ return SendErrorResponse(Status::FromErrorString("Process not running."));
packet.ConsumeFront("jLLDBTraceGetState:");
Expected<TraceGetStateRequest> request =
@@ -1359,7 +1360,7 @@ GDBRemoteCommunicationServerLLGS::Handle_jLLDBTraceGetBinaryData(
// Fail if we don't have a current process.
if (!m_current_process ||
(m_current_process->GetID() == LLDB_INVALID_PROCESS_ID))
- return SendErrorResponse(Status("Process not running."));
+ return SendErrorResponse(Status::FromErrorString("Process not running."));
packet.ConsumeFront("jLLDBTraceGetBinaryData:");
llvm::Expected<TraceGetBinaryDataRequest> request =
@@ -3539,7 +3540,7 @@ GDBRemoteCommunicationServerLLGS::Handle_vRun(
}
if (argv.empty())
- return SendErrorResponse(Status("No arguments"));
+ return SendErrorResponse(Status::FromErrorString("No arguments"));
m_process_launch_info.GetExecutableFile().SetFile(
m_process_launch_info.GetArguments()[0].ref(), FileSpec::Style::native);
m_process_launch_error = LaunchProcess();
@@ -3599,7 +3600,8 @@ GDBRemoteCommunicationServerLLGS::Handle_D(StringExtractorGDBRemote &packet) {
if (detach_error)
return SendErrorResponse(std::move(detach_error));
if (!detached)
- return SendErrorResponse(Status("PID %" PRIu64 " not traced", pid));
+ return SendErrorResponse(
+ Status::FromErrorStringWithFormat("PID %" PRIu64 " not traced", pid));
return SendOKResponse();
}
@@ -3920,7 +3922,7 @@ GDBRemoteCommunicationServerLLGS::Handle_qSaveCore(
// Fail if we don't have a current process.
if (!m_current_process ||
(m_current_process->GetID() == LLDB_INVALID_PROCESS_ID))
- return SendErrorResponse(Status("Process not running."));
+ return SendErrorResponse(Status::FromErrorString("Process not running."));
std::string path_hint;
@@ -3931,7 +3933,8 @@ GDBRemoteCommunicationServerLLGS::Handle_qSaveCore(
if (x.consume_front("path-hint:"))
StringExtractor(x).GetHexByteString(path_hint);
else
- return SendErrorResponse(Status("Unsupported qSaveCore option"));
+ return SendErrorResponse(
+ Status::FromErrorString("Unsupported qSaveCore option"));
}
}
@@ -3982,7 +3985,8 @@ GDBRemoteCommunicationServerLLGS::Handle_QNonStop(
StartSTDIOForwarding();
m_non_stop = true;
} else
- return SendErrorResponse(Status("Invalid QNonStop packet"));
+ return SendErrorResponse(
+ Status::FromErrorString("Invalid QNonStop packet"));
return SendOKResponse();
}
@@ -3995,7 +3999,8 @@ GDBRemoteCommunicationServerLLGS::HandleNotificationAck(
// the last message in the queue is ACK-ed, in which case the packet sends
// an OK response.
if (queue.empty())
- return SendErrorResponse(Status("No pending notification to ack"));
+ return SendErrorResponse(
+ Status::FromErrorString("No pending notification to ack"));
queue.pop_front();
if (!queue.empty())
return SendPacketNoLock(queue.front());
@@ -4025,7 +4030,8 @@ GDBRemoteCommunication::PacketResult
GDBRemoteCommunicationServerLLGS::Handle_vCtrlC(
StringExtractorGDBRemote &packet) {
if (!m_non_stop)
- return SendErrorResponse(Status("vCtrl is only valid in non-stop mode"));
+ return SendErrorResponse(
+ Status::FromErrorString("vCtrl is only valid in non-stop mode"));
PacketResult interrupt_res = Handle_interrupt(packet);
// If interrupting the process failed, pass the result through.