aboutsummaryrefslogtreecommitdiff
path: root/source/API/SBProcess.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/API/SBProcess.cpp')
-rw-r--r--source/API/SBProcess.cpp348
1 files changed, 195 insertions, 153 deletions
diff --git a/source/API/SBProcess.cpp b/source/API/SBProcess.cpp
index 235388b5f25c..41efd86177d6 100644
--- a/source/API/SBProcess.cpp
+++ b/source/API/SBProcess.cpp
@@ -40,6 +40,7 @@
#include "lldb/API/SBThread.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBStringList.h"
+#include "lldb/API/SBUnixSignals.h"
using namespace lldb;
using namespace lldb_private;
@@ -148,20 +149,17 @@ SBProcess::RemoteLaunch (char const **argv,
lldb::SBError& error)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
- if (log) {
+ if (log)
log->Printf ("SBProcess(%p)::RemoteLaunch (argv=%p, envp=%p, stdin=%s, stdout=%s, stderr=%s, working-dir=%s, launch_flags=0x%x, stop_at_entry=%i, &error (%p))...",
- m_opaque_wp.lock().get(),
- argv,
- envp,
- stdin_path ? stdin_path : "NULL",
- stdout_path ? stdout_path : "NULL",
- stderr_path ? stderr_path : "NULL",
+ static_cast<void*>(m_opaque_wp.lock().get()),
+ static_cast<void*>(argv), static_cast<void*>(envp),
+ stdin_path ? stdin_path : "NULL",
+ stdout_path ? stdout_path : "NULL",
+ stderr_path ? stderr_path : "NULL",
working_directory ? working_directory : "NULL",
- launch_flags,
- stop_at_entry,
- error.get());
- }
-
+ launch_flags, stop_at_entry,
+ static_cast<void*>(error.get()));
+
ProcessSP process_sp(GetSP());
if (process_sp)
{
@@ -170,7 +168,7 @@ SBProcess::RemoteLaunch (char const **argv,
{
if (stop_at_entry)
launch_flags |= eLaunchFlagStopAtEntry;
- ProcessLaunchInfo launch_info (stdin_path,
+ ProcessLaunchInfo launch_info (stdin_path,
stdout_path,
stderr_path,
working_directory,
@@ -193,13 +191,15 @@ SBProcess::RemoteLaunch (char const **argv,
{
error.SetErrorString ("unable to attach pid");
}
-
+
if (log) {
SBStream sstr;
error.GetDescription (sstr);
- log->Printf ("SBProcess(%p)::RemoteLaunch (...) => SBError (%p): %s", process_sp.get(), error.get(), sstr.GetData());
+ log->Printf ("SBProcess(%p)::RemoteLaunch (...) => SBError (%p): %s",
+ static_cast<void*>(process_sp.get()),
+ static_cast<void*>(error.get()), sstr.GetData());
}
-
+
return error.Success();
}
@@ -214,7 +214,7 @@ SBProcess::RemoteAttachToProcessWithID (lldb::pid_t pid, lldb::SBError& error)
{
ProcessAttachInfo attach_info;
attach_info.SetProcessID (pid);
- error.SetError (process_sp->Attach (attach_info));
+ error.SetError (process_sp->Attach (attach_info));
}
else
{
@@ -230,7 +230,9 @@ SBProcess::RemoteAttachToProcessWithID (lldb::pid_t pid, lldb::SBError& error)
if (log) {
SBStream sstr;
error.GetDescription (sstr);
- log->Printf ("SBProcess(%p)::RemoteAttachToProcessWithID (%" PRIu64 ") => SBError (%p): %s", process_sp.get(), pid, error.get(), sstr.GetData());
+ log->Printf ("SBProcess(%p)::RemoteAttachToProcessWithID (%" PRIu64 ") => SBError (%p): %s",
+ static_cast<void*>(process_sp.get()), pid,
+ static_cast<void*>(error.get()), sstr.GetData());
}
return error.Success();
@@ -247,14 +249,15 @@ SBProcess::GetNumThreads ()
if (process_sp)
{
Process::StopLocker stop_locker;
-
+
const bool can_update = stop_locker.TryLock(&process_sp->GetRunLock());
Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
num_threads = process_sp->GetThreadList().GetSize(can_update);
}
if (log)
- log->Printf ("SBProcess(%p)::GetNumThreads () => %d", process_sp.get(), num_threads);
+ log->Printf ("SBProcess(%p)::GetNumThreads () => %d",
+ static_cast<void*>(process_sp.get()), num_threads);
return num_threads;
}
@@ -275,9 +278,9 @@ SBProcess::GetSelectedThread () const
}
if (log)
- {
- log->Printf ("SBProcess(%p)::GetSelectedThread () => SBThread(%p)", process_sp.get(), thread_sp.get());
- }
+ log->Printf ("SBProcess(%p)::GetSelectedThread () => SBThread(%p)",
+ static_cast<void*>(process_sp.get()),
+ static_cast<void*>(thread_sp.get()));
return sb_thread;
}
@@ -286,7 +289,7 @@ SBThread
SBProcess::CreateOSPluginThread (lldb::tid_t tid, lldb::addr_t context)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
SBThread sb_thread;
ThreadSP thread_sp;
ProcessSP process_sp(GetSP());
@@ -296,10 +299,12 @@ SBProcess::CreateOSPluginThread (lldb::tid_t tid, lldb::addr_t context)
thread_sp = process_sp->CreateOSPluginThread(tid, context);
sb_thread.SetThread (thread_sp);
}
-
+
if (log)
- log->Printf ("SBProcess(%p)::CreateOSPluginThread (tid=0x%" PRIx64 ", context=0x%" PRIx64 ") => SBThread(%p)", process_sp.get(), tid, context, thread_sp.get());
-
+ log->Printf ("SBProcess(%p)::CreateOSPluginThread (tid=0x%" PRIx64 ", context=0x%" PRIx64 ") => SBThread(%p)",
+ static_cast<void*>(process_sp.get()), tid, context,
+ static_cast<void*>(thread_sp.get()));
+
return sb_thread;
}
@@ -316,9 +321,11 @@ SBProcess::GetTarget() const
target_sp = process_sp->GetTarget().shared_from_this();
sb_target.SetSP (target_sp);
}
-
+
if (log)
- log->Printf ("SBProcess(%p)::GetTarget () => SBTarget(%p)", process_sp.get(), target_sp.get());
+ log->Printf ("SBProcess(%p)::GetTarget () => SBTarget(%p)",
+ static_cast<void*>(process_sp.get()),
+ static_cast<void*>(target_sp.get()));
return sb_target;
}
@@ -336,13 +343,12 @@ SBProcess::PutSTDIN (const char *src, size_t src_len)
Error error;
ret_val = process_sp->PutSTDIN (src, src_len, error);
}
-
+
if (log)
- log->Printf ("SBProcess(%p)::PutSTDIN (src=\"%s\", src_len=%d) => %zu",
- process_sp.get(),
- src,
- (uint32_t) src_len,
- ret_val);
+ log->Printf("SBProcess(%p)::PutSTDIN (src=\"%s\", src_len=%" PRIu64 ") => %" PRIu64,
+ static_cast<void*>(process_sp.get()), src,
+ static_cast<uint64_t>(src_len),
+ static_cast<uint64_t>(ret_val));
return ret_val;
}
@@ -357,15 +363,14 @@ SBProcess::GetSTDOUT (char *dst, size_t dst_len) const
Error error;
bytes_read = process_sp->GetSTDOUT (dst, dst_len, error);
}
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBProcess(%p)::GetSTDOUT (dst=\"%.*s\", dst_len=%" PRIu64 ") => %" PRIu64,
- process_sp.get(),
- (int) bytes_read,
- dst,
- (uint64_t)dst_len,
- (uint64_t)bytes_read);
+ static_cast<void*>(process_sp.get()),
+ static_cast<int>(bytes_read), dst,
+ static_cast<uint64_t>(dst_len),
+ static_cast<uint64_t>(bytes_read));
return bytes_read;
}
@@ -384,11 +389,10 @@ SBProcess::GetSTDERR (char *dst, size_t dst_len) const
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBProcess(%p)::GetSTDERR (dst=\"%.*s\", dst_len=%" PRIu64 ") => %" PRIu64,
- process_sp.get(),
- (int) bytes_read,
- dst,
- (uint64_t)dst_len,
- (uint64_t)bytes_read);
+ static_cast<void*>(process_sp.get()),
+ static_cast<int>(bytes_read), dst,
+ static_cast<uint64_t>(dst_len),
+ static_cast<uint64_t>(bytes_read));
return bytes_read;
}
@@ -403,16 +407,15 @@ SBProcess::GetAsyncProfileData(char *dst, size_t dst_len) const
Error error;
bytes_read = process_sp->GetAsyncProfileData (dst, dst_len, error);
}
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBProcess(%p)::GetProfileData (dst=\"%.*s\", dst_len=%" PRIu64 ") => %" PRIu64,
- process_sp.get(),
- (int) bytes_read,
- dst,
- (uint64_t)dst_len,
- (uint64_t)bytes_read);
-
+ static_cast<void*>(process_sp.get()),
+ static_cast<int>(bytes_read), dst,
+ static_cast<uint64_t>(dst_len),
+ static_cast<uint64_t>(bytes_read));
+
return bytes_read;
}
@@ -483,7 +486,8 @@ SBProcess::SetSelectedThreadByID (lldb::tid_t tid)
if (log)
log->Printf ("SBProcess(%p)::SetSelectedThreadByID (tid=0x%4.4" PRIx64 ") => %s",
- process_sp.get(), tid, (ret_val ? "true" : "false"));
+ static_cast<void*>(process_sp.get()), tid,
+ (ret_val ? "true" : "false"));
return ret_val;
}
@@ -502,8 +506,9 @@ SBProcess::SetSelectedThreadByIndexID (uint32_t index_id)
}
if (log)
- log->Printf ("SBProcess(%p)::SetSelectedThreadByID (tid=0x%x) => %s",
- process_sp.get(), index_id, (ret_val ? "true" : "false"));
+ log->Printf ("SBProcess(%p)::SetSelectedThreadByID (tid=0x%x) => %s",
+ static_cast<void*>(process_sp.get()), index_id,
+ (ret_val ? "true" : "false"));
return ret_val;
}
@@ -526,10 +531,10 @@ SBProcess::GetThreadAtIndex (size_t index)
}
if (log)
- {
log->Printf ("SBProcess(%p)::GetThreadAtIndex (index=%d) => SBThread(%p)",
- process_sp.get(), (uint32_t) index, thread_sp.get());
- }
+ static_cast<void*>(process_sp.get()),
+ static_cast<uint32_t>(index),
+ static_cast<void*>(thread_sp.get()));
return sb_thread;
}
@@ -544,13 +549,14 @@ SBProcess::GetNumQueues ()
if (process_sp)
{
Process::StopLocker stop_locker;
-
+
Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
num_queues = process_sp->GetQueueList().GetSize();
}
if (log)
- log->Printf ("SBProcess(%p)::GetNumQueues () => %d", process_sp.get(), num_queues);
+ log->Printf ("SBProcess(%p)::GetNumQueues () => %d",
+ static_cast<void*>(process_sp.get()), num_queues);
return num_queues;
}
@@ -572,10 +578,10 @@ SBProcess::GetQueueAtIndex (size_t index)
}
if (log)
- {
log->Printf ("SBProcess(%p)::GetQueueAtIndex (index=%d) => SBQueue(%p)",
- process_sp.get(), (uint32_t) index, queue_sp.get());
- }
+ static_cast<void*>(process_sp.get()),
+ static_cast<uint32_t>(index),
+ static_cast<void*>(queue_sp.get()));
return sb_queue;
}
@@ -610,8 +616,8 @@ SBProcess::GetState ()
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::GetState () => %s",
- process_sp.get(),
+ log->Printf ("SBProcess(%p)::GetState () => %s",
+ static_cast<void*>(process_sp.get()),
lldb_private::StateAsCString (ret_val));
return ret_val;
@@ -630,8 +636,9 @@ SBProcess::GetExitStatus ()
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::GetExitStatus () => %i (0x%8.8x)",
- process_sp.get(), exit_status, exit_status);
+ log->Printf ("SBProcess(%p)::GetExitStatus () => %i (0x%8.8x)",
+ static_cast<void*>(process_sp.get()), exit_status,
+ exit_status);
return exit_status;
}
@@ -648,8 +655,8 @@ SBProcess::GetExitDescription ()
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::GetExitDescription () => %s",
- process_sp.get(), exit_desc);
+ log->Printf ("SBProcess(%p)::GetExitDescription () => %s",
+ static_cast<void*>(process_sp.get()), exit_desc);
return exit_desc;
}
@@ -663,7 +670,8 @@ SBProcess::GetProcessID ()
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::GetProcessID () => %" PRIu64, process_sp.get(), ret_val);
+ log->Printf ("SBProcess(%p)::GetProcessID () => %" PRIu64,
+ static_cast<void*>(process_sp.get()), ret_val);
return ret_val;
}
@@ -677,7 +685,8 @@ SBProcess::GetUniqueID()
ret_val = process_sp->GetUniqueID();
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::GetUniqueID () => %" PRIu32, process_sp.get(), ret_val);
+ log->Printf ("SBProcess(%p)::GetUniqueID () => %" PRIu32,
+ static_cast<void*>(process_sp.get()), ret_val);
return ret_val;
}
@@ -688,10 +697,11 @@ SBProcess::GetByteOrder () const
ProcessSP process_sp(GetSP());
if (process_sp)
byteOrder = process_sp->GetTarget().GetArchitecture().GetByteOrder();
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::GetByteOrder () => %d", process_sp.get(), byteOrder);
+ log->Printf ("SBProcess(%p)::GetByteOrder () => %d",
+ static_cast<void*>(process_sp.get()), byteOrder);
return byteOrder;
}
@@ -706,7 +716,8 @@ SBProcess::GetAddressByteSize () const
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::GetAddressByteSize () => %d", process_sp.get(), size);
+ log->Printf ("SBProcess(%p)::GetAddressByteSize () => %d",
+ static_cast<void*>(process_sp.get()), size);
return size;
}
@@ -715,24 +726,26 @@ SBError
SBProcess::Continue ()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
SBError sb_error;
ProcessSP process_sp(GetSP());
if (log)
- log->Printf ("SBProcess(%p)::Continue ()...", process_sp.get());
+ log->Printf ("SBProcess(%p)::Continue ()...",
+ static_cast<void*>(process_sp.get()));
if (process_sp)
{
Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
-
+
Error error (process_sp->Resume());
if (error.Success())
{
if (process_sp->GetTarget().GetDebugger().GetAsyncExecution () == false)
{
if (log)
- log->Printf ("SBProcess(%p)::Continue () waiting for process to stop...", process_sp.get());
+ log->Printf ("SBProcess(%p)::Continue () waiting for process to stop...",
+ static_cast<void*>(process_sp.get()));
process_sp->WaitForProcessToStop (NULL);
}
}
@@ -745,7 +758,9 @@ SBProcess::Continue ()
{
SBStream sstr;
sb_error.GetDescription (sstr);
- log->Printf ("SBProcess(%p)::Continue () => SBError (%p): %s", process_sp.get(), sb_error.get(), sstr.GetData());
+ log->Printf ("SBProcess(%p)::Continue () => SBError (%p): %s",
+ static_cast<void*>(process_sp.get()),
+ static_cast<void*>(sb_error.get()), sstr.GetData());
}
return sb_error;
@@ -770,10 +785,9 @@ SBProcess::Destroy ()
{
SBStream sstr;
sb_error.GetDescription (sstr);
- log->Printf ("SBProcess(%p)::Destroy () => SBError (%p): %s",
- process_sp.get(),
- sb_error.get(),
- sstr.GetData());
+ log->Printf ("SBProcess(%p)::Destroy () => SBError (%p): %s",
+ static_cast<void*>(process_sp.get()),
+ static_cast<void*>(sb_error.get()), sstr.GetData());
}
return sb_error;
@@ -792,16 +806,15 @@ SBProcess::Stop ()
}
else
sb_error.SetErrorString ("SBProcess is invalid");
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
SBStream sstr;
sb_error.GetDescription (sstr);
- log->Printf ("SBProcess(%p)::Stop () => SBError (%p): %s",
- process_sp.get(),
- sb_error.get(),
- sstr.GetData());
+ log->Printf ("SBProcess(%p)::Stop () => SBError (%p): %s",
+ static_cast<void*>(process_sp.get()),
+ static_cast<void*>(sb_error.get()), sstr.GetData());
}
return sb_error;
@@ -825,10 +838,9 @@ SBProcess::Kill ()
{
SBStream sstr;
sb_error.GetDescription (sstr);
- log->Printf ("SBProcess(%p)::Kill () => SBError (%p): %s",
- process_sp.get(),
- sb_error.get(),
- sstr.GetData());
+ log->Printf ("SBProcess(%p)::Kill () => SBError (%p): %s",
+ static_cast<void*>(process_sp.get()),
+ static_cast<void*>(sb_error.get()), sstr.GetData());
}
return sb_error;
@@ -869,21 +881,32 @@ SBProcess::Signal (int signo)
sb_error.SetError (process_sp->Signal (signo));
}
else
- sb_error.SetErrorString ("SBProcess is invalid");
+ sb_error.SetErrorString ("SBProcess is invalid");
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
SBStream sstr;
sb_error.GetDescription (sstr);
- log->Printf ("SBProcess(%p)::Signal (signo=%i) => SBError (%p): %s",
- process_sp.get(),
- signo,
- sb_error.get(),
- sstr.GetData());
+ log->Printf ("SBProcess(%p)::Signal (signo=%i) => SBError (%p): %s",
+ static_cast<void*>(process_sp.get()), signo,
+ static_cast<void*>(sb_error.get()), sstr.GetData());
}
return sb_error;
}
+SBUnixSignals
+SBProcess::GetUnixSignals()
+{
+ SBUnixSignals sb_unix_signals;
+ ProcessSP process_sp(GetSP());
+ if (process_sp)
+ {
+ sb_unix_signals.SetSP(process_sp);
+ }
+
+ return sb_unix_signals;
+}
+
void
SBProcess::SendAsyncInterrupt ()
{
@@ -911,12 +934,9 @@ SBProcess::GetThreadByID (tid_t tid)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- {
log->Printf ("SBProcess(%p)::GetThreadByID (tid=0x%4.4" PRIx64 ") => SBThread (%p)",
- process_sp.get(),
- tid,
- thread_sp.get());
- }
+ static_cast<void*>(process_sp.get()), tid,
+ static_cast<void*>(thread_sp.get()));
return sb_thread;
}
@@ -938,12 +958,9 @@ SBProcess::GetThreadByIndexID (uint32_t index_id)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- {
- log->Printf ("SBProcess(%p)::GetThreadByID (tid=0x%x) => SBThread (%p)",
- process_sp.get(),
- index_id,
- thread_sp.get());
- }
+ log->Printf ("SBProcess(%p)::GetThreadByID (tid=0x%x) => SBThread (%p)",
+ static_cast<void*>(process_sp.get()), index_id,
+ static_cast<void*>(thread_sp.get()));
return sb_thread;
}
@@ -954,9 +971,10 @@ SBProcess::GetStateFromEvent (const SBEvent &event)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
StateType ret_val = Process::ProcessEventData::GetStateFromEvent (event.get());
-
+
if (log)
- log->Printf ("SBProcess::GetStateFromEvent (event.sp=%p) => %s", event.get(),
+ log->Printf ("SBProcess::GetStateFromEvent (event.sp=%p) => %s",
+ static_cast<void*>(event.get()),
lldb_private::StateAsCString (ret_val));
return ret_val;
@@ -1003,8 +1021,9 @@ SBProcess::GetBroadcaster () const
SBBroadcaster broadcaster(process_sp.get(), false);
if (log)
- log->Printf ("SBProcess(%p)::GetBroadcaster () => SBBroadcaster (%p)", process_sp.get(),
- broadcaster.get());
+ log->Printf ("SBProcess(%p)::GetBroadcaster () => SBBroadcaster (%p)",
+ static_cast<void*>(process_sp.get()),
+ static_cast<void*>(broadcaster.get()));
return broadcaster;
}
@@ -1025,15 +1044,11 @@ SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error
ProcessSP process_sp(GetSP());
if (log)
- {
log->Printf ("SBProcess(%p)::ReadMemory (addr=0x%" PRIx64 ", dst=%p, dst_len=%" PRIu64 ", SBError (%p))...",
- process_sp.get(),
- addr,
- dst,
- (uint64_t)dst_len,
- sb_error.get());
- }
-
+ static_cast<void*>(process_sp.get()), addr,
+ static_cast<void*>(dst), static_cast<uint64_t>(dst_len),
+ static_cast<void*>(sb_error.get()));
+
if (process_sp)
{
Process::StopLocker stop_locker;
@@ -1045,7 +1060,8 @@ SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error
else
{
if (log)
- log->Printf ("SBProcess(%p)::ReadMemory() => error: process is running", process_sp.get());
+ log->Printf ("SBProcess(%p)::ReadMemory() => error: process is running",
+ static_cast<void*>(process_sp.get()));
sb_error.SetErrorString("process is running");
}
}
@@ -1059,13 +1075,10 @@ SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error
SBStream sstr;
sb_error.GetDescription (sstr);
log->Printf ("SBProcess(%p)::ReadMemory (addr=0x%" PRIx64 ", dst=%p, dst_len=%" PRIu64 ", SBError (%p): %s) => %" PRIu64,
- process_sp.get(),
- addr,
- dst,
- (uint64_t)dst_len,
- sb_error.get(),
- sstr.GetData(),
- (uint64_t)bytes_read);
+ static_cast<void*>(process_sp.get()), addr,
+ static_cast<void*>(dst), static_cast<uint64_t>(dst_len),
+ static_cast<void*>(sb_error.get()), sstr.GetData(),
+ static_cast<uint64_t>(bytes_read));
}
return bytes_read;
@@ -1088,7 +1101,8 @@ SBProcess::ReadCStringFromMemory (addr_t addr, void *buf, size_t size, lldb::SBE
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::ReadCStringFromMemory() => error: process is running", process_sp.get());
+ log->Printf ("SBProcess(%p)::ReadCStringFromMemory() => error: process is running",
+ static_cast<void*>(process_sp.get()));
sb_error.SetErrorString("process is running");
}
}
@@ -1116,7 +1130,8 @@ SBProcess::ReadUnsignedFromMemory (addr_t addr, uint32_t byte_size, lldb::SBErro
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::ReadUnsignedFromMemory() => error: process is running", process_sp.get());
+ log->Printf ("SBProcess(%p)::ReadUnsignedFromMemory() => error: process is running",
+ static_cast<void*>(process_sp.get()));
sb_error.SetErrorString("process is running");
}
}
@@ -1144,7 +1159,8 @@ SBProcess::ReadPointerFromMemory (addr_t addr, lldb::SBError &sb_error)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::ReadPointerFromMemory() => error: process is running", process_sp.get());
+ log->Printf ("SBProcess(%p)::ReadPointerFromMemory() => error: process is running",
+ static_cast<void*>(process_sp.get()));
sb_error.SetErrorString("process is running");
}
}
@@ -1165,14 +1181,11 @@ SBProcess::WriteMemory (addr_t addr, const void *src, size_t src_len, SBError &s
ProcessSP process_sp(GetSP());
if (log)
- {
log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%" PRIx64 ", src=%p, src_len=%" PRIu64 ", SBError (%p))...",
- process_sp.get(),
- addr,
- src,
- (uint64_t)src_len,
- sb_error.get());
- }
+ static_cast<void*>(process_sp.get()), addr,
+ static_cast<const void*>(src),
+ static_cast<uint64_t>(src_len),
+ static_cast<void*>(sb_error.get()));
if (process_sp)
{
@@ -1185,7 +1198,8 @@ SBProcess::WriteMemory (addr_t addr, const void *src, size_t src_len, SBError &s
else
{
if (log)
- log->Printf ("SBProcess(%p)::WriteMemory() => error: process is running", process_sp.get());
+ log->Printf ("SBProcess(%p)::WriteMemory() => error: process is running",
+ static_cast<void*>(process_sp.get()));
sb_error.SetErrorString("process is running");
}
}
@@ -1195,13 +1209,11 @@ SBProcess::WriteMemory (addr_t addr, const void *src, size_t src_len, SBError &s
SBStream sstr;
sb_error.GetDescription (sstr);
log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%" PRIx64 ", src=%p, src_len=%" PRIu64 ", SBError (%p): %s) => %" PRIu64,
- process_sp.get(),
- addr,
- src,
- (uint64_t)src_len,
- sb_error.get(),
- sstr.GetData(),
- (uint64_t)bytes_written);
+ static_cast<void*>(process_sp.get()), addr,
+ static_cast<const void*>(src),
+ static_cast<uint64_t>(src_len),
+ static_cast<void*>(sb_error.get()), sstr.GetData(),
+ static_cast<uint64_t>(bytes_written));
}
return bytes_written;
@@ -1248,7 +1260,7 @@ SBProcess::GetNumSupportedHardwareWatchpoints (lldb::SBError &sb_error) const
sb_error.SetError(process_sp->GetWatchpointSupportInfo (num));
if (log)
log->Printf ("SBProcess(%p)::GetNumSupportedHardwareWatchpoints () => %u",
- process_sp.get(), num);
+ static_cast<void*>(process_sp.get()), num);
}
else
{
@@ -1273,13 +1285,14 @@ SBProcess::LoadImage (lldb::SBFileSpec &sb_image_spec, lldb::SBError &sb_error)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::LoadImage() => error: process is running", process_sp.get());
+ log->Printf ("SBProcess(%p)::LoadImage() => error: process is running",
+ static_cast<void*>(process_sp.get()));
sb_error.SetErrorString("process is running");
}
}
return LLDB_INVALID_IMAGE_TOKEN;
}
-
+
lldb::SBError
SBProcess::UnloadImage (uint32_t image_token)
{
@@ -1297,7 +1310,35 @@ SBProcess::UnloadImage (uint32_t image_token)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBProcess(%p)::UnloadImage() => error: process is running", process_sp.get());
+ log->Printf ("SBProcess(%p)::UnloadImage() => error: process is running",
+ static_cast<void*>(process_sp.get()));
+ sb_error.SetErrorString("process is running");
+ }
+ }
+ else
+ sb_error.SetErrorString("invalid process");
+ return sb_error;
+}
+
+lldb::SBError
+SBProcess::SendEventData (const char *event_data)
+{
+ lldb::SBError sb_error;
+ ProcessSP process_sp(GetSP());
+ if (process_sp)
+ {
+ Process::StopLocker stop_locker;
+ if (stop_locker.TryLock(&process_sp->GetRunLock()))
+ {
+ Mutex::Locker api_locker (process_sp->GetTarget().GetAPIMutex());
+ sb_error.SetError (process_sp->SendEventData (event_data));
+ }
+ else
+ {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf ("SBProcess(%p)::SendEventData() => error: process is running",
+ static_cast<void*>(process_sp.get()));
sb_error.SetErrorString("process is running");
}
}
@@ -1334,7 +1375,8 @@ SBProcess::GetExtendedBacktraceTypeAtIndex (uint32_t idx)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf("SBProcess(%p)::GetExtendedBacktraceTypeAtIndex() => error: requested extended backtrace name out of bounds", process_sp.get());
+ log->Printf("SBProcess(%p)::GetExtendedBacktraceTypeAtIndex() => error: requested extended backtrace name out of bounds",
+ static_cast<void*>(process_sp.get()));
}
}
return NULL;