aboutsummaryrefslogtreecommitdiff
path: root/source/API
diff options
context:
space:
mode:
Diffstat (limited to 'source/API')
-rw-r--r--source/API/SBAddress.cpp8
-rw-r--r--source/API/SBBreakpoint.cpp117
-rw-r--r--source/API/SBBreakpointLocation.cpp57
-rw-r--r--source/API/SBBroadcaster.cpp18
-rw-r--r--source/API/SBCommandInterpreter.cpp58
-rw-r--r--source/API/SBCommandReturnObject.cpp14
-rw-r--r--source/API/SBCommunication.cpp52
-rw-r--r--source/API/SBCompileUnit.cpp31
-rw-r--r--source/API/SBData.cpp182
-rw-r--r--source/API/SBDebugger.cpp153
-rw-r--r--source/API/SBDeclaration.cpp21
-rw-r--r--source/API/SBError.cpp12
-rw-r--r--source/API/SBEvent.cpp19
-rw-r--r--source/API/SBExpressionOptions.cpp61
-rw-r--r--source/API/SBFileSpec.cpp30
-rw-r--r--source/API/SBFileSpecList.cpp3
-rw-r--r--source/API/SBFrame.cpp169
-rw-r--r--source/API/SBFunction.cpp12
-rw-r--r--source/API/SBHostOS.cpp26
-rw-r--r--source/API/SBLineEntry.cpp20
-rw-r--r--source/API/SBListener.cpp38
-rw-r--r--source/API/SBModule.cpp49
-rw-r--r--source/API/SBProcess.cpp348
-rw-r--r--source/API/SBQueue.cpp136
-rw-r--r--source/API/SBQueueItem.cpp60
-rw-r--r--source/API/SBStream.cpp2
-rw-r--r--source/API/SBSymbol.cpp6
-rw-r--r--source/API/SBSymbolContext.cpp28
-rw-r--r--source/API/SBTarget.cpp453
-rw-r--r--source/API/SBThread.cpp374
-rw-r--r--source/API/SBType.cpp32
-rw-r--r--source/API/SBTypeEnumMember.cpp192
-rw-r--r--source/API/SBUnixSignals.cpp199
-rw-r--r--source/API/SBValue.cpp406
-rw-r--r--source/API/SBValueList.cpp16
-rw-r--r--source/API/SBWatchpoint.cpp13
36 files changed, 2313 insertions, 1102 deletions
diff --git a/source/API/SBAddress.cpp b/source/API/SBAddress.cpp
index 799c90907634..6aec0722169f 100644
--- a/source/API/SBAddress.cpp
+++ b/source/API/SBAddress.cpp
@@ -127,13 +127,15 @@ SBAddress::GetLoadAddress (const SBTarget &target) const
addr = m_opaque_ap->GetLoadAddress (target_sp.get());
}
}
-
+
if (log)
{
if (addr == LLDB_INVALID_ADDRESS)
- log->Printf ("SBAddress::GetLoadAddress (SBTarget(%p)) => LLDB_INVALID_ADDRESS", target_sp.get());
+ log->Printf ("SBAddress::GetLoadAddress (SBTarget(%p)) => LLDB_INVALID_ADDRESS",
+ static_cast<void*>(target_sp.get()));
else
- log->Printf ("SBAddress::GetLoadAddress (SBTarget(%p)) => 0x%" PRIx64, target_sp.get(), addr);
+ log->Printf ("SBAddress::GetLoadAddress (SBTarget(%p)) => 0x%" PRIx64,
+ static_cast<void*>(target_sp.get()), addr);
}
return addr;
diff --git a/source/API/SBBreakpoint.cpp b/source/API/SBBreakpoint.cpp
index fbdc0e32f498..a950ca934c68 100644
--- a/source/API/SBBreakpoint.cpp
+++ b/source/API/SBBreakpoint.cpp
@@ -19,9 +19,12 @@
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Breakpoint/StoppointCallbackContext.h"
#include "lldb/Core/Address.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/ScriptInterpreter.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/Target.h"
@@ -121,9 +124,11 @@ SBBreakpoint::GetID () const
if (log)
{
if (break_id == LLDB_INVALID_BREAK_ID)
- log->Printf ("SBBreakpoint(%p)::GetID () => LLDB_INVALID_BREAK_ID", m_opaque_sp.get());
+ log->Printf ("SBBreakpoint(%p)::GetID () => LLDB_INVALID_BREAK_ID",
+ static_cast<void*>(m_opaque_sp.get()));
else
- log->Printf ("SBBreakpoint(%p)::GetID () => %u", m_opaque_sp.get(), break_id);
+ log->Printf ("SBBreakpoint(%p)::GetID () => %u",
+ static_cast<void*>(m_opaque_sp.get()), break_id);
}
return break_id;
@@ -133,7 +138,12 @@ SBBreakpoint::GetID () const
bool
SBBreakpoint::IsValid() const
{
- return (bool) m_opaque_sp;
+ if (!m_opaque_sp)
+ return false;
+ else if (m_opaque_sp->GetTarget().GetBreakpointByID(m_opaque_sp->GetID()))
+ return true;
+ else
+ return false;
}
void
@@ -222,7 +232,8 @@ SBBreakpoint::SetEnabled (bool enable)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::SetEnabled (enabled=%i)", m_opaque_sp.get(), enable);
+ log->Printf ("SBBreakpoint(%p)::SetEnabled (enabled=%i)",
+ static_cast<void*>(m_opaque_sp.get()), enable);
if (m_opaque_sp)
{
@@ -249,7 +260,8 @@ SBBreakpoint::SetOneShot (bool one_shot)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::SetOneShot (one_shot=%i)", m_opaque_sp.get(), one_shot);
+ log->Printf ("SBBreakpoint(%p)::SetOneShot (one_shot=%i)",
+ static_cast<void*>(m_opaque_sp.get()), one_shot);
if (m_opaque_sp)
{
@@ -288,8 +300,9 @@ SBBreakpoint::SetIgnoreCount (uint32_t count)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::SetIgnoreCount (count=%u)", m_opaque_sp.get(), count);
-
+ log->Printf ("SBBreakpoint(%p)::SetIgnoreCount (count=%u)",
+ static_cast<void*>(m_opaque_sp.get()), count);
+
if (m_opaque_sp)
{
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
@@ -330,7 +343,8 @@ SBBreakpoint::GetHitCount () const
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::GetHitCount () => %u", m_opaque_sp.get(), count);
+ log->Printf ("SBBreakpoint(%p)::GetHitCount () => %u",
+ static_cast<void*>(m_opaque_sp.get()), count);
return count;
}
@@ -347,7 +361,8 @@ SBBreakpoint::GetIgnoreCount () const
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::GetIgnoreCount () => %u", m_opaque_sp.get(), count);
+ log->Printf ("SBBreakpoint(%p)::GetIgnoreCount () => %u",
+ static_cast<void*>(m_opaque_sp.get()), count);
return count;
}
@@ -362,7 +377,8 @@ SBBreakpoint::SetThreadID (tid_t tid)
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::SetThreadID (tid=0x%4.4" PRIx64 ")", m_opaque_sp.get(), tid);
+ log->Printf ("SBBreakpoint(%p)::SetThreadID (tid=0x%4.4" PRIx64 ")",
+ static_cast<void*>(m_opaque_sp.get()), tid);
}
@@ -378,7 +394,8 @@ SBBreakpoint::GetThreadID ()
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::GetThreadID () => 0x%4.4" PRIx64, m_opaque_sp.get(), tid);
+ log->Printf ("SBBreakpoint(%p)::GetThreadID () => 0x%4.4" PRIx64,
+ static_cast<void*>(m_opaque_sp.get()), tid);
return tid;
}
@@ -387,7 +404,8 @@ SBBreakpoint::SetThreadIndex (uint32_t index)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::SetThreadIndex (%u)", m_opaque_sp.get(), index);
+ log->Printf ("SBBreakpoint(%p)::SetThreadIndex (%u)",
+ static_cast<void*>(m_opaque_sp.get()), index);
if (m_opaque_sp)
{
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
@@ -408,18 +426,19 @@ SBBreakpoint::GetThreadIndex() const
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::GetThreadIndex () => %u", m_opaque_sp.get(), thread_idx);
+ log->Printf ("SBBreakpoint(%p)::GetThreadIndex () => %u",
+ static_cast<void*>(m_opaque_sp.get()), thread_idx);
return thread_idx;
}
-
void
SBBreakpoint::SetThreadName (const char *thread_name)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::SetThreadName (%s)", m_opaque_sp.get(), thread_name);
+ log->Printf ("SBBreakpoint(%p)::SetThreadName (%s)",
+ static_cast<void*>(m_opaque_sp.get()), thread_name);
if (m_opaque_sp)
{
@@ -441,7 +460,8 @@ SBBreakpoint::GetThreadName () const
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::GetThreadName () => %s", m_opaque_sp.get(), name);
+ log->Printf ("SBBreakpoint(%p)::GetThreadName () => %s",
+ static_cast<void*>(m_opaque_sp.get()), name);
return name;
}
@@ -451,7 +471,8 @@ SBBreakpoint::SetQueueName (const char *queue_name)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::SetQueueName (%s)", m_opaque_sp.get(), queue_name);
+ log->Printf ("SBBreakpoint(%p)::SetQueueName (%s)",
+ static_cast<void*>(m_opaque_sp.get()), queue_name);
if (m_opaque_sp)
{
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
@@ -472,7 +493,8 @@ SBBreakpoint::GetQueueName () const
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::GetQueueName () => %s", m_opaque_sp.get(), name);
+ log->Printf ("SBBreakpoint(%p)::GetQueueName () => %s",
+ static_cast<void*>(m_opaque_sp.get()), name);
return name;
}
@@ -488,7 +510,9 @@ SBBreakpoint::GetNumResolvedLocations() const
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::GetNumResolvedLocations () => %" PRIu64, m_opaque_sp.get(), (uint64_t)num_resolved);
+ log->Printf ("SBBreakpoint(%p)::GetNumResolvedLocations () => %" PRIu64,
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<uint64_t>(num_resolved));
return num_resolved;
}
@@ -503,7 +527,9 @@ SBBreakpoint::GetNumLocations() const
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBreakpoint(%p)::GetNumLocations () => %" PRIu64, m_opaque_sp.get(), (uint64_t)num_locs);
+ log->Printf ("SBBreakpoint(%p)::GetNumLocations () => %" PRIu64,
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<uint64_t>(num_locs));
return num_locs;
}
@@ -567,9 +593,14 @@ void
SBBreakpoint::SetCallback (BreakpointHitCallback callback, void *baton)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
if (log)
- log->Printf ("SBBreakpoint(%p)::SetCallback (callback=%p, baton=%p)", m_opaque_sp.get(), callback, baton);
+ {
+ void *pointer = &callback;
+ log->Printf ("SBBreakpoint(%p)::SetCallback (callback=%p, baton=%p)",
+ static_cast<void*>(m_opaque_sp.get()),
+ *static_cast<void**>(&pointer), static_cast<void*>(baton));
+ }
if (m_opaque_sp)
{
@@ -579,6 +610,48 @@ SBBreakpoint::SetCallback (BreakpointHitCallback callback, void *baton)
}
}
+void
+SBBreakpoint::SetScriptCallbackFunction (const char *callback_function_name)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ if (log)
+ log->Printf ("SBBreakpoint(%p)::SetScriptCallbackFunction (callback=%s)",
+ static_cast<void*>(m_opaque_sp.get()),
+ callback_function_name);
+
+ if (m_opaque_sp)
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ BreakpointOptions *bp_options = m_opaque_sp->GetOptions();
+ m_opaque_sp->GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter()->SetBreakpointCommandCallbackFunction (bp_options,
+ callback_function_name);
+ }
+}
+
+SBError
+SBBreakpoint::SetScriptCallbackBody (const char *callback_body_text)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ if (log)
+ log->Printf ("SBBreakpoint(%p)::SetScriptCallbackBody: callback body:\n%s)",
+ static_cast<void*>(m_opaque_sp.get()), callback_body_text);
+
+ SBError sb_error;
+ if (m_opaque_sp)
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
+ BreakpointOptions *bp_options = m_opaque_sp->GetOptions();
+ Error error = m_opaque_sp->GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter()->SetBreakpointCommandCallback (bp_options,
+ callback_body_text);
+ sb_error.SetError(error);
+ }
+ else
+ sb_error.SetErrorString("invalid breakpoint");
+
+ return sb_error;
+}
lldb_private::Breakpoint *
SBBreakpoint::operator->() const
diff --git a/source/API/SBBreakpointLocation.cpp b/source/API/SBBreakpointLocation.cpp
index 6fdf59f38b4a..4390e9ad737a 100644
--- a/source/API/SBBreakpointLocation.cpp
+++ b/source/API/SBBreakpointLocation.cpp
@@ -17,10 +17,13 @@
#include "lldb/lldb-defines.h"
#include "lldb/Breakpoint/Breakpoint.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
-#include "lldb/Target/ThreadSpec.h"
+#include "lldb/Core/Debugger.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/ScriptInterpreter.h"
+#include "lldb/Target/ThreadSpec.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/ThreadSpec.h"
@@ -43,7 +46,9 @@ SBBreakpointLocation::SBBreakpointLocation (const lldb::BreakpointLocationSP &br
SBStream sstr;
GetDescription (sstr, lldb::eDescriptionLevelBrief);
log->Printf ("SBBreakpointLocation::SBBreakpointLocaiton (const lldb::BreakpointLocationsSP &break_loc_sp"
- "=%p) => this.sp = %p (%s)", break_loc_sp.get(), m_opaque_sp.get(), sstr.GetData());
+ "=%p) => this.sp = %p (%s)",
+ static_cast<void*>(break_loc_sp.get()),
+ static_cast<void*>(m_opaque_sp.get()), sstr.GetData());
}
}
@@ -160,6 +165,49 @@ SBBreakpointLocation::GetCondition ()
}
void
+SBBreakpointLocation::SetScriptCallbackFunction (const char *callback_function_name)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ if (log)
+ log->Printf ("SBBreakpointLocation(%p)::SetScriptCallbackFunction (callback=%s)",
+ static_cast<void*>(m_opaque_sp.get()),
+ callback_function_name);
+
+ if (m_opaque_sp)
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ BreakpointOptions *bp_options = m_opaque_sp->GetLocationOptions();
+ m_opaque_sp->GetBreakpoint().GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter()->SetBreakpointCommandCallbackFunction (bp_options,
+ callback_function_name);
+ }
+}
+
+SBError
+SBBreakpointLocation::SetScriptCallbackBody (const char *callback_body_text)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ if (log)
+ log->Printf ("SBBreakpoint(%p)::SetScriptCallbackBody: callback body:\n%s)",
+ static_cast<void*>(m_opaque_sp.get()), callback_body_text);
+
+ SBError sb_error;
+ if (m_opaque_sp)
+ {
+ Mutex::Locker api_locker (m_opaque_sp->GetBreakpoint().GetTarget().GetAPIMutex());
+ BreakpointOptions *bp_options = m_opaque_sp->GetLocationOptions();
+ Error error = m_opaque_sp->GetBreakpoint().GetTarget().GetDebugger().GetCommandInterpreter().GetScriptInterpreter()->SetBreakpointCommandCallback (bp_options,
+ callback_body_text);
+ sb_error.SetError(error);
+ }
+ else
+ sb_error.SetErrorString("invalid breakpoint");
+
+ return sb_error;
+}
+
+void
SBBreakpointLocation::SetThreadID (tid_t thread_id)
{
if (m_opaque_sp)
@@ -312,8 +360,9 @@ SBBreakpointLocation::GetBreakpoint ()
{
SBStream sstr;
sb_bp.GetDescription (sstr);
- log->Printf ("SBBreakpointLocation(%p)::GetBreakpoint () => SBBreakpoint(%p) %s",
- m_opaque_sp.get(), sb_bp.get(), sstr.GetData());
+ log->Printf ("SBBreakpointLocation(%p)::GetBreakpoint () => SBBreakpoint(%p) %s",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(sb_bp.get()), sstr.GetData());
}
return sb_bp;
}
diff --git a/source/API/SBBroadcaster.cpp b/source/API/SBBroadcaster.cpp
index 7168305ac80b..73eac5183f8a 100644
--- a/source/API/SBBroadcaster.cpp
+++ b/source/API/SBBroadcaster.cpp
@@ -33,7 +33,7 @@ SBBroadcaster::SBBroadcaster (const char *name) :
if (log)
log->Printf ("SBBroadcaster::SBBroadcaster (name=\"%s\") => SBBroadcaster(%p)",
- name, m_opaque_ptr);
+ name, static_cast<void*>(m_opaque_ptr));
}
SBBroadcaster::SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns) :
@@ -43,8 +43,9 @@ SBBroadcaster::SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE));
if (log)
- log->Printf ("SBBroadcaster::SBBroadcaster (broadcaster=%p, bool owns=%i) => SBBroadcaster(%p)",
- broadcaster, owns, m_opaque_ptr);
+ log->Printf ("SBBroadcaster::SBBroadcaster (broadcaster=%p, bool owns=%i) => SBBroadcaster(%p)",
+ static_cast<void*>(broadcaster), owns,
+ static_cast<void*>(m_opaque_ptr));
}
SBBroadcaster::SBBroadcaster (const SBBroadcaster &rhs) :
@@ -75,7 +76,8 @@ SBBroadcaster::BroadcastEventByType (uint32_t event_type, bool unique)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (event_type=0x%8.8x, unique=%i)", m_opaque_ptr, event_type, unique);
+ log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (event_type=0x%8.8x, unique=%i)",
+ static_cast<void*>(m_opaque_ptr), event_type, unique);
if (m_opaque_ptr == NULL)
return;
@@ -92,7 +94,9 @@ SBBroadcaster::BroadcastEvent (const SBEvent &event, bool unique)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (SBEvent(%p), unique=%i)", m_opaque_ptr, event.get(), unique);
+ log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (SBEvent(%p), unique=%i)",
+ static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(event.get()), unique);
if (m_opaque_ptr == NULL)
return;
@@ -109,7 +113,9 @@ SBBroadcaster::AddInitialEventsToListener (const SBListener &listener, uint32_t
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBBroadcaster(%p)::AddInitialEventsToListener (SBListener(%p), event_mask=0x%8.8x)", m_opaque_ptr, listener.get(), requested_events);
+ log->Printf ("SBBroadcaster(%p)::AddInitialEventsToListener (SBListener(%p), event_mask=0x%8.8x)",
+ static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(listener.get()), requested_events);
if (m_opaque_ptr)
m_opaque_ptr->AddInitialEventsToListener (listener.get(), requested_events);
}
diff --git a/source/API/SBCommandInterpreter.cpp b/source/API/SBCommandInterpreter.cpp
index f1faa13ba981..e1adea795b08 100644
--- a/source/API/SBCommandInterpreter.cpp
+++ b/source/API/SBCommandInterpreter.cpp
@@ -65,7 +65,9 @@ SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter *interpreter) :
if (log)
log->Printf ("SBCommandInterpreter::SBCommandInterpreter (interpreter=%p)"
- " => SBCommandInterpreter(%p)", interpreter, m_opaque_ptr);
+ " => SBCommandInterpreter(%p)",
+ static_cast<void*>(interpreter),
+ static_cast<void*>(m_opaque_ptr));
}
SBCommandInterpreter::SBCommandInterpreter(const SBCommandInterpreter &rhs) :
@@ -129,12 +131,14 @@ SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnOb
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBCommandInterpreter(%p)::HandleCommand (command=\"%s\", SBCommandReturnObject(%p), add_to_history=%i)",
- m_opaque_ptr, command_line, result.get(), add_to_history);
+ log->Printf ("SBCommandInterpreter(%p)::HandleCommand (command=\"%s\", SBCommandReturnObject(%p), add_to_history=%i)",
+ static_cast<void*>(m_opaque_ptr), command_line,
+ static_cast<void*>(result.get()), add_to_history);
result.Clear();
if (command_line && m_opaque_ptr)
{
+ result.ref().SetInteractive(false);
m_opaque_ptr->HandleCommand (command_line, add_to_history ? eLazyBoolYes : eLazyBoolNo, result.ref());
}
else
@@ -150,7 +154,9 @@ SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnOb
SBStream sstr;
result.GetDescription (sstr);
log->Printf ("SBCommandInterpreter(%p)::HandleCommand (command=\"%s\", SBCommandReturnObject(%p): %s, add_to_history=%i) => %i",
- m_opaque_ptr, command_line, result.get(), sstr.GetData(), add_to_history, result.GetStatus());
+ static_cast<void*>(m_opaque_ptr), command_line,
+ static_cast<void*>(result.get()), sstr.GetData(),
+ add_to_history, result.GetStatus());
}
return result.GetStatus();
@@ -166,23 +172,27 @@ SBCommandInterpreter::HandleCompletion (const char *current_line,
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
int num_completions = 0;
-
+
// Sanity check the arguments that are passed in:
// cursor & last_char have to be within the current_line.
if (current_line == NULL || cursor == NULL || last_char == NULL)
return 0;
-
+
if (cursor < current_line || last_char < current_line)
return 0;
-
+
size_t current_line_size = strlen (current_line);
- if (cursor - current_line > current_line_size || last_char - current_line > current_line_size)
+ if (cursor - current_line > static_cast<ptrdiff_t>(current_line_size) ||
+ last_char - current_line > static_cast<ptrdiff_t>(current_line_size))
return 0;
-
+
if (log)
log->Printf ("SBCommandInterpreter(%p)::HandleCompletion (current_line=\"%s\", cursor at: %" PRId64 ", last char at: %" PRId64 ", match_start_point: %d, max_return_elements: %d)",
- m_opaque_ptr, current_line, (uint64_t) (cursor - current_line), (uint64_t) (last_char - current_line), match_start_point, max_return_elements);
-
+ static_cast<void*>(m_opaque_ptr), current_line,
+ static_cast<uint64_t>(cursor - current_line),
+ static_cast<uint64_t>(last_char - current_line),
+ match_start_point, max_return_elements);
+
if (m_opaque_ptr)
{
lldb_private::StringList lldb_matches;
@@ -193,8 +203,9 @@ SBCommandInterpreter::HandleCompletion (const char *current_line,
matches.AppendList (temp_list);
}
if (log)
- log->Printf ("SBCommandInterpreter(%p)::HandleCompletion - Found %d completions.", m_opaque_ptr, num_completions);
-
+ log->Printf ("SBCommandInterpreter(%p)::HandleCompletion - Found %d completions.",
+ static_cast<void*>(m_opaque_ptr), num_completions);
+
return num_completions;
}
@@ -253,9 +264,9 @@ SBCommandInterpreter::GetProcess ()
if (log)
log->Printf ("SBCommandInterpreter(%p)::GetProcess () => SBProcess(%p)",
- m_opaque_ptr, process_sp.get());
+ static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(process_sp.get()));
-
return sb_process;
}
@@ -266,12 +277,12 @@ SBCommandInterpreter::GetDebugger ()
if (m_opaque_ptr)
sb_debugger.reset(m_opaque_ptr->GetDebugger().shared_from_this());
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
if (log)
log->Printf ("SBCommandInterpreter(%p)::GetDebugger () => SBDebugger(%p)",
- m_opaque_ptr, sb_debugger.get());
-
-
+ static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(sb_debugger.get()));
+
return sb_debugger;
}
@@ -315,8 +326,8 @@ SBCommandInterpreter::SourceInitFileInHomeDirectory (SBCommandReturnObject &resu
if (log)
log->Printf ("SBCommandInterpreter(%p)::SourceInitFileInHomeDirectory (&SBCommandReturnObject(%p))",
- m_opaque_ptr, result.get());
-
+ static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(result.get()));
}
void
@@ -340,7 +351,8 @@ SBCommandInterpreter::SourceInitFileInCurrentWorkingDirectory (SBCommandReturnOb
if (log)
log->Printf ("SBCommandInterpreter(%p)::SourceInitFileInCurrentWorkingDirectory (&SBCommandReturnObject(%p))",
- m_opaque_ptr, result.get());
+ static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(result.get()));
}
SBBroadcaster
@@ -352,7 +364,7 @@ SBCommandInterpreter::GetBroadcaster ()
if (log)
log->Printf ("SBCommandInterpreter(%p)::GetBroadcaster() => SBBroadcaster(%p)",
- m_opaque_ptr, broadcaster.get());
+ static_cast<void*>(m_opaque_ptr), static_cast<void*>(broadcaster.get()));
return broadcaster;
}
diff --git a/source/API/SBCommandReturnObject.cpp b/source/API/SBCommandReturnObject.cpp
index 83d65637d3f2..1ae2df76c979 100644
--- a/source/API/SBCommandReturnObject.cpp
+++ b/source/API/SBCommandReturnObject.cpp
@@ -75,14 +75,16 @@ SBCommandReturnObject::GetOutput ()
if (m_opaque_ap.get())
{
if (log)
- log->Printf ("SBCommandReturnObject(%p)::GetOutput () => \"%s\"", m_opaque_ap.get(),
+ log->Printf ("SBCommandReturnObject(%p)::GetOutput () => \"%s\"",
+ static_cast<void*>(m_opaque_ap.get()),
m_opaque_ap->GetOutputData());
return m_opaque_ap->GetOutputData();
}
if (log)
- log->Printf ("SBCommandReturnObject(%p)::GetOutput () => NULL", m_opaque_ap.get());
+ log->Printf ("SBCommandReturnObject(%p)::GetOutput () => NULL",
+ static_cast<void*>(m_opaque_ap.get()));
return NULL;
}
@@ -95,14 +97,16 @@ SBCommandReturnObject::GetError ()
if (m_opaque_ap.get())
{
if (log)
- log->Printf ("SBCommandReturnObject(%p)::GetError () => \"%s\"", m_opaque_ap.get(),
+ log->Printf ("SBCommandReturnObject(%p)::GetError () => \"%s\"",
+ static_cast<void*>(m_opaque_ap.get()),
m_opaque_ap->GetErrorData());
return m_opaque_ap->GetErrorData();
}
-
+
if (log)
- log->Printf ("SBCommandReturnObject(%p)::GetError () => NULL", m_opaque_ap.get());
+ log->Printf ("SBCommandReturnObject(%p)::GetError () => NULL",
+ static_cast<void*>(m_opaque_ap.get()));
return NULL;
}
diff --git a/source/API/SBCommunication.cpp b/source/API/SBCommunication.cpp
index 10feae5d4ebb..df0b864fad94 100644
--- a/source/API/SBCommunication.cpp
+++ b/source/API/SBCommunication.cpp
@@ -32,7 +32,8 @@ SBCommunication::SBCommunication(const char * broadcaster_name) :
if (log)
log->Printf ("SBCommunication::SBCommunication (broadcaster_name=\"%s\") => "
- "SBCommunication(%p)", broadcaster_name, m_opaque);
+ "SBCommunication(%p)", broadcaster_name,
+ static_cast<void*>(m_opaque));
}
SBCommunication::~SBCommunication()
@@ -97,8 +98,9 @@ SBCommunication::AdoptFileDesriptor (int fd, bool owns_fd)
}
if (log)
- log->Printf ("SBCommunication(%p)::AdoptFileDescriptor (fd=%d, ownd_fd=%i) => %s",
- m_opaque, fd, owns_fd, Communication::ConnectionStatusAsCString (status));
+ log->Printf ("SBCommunication(%p)::AdoptFileDescriptor (fd=%d, ownd_fd=%i) => %s",
+ static_cast<void*>(m_opaque), fd, owns_fd,
+ Communication::ConnectionStatusAsCString (status));
return status;
}
@@ -114,7 +116,8 @@ SBCommunication::Disconnect ()
status = m_opaque->Disconnect ();
if (log)
- log->Printf ("SBCommunication(%p)::Disconnect () => %s", m_opaque,
+ log->Printf ("SBCommunication(%p)::Disconnect () => %s",
+ static_cast<void*>(m_opaque),
Communication::ConnectionStatusAsCString (status));
return status;
@@ -129,7 +132,8 @@ SBCommunication::IsConnected () const
result = m_opaque->IsConnected ();
if (log)
- log->Printf ("SBCommunication(%p)::IsConnected () => %i", m_opaque, result);
+ log->Printf ("SBCommunication(%p)::IsConnected () => %i",
+ static_cast<void*>(m_opaque), result);
return false;
}
@@ -140,10 +144,8 @@ SBCommunication::Read (void *dst, size_t dst_len, uint32_t timeout_usec, Connect
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBCommunication(%p)::Read (dst=%p, dst_len=%" PRIu64 ", timeout_usec=%u, &status)...",
- m_opaque,
- dst,
- (uint64_t)dst_len,
- timeout_usec);
+ static_cast<void*>(m_opaque), static_cast<void*>(dst),
+ static_cast<uint64_t>(dst_len), timeout_usec);
size_t bytes_read = 0;
if (m_opaque)
bytes_read = m_opaque->Read (dst, dst_len, timeout_usec, status, NULL);
@@ -152,12 +154,10 @@ SBCommunication::Read (void *dst, size_t dst_len, uint32_t timeout_usec, Connect
if (log)
log->Printf ("SBCommunication(%p)::Read (dst=%p, dst_len=%" PRIu64 ", timeout_usec=%u, &status=%s) => %" PRIu64,
- m_opaque,
- dst,
- (uint64_t)dst_len,
- timeout_usec,
+ static_cast<void*>(m_opaque), static_cast<void*>(dst),
+ static_cast<uint64_t>(dst_len), timeout_usec,
Communication::ConnectionStatusAsCString (status),
- (uint64_t)bytes_read);
+ static_cast<uint64_t>(bytes_read));
return bytes_read;
}
@@ -174,7 +174,10 @@ SBCommunication::Write (const void *src, size_t src_len, ConnectionStatus &statu
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBCommunication(%p)::Write (src=%p, src_len=%" PRIu64 ", &status=%s) => %" PRIu64,
- m_opaque, src, (uint64_t)src_len, Communication::ConnectionStatusAsCString (status), (uint64_t)bytes_written);
+ static_cast<void*>(m_opaque), static_cast<const void*>(src),
+ static_cast<uint64_t>(src_len),
+ Communication::ConnectionStatusAsCString (status),
+ static_cast<uint64_t>(bytes_written));
return 0;
}
@@ -189,7 +192,8 @@ SBCommunication::ReadThreadStart ()
success = m_opaque->StartReadThread ();
if (log)
- log->Printf ("SBCommunication(%p)::ReadThreadStart () => %i", m_opaque, success);
+ log->Printf ("SBCommunication(%p)::ReadThreadStart () => %i",
+ static_cast<void*>(m_opaque), success);
return success;
}
@@ -200,14 +204,16 @@ SBCommunication::ReadThreadStop ()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBCommunication(%p)::ReadThreadStop ()...", m_opaque);
+ log->Printf ("SBCommunication(%p)::ReadThreadStop ()...",
+ static_cast<void*>(m_opaque));
bool success = false;
if (m_opaque)
success = m_opaque->StopReadThread ();
if (log)
- log->Printf ("SBCommunication(%p)::ReadThreadStop () => %i", m_opaque, success);
+ log->Printf ("SBCommunication(%p)::ReadThreadStop () => %i",
+ static_cast<void*>(m_opaque), success);
return success;
}
@@ -220,7 +226,8 @@ SBCommunication::ReadThreadIsRunning ()
result = m_opaque->ReadThreadIsRunning ();
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBCommunication(%p)::ReadThreadIsRunning () => %i", m_opaque, result);
+ log->Printf ("SBCommunication(%p)::ReadThreadIsRunning () => %i",
+ static_cast<void*>(m_opaque), result);
return result;
}
@@ -242,7 +249,9 @@ SBCommunication::SetReadThreadBytesReceivedCallback
if (log)
log->Printf ("SBCommunication(%p)::SetReadThreadBytesReceivedCallback (callback=%p, baton=%p) => %i",
- m_opaque, callback, callback_baton, result);
+ static_cast<void*>(m_opaque),
+ reinterpret_cast<void*>(reinterpret_cast<intptr_t>(callback)),
+ static_cast<void*>(callback_baton), result);
return result;
}
@@ -256,7 +265,8 @@ SBCommunication::GetBroadcaster ()
if (log)
log->Printf ("SBCommunication(%p)::GetBroadcaster () => SBBroadcaster (%p)",
- m_opaque, broadcaster.get());
+ static_cast<void*>(m_opaque),
+ static_cast<void*>(broadcaster.get()));
return broadcaster;
}
diff --git a/source/API/SBCompileUnit.cpp b/source/API/SBCompileUnit.cpp
index 9f7487746a85..03c25710a9e4 100644
--- a/source/API/SBCompileUnit.cpp
+++ b/source/API/SBCompileUnit.cpp
@@ -87,13 +87,14 @@ SBCompileUnit::GetLineEntryAtIndex (uint32_t idx) const
sb_line_entry.SetLineEntry(line_entry);
}
}
-
+
if (log)
{
SBStream sstr;
sb_line_entry.GetDescription (sstr);
- log->Printf ("SBCompileUnit(%p)::GetLineEntryAtIndex (idx=%u) => SBLineEntry(%p): '%s'",
- m_opaque_ptr, idx, sb_line_entry.get(), sstr.GetData());
+ log->Printf ("SBCompileUnit(%p)::GetLineEntryAtIndex (idx=%u) => SBLineEntry(%p): '%s'",
+ static_cast<void*>(m_opaque_ptr), idx,
+ static_cast<void*>(sb_line_entry.get()), sstr.GetData());
}
return sb_line_entry;
@@ -120,7 +121,6 @@ SBCompileUnit::FindLineEntryIndex (uint32_t start_idx, uint32_t line, SBFileSpec
else
file_spec = *m_opaque_ptr;
-
index = m_opaque_ptr->FindLineEntry (start_idx,
line,
inline_file_spec ? inline_file_spec->get() : NULL,
@@ -133,13 +133,20 @@ SBCompileUnit::FindLineEntryIndex (uint32_t start_idx, uint32_t line, SBFileSpec
SBStream sstr;
if (index == UINT32_MAX)
{
- log->Printf ("SBCompileUnit(%p)::FindLineEntryIndex (start_idx=%u, line=%u, SBFileSpec(%p)) => NOT FOUND",
- m_opaque_ptr, start_idx, line, inline_file_spec ? inline_file_spec->get() : NULL);
+ log->Printf ("SBCompileUnit(%p)::FindLineEntryIndex (start_idx=%u, line=%u, SBFileSpec(%p)) => NOT FOUND",
+ static_cast<void*>(m_opaque_ptr), start_idx, line,
+ inline_file_spec
+ ? static_cast<const void*>(inline_file_spec->get())
+ : NULL);
}
else
{
- log->Printf ("SBCompileUnit(%p)::FindLineEntryIndex (start_idx=%u, line=%u, SBFileSpec(%p)) => %u",
- m_opaque_ptr, start_idx, line, inline_file_spec ? inline_file_spec->get() : NULL, index);
+ log->Printf ("SBCompileUnit(%p)::FindLineEntryIndex (start_idx=%u, line=%u, SBFileSpec(%p)) => %u",
+ static_cast<void*>(m_opaque_ptr), start_idx, line,
+ inline_file_spec
+ ? static_cast<const void*>(inline_file_spec->get())
+ : NULL,
+ index);
}
}
@@ -196,13 +203,15 @@ SBCompileUnit::GetSupportFileAtIndex (uint32_t idx) const
FileSpec file_spec = support_files.GetFileSpecAtIndex(idx);
sb_file_spec.SetFileSpec(file_spec);
}
-
+
if (log)
{
SBStream sstr;
sb_file_spec.GetDescription (sstr);
- log->Printf ("SBCompileUnit(%p)::GetGetFileSpecAtIndex (idx=%u) => SBFileSpec(%p): '%s'",
- m_opaque_ptr, idx, sb_file_spec.get(), sstr.GetData());
+ log->Printf ("SBCompileUnit(%p)::GetGetFileSpecAtIndex (idx=%u) => SBFileSpec(%p): '%s'",
+ static_cast<void*>(m_opaque_ptr), idx,
+ static_cast<const void*>(sb_file_spec.get()),
+ sstr.GetData());
}
return sb_file_spec;
diff --git a/source/API/SBData.cpp b/source/API/SBData.cpp
index 06dcfc12af41..a58585295a21 100644
--- a/source/API/SBData.cpp
+++ b/source/API/SBData.cpp
@@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//
+#include <inttypes.h> // PRIu64
+
#include "lldb/API/SBData.h"
#include "lldb/API/SBError.h"
#include "lldb/API/SBStream.h"
@@ -122,7 +124,7 @@ SBData::GetByteSize ()
value = m_opaque_sp->GetByteSize();
if (log)
log->Printf ("SBData::GetByteSize () => "
- "(%zu)", value);
+ "( %" PRIu64 " )", (uint64_t)value);
return value;
}
@@ -167,8 +169,8 @@ SBData::GetFloat (lldb::SBError& error, lldb::offset_t offset)
error.SetErrorString("unable to read data");
}
if (log)
- log->Printf ("SBData::GetFloat (error=%p,offset=%" PRIu64 ") => "
- "(%f)", error.get(), offset, value);
+ log->Printf ("SBData::GetFloat (error=%p,offset=%" PRIu64 ") => (%f)",
+ static_cast<void*>(error.get()), offset, value);
return value;
}
@@ -190,7 +192,7 @@ SBData::GetDouble (lldb::SBError& error, lldb::offset_t offset)
}
if (log)
log->Printf ("SBData::GetDouble (error=%p,offset=%" PRIu64 ") => "
- "(%f)", error.get(), offset, value);
+ "(%f)", static_cast<void*>(error.get()), offset, value);
return value;
}
@@ -212,7 +214,7 @@ SBData::GetLongDouble (lldb::SBError& error, lldb::offset_t offset)
}
if (log)
log->Printf ("SBData::GetLongDouble (error=%p,offset=%" PRIu64 ") => "
- "(%Lf)", error.get(), offset, value);
+ "(%Lf)", static_cast<void*>(error.get()), offset, value);
return value;
}
@@ -234,7 +236,8 @@ SBData::GetAddress (lldb::SBError& error, lldb::offset_t offset)
}
if (log)
log->Printf ("SBData::GetAddress (error=%p,offset=%" PRIu64 ") => "
- "(%p)", error.get(), offset, (void*)value);
+ "(%p)", static_cast<void*>(error.get()), offset,
+ reinterpret_cast<void*>(value));
return value;
}
@@ -256,7 +259,7 @@ SBData::GetUnsignedInt8 (lldb::SBError& error, lldb::offset_t offset)
}
if (log)
log->Printf ("SBData::GetUnsignedInt8 (error=%p,offset=%" PRIu64 ") => "
- "(%c)", error.get(), offset, value);
+ "(%c)", static_cast<void*>(error.get()), offset, value);
return value;
}
@@ -278,7 +281,7 @@ SBData::GetUnsignedInt16 (lldb::SBError& error, lldb::offset_t offset)
}
if (log)
log->Printf ("SBData::GetUnsignedInt16 (error=%p,offset=%" PRIu64 ") => "
- "(%hd)", error.get(), offset, value);
+ "(%hd)", static_cast<void*>(error.get()), offset, value);
return value;
}
@@ -300,7 +303,7 @@ SBData::GetUnsignedInt32 (lldb::SBError& error, lldb::offset_t offset)
}
if (log)
log->Printf ("SBData::GetUnsignedInt32 (error=%p,offset=%" PRIu64 ") => "
- "(%d)", error.get(), offset, value);
+ "(%d)", static_cast<void*>(error.get()), offset, value);
return value;
}
@@ -322,7 +325,8 @@ SBData::GetUnsignedInt64 (lldb::SBError& error, lldb::offset_t offset)
}
if (log)
log->Printf ("SBData::GetUnsignedInt64 (error=%p,offset=%" PRIu64 ") => "
- "(%" PRId64 ")", error.get(), offset, value);
+ "(%" PRId64 ")", static_cast<void*>(error.get()), offset,
+ value);
return value;
}
@@ -344,7 +348,7 @@ SBData::GetSignedInt8 (lldb::SBError& error, lldb::offset_t offset)
}
if (log)
log->Printf ("SBData::GetSignedInt8 (error=%p,offset=%" PRIu64 ") => "
- "(%c)", error.get(), offset, value);
+ "(%c)", static_cast<void*>(error.get()), offset, value);
return value;
}
@@ -366,7 +370,7 @@ SBData::GetSignedInt16 (lldb::SBError& error, lldb::offset_t offset)
}
if (log)
log->Printf ("SBData::GetSignedInt16 (error=%p,offset=%" PRIu64 ") => "
- "(%hd)", error.get(), offset, value);
+ "(%hd)", static_cast<void*>(error.get()), offset, value);
return value;
}
@@ -388,7 +392,7 @@ SBData::GetSignedInt32 (lldb::SBError& error, lldb::offset_t offset)
}
if (log)
log->Printf ("SBData::GetSignedInt32 (error=%p,offset=%" PRIu64 ") => "
- "(%d)", error.get(), offset, value);
+ "(%d)", static_cast<void*>(error.get()), offset, value);
return value;
}
@@ -410,7 +414,8 @@ SBData::GetSignedInt64 (lldb::SBError& error, lldb::offset_t offset)
}
if (log)
log->Printf ("SBData::GetSignedInt64 (error=%p,offset=%" PRIu64 ") => "
- "(%" PRId64 ")", error.get(), offset, value);
+ "(%" PRId64 ")", static_cast<void*>(error.get()), offset,
+ value);
return value;
}
@@ -431,8 +436,9 @@ SBData::GetString (lldb::SBError& error, lldb::offset_t offset)
error.SetErrorString("unable to read data");
}
if (log)
- log->Printf ("SBData::GetString (error=%p,offset=%" PRIu64 ") => "
- "(%p)", error.get(), offset, value);
+ log->Printf ("SBData::GetString (error=%p,offset=%" PRIu64 ") => (%p)",
+ static_cast<void*>(error.get()), offset,
+ static_cast<const void*>(value));
return value;
}
@@ -479,8 +485,10 @@ SBData::ReadRawData (lldb::SBError& error,
error.SetErrorString("unable to read data");
}
if (log)
- log->Printf ("SBData::ReadRawData (error=%p,offset=%" PRIu64 ",buf=%p,size=%zu) => "
- "(%p)", error.get(), offset, buf, size, ok);
+ log->Printf("SBData::ReadRawData (error=%p,offset=%" PRIu64 ",buf=%p,size=%" PRIu64 ") => "
+ "(%p)", static_cast<void*>(error.get()), offset,
+ static_cast<void*>(buf), static_cast<uint64_t>(size),
+ static_cast<void*>(ok));
return ok ? size : 0;
}
@@ -497,8 +505,10 @@ SBData::SetData (lldb::SBError& error,
else
m_opaque_sp->SetData(buf, size, endian);
if (log)
- log->Printf ("SBData::SetData (error=%p,buf=%p,size=%zu,endian=%d,addr_size=%c) => "
- "(%p)", error.get(), buf, size, endian, addr_size, m_opaque_sp.get());
+ log->Printf("SBData::SetData (error=%p,buf=%p,size=%" PRIu64 ",endian=%d,addr_size=%c) => "
+ "(%p)", static_cast<void*>(error.get()),
+ static_cast<const void*>(buf), static_cast<uint64_t>(size),
+ endian, addr_size, static_cast<void*>(m_opaque_sp.get()));
}
bool
@@ -509,8 +519,8 @@ SBData::Append (const SBData& rhs)
if (m_opaque_sp.get() && rhs.m_opaque_sp.get())
value = m_opaque_sp.get()->Append(*rhs.m_opaque_sp);
if (log)
- log->Printf ("SBData::Append (rhs=%p) => "
- "(%s)", rhs.get(), value ? "true" : "false");
+ log->Printf ("SBData::Append (rhs=%p) => (%s)",
+ static_cast<void*>(rhs.get()), value ? "true" : "false");
return value;
}
@@ -614,28 +624,28 @@ bool
SBData::SetDataFromCString (const char* data)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
if (!data)
{
if (log)
- log->Printf ("SBData::SetDataFromCString (data=%p) => "
- "false", data);
+ log->Printf ("SBData::SetDataFromCString (data=%p) => false",
+ static_cast<const void*>(data));
return false;
}
-
+
size_t data_len = strlen(data);
-
+
lldb::DataBufferSP buffer_sp(new DataBufferHeap(data, data_len));
-
+
if (!m_opaque_sp.get())
m_opaque_sp.reset(new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize()));
else
m_opaque_sp->SetData(buffer_sp);
-
+
if (log)
- log->Printf ("SBData::SetDataFromCString (data=%p) => "
- "true", data);
-
+ log->Printf ("SBData::SetDataFromCString (data=%p) => true",
+ static_cast<const void*>(data));
+
return true;
}
@@ -643,28 +653,30 @@ bool
SBData::SetDataFromUInt64Array (uint64_t* array, size_t array_len)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
if (!array || array_len == 0)
{
if (log)
- log->Printf ("SBData::SetDataFromUInt64Array (array=%p, array_len = %zu) => "
- "false", array, array_len);
+ log->Printf("SBData::SetDataFromUInt64Array (array=%p, array_len = %" PRIu64 ") => "
+ "false", static_cast<void*>(array),
+ static_cast<uint64_t>(array_len));
return false;
}
size_t data_len = array_len * sizeof(uint64_t);
-
+
lldb::DataBufferSP buffer_sp(new DataBufferHeap(array, data_len));
-
+
if (!m_opaque_sp.get())
m_opaque_sp.reset(new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize()));
else
m_opaque_sp->SetData(buffer_sp);
-
+
if (log)
- log->Printf ("SBData::SetDataFromUInt64Array (array=%p, array_len = %zu) => "
- "true", array, array_len);
-
+ log->Printf("SBData::SetDataFromUInt64Array (array=%p, array_len = %" PRIu64 ") => "
+ "true", static_cast<void*>(array),
+ static_cast<uint64_t>(array_len));
+
return true;
}
@@ -672,28 +684,30 @@ bool
SBData::SetDataFromUInt32Array (uint32_t* array, size_t array_len)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
if (!array || array_len == 0)
{
if (log)
- log->Printf ("SBData::SetDataFromUInt32Array (array=%p, array_len = %zu) => "
- "false", array, array_len);
+ log->Printf("SBData::SetDataFromUInt32Array (array=%p, array_len = %" PRIu64 ") => "
+ "false", static_cast<void*>(array),
+ static_cast<uint64_t>(array_len));
return false;
}
-
+
size_t data_len = array_len * sizeof(uint32_t);
-
+
lldb::DataBufferSP buffer_sp(new DataBufferHeap(array, data_len));
-
+
if (!m_opaque_sp.get())
m_opaque_sp.reset(new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize()));
else
m_opaque_sp->SetData(buffer_sp);
-
+
if (log)
- log->Printf ("SBData::SetDataFromUInt32Array (array=%p, array_len = %zu) => "
- "true", array, array_len);
-
+ log->Printf("SBData::SetDataFromUInt32Array (array=%p, array_len = %" PRIu64 ") => "
+ "true", static_cast<void*>(array),
+ static_cast<uint64_t>(array_len));
+
return true;
}
@@ -701,28 +715,30 @@ bool
SBData::SetDataFromSInt64Array (int64_t* array, size_t array_len)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
if (!array || array_len == 0)
{
if (log)
- log->Printf ("SBData::SetDataFromSInt64Array (array=%p, array_len = %zu) => "
- "false", array, array_len);
+ log->Printf("SBData::SetDataFromSInt64Array (array=%p, array_len = %" PRIu64 ") => "
+ "false", static_cast<void*>(array),
+ static_cast<uint64_t>(array_len));
return false;
}
-
+
size_t data_len = array_len * sizeof(int64_t);
-
+
lldb::DataBufferSP buffer_sp(new DataBufferHeap(array, data_len));
-
+
if (!m_opaque_sp.get())
m_opaque_sp.reset(new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize()));
else
m_opaque_sp->SetData(buffer_sp);
-
+
if (log)
- log->Printf ("SBData::SetDataFromSInt64Array (array=%p, array_len = %zu) => "
- "true", array, array_len);
-
+ log->Printf("SBData::SetDataFromSInt64Array (array=%p, array_len = %" PRIu64 ") => "
+ "true", static_cast<void*>(array),
+ static_cast<uint64_t>(array_len));
+
return true;
}
@@ -730,28 +746,30 @@ bool
SBData::SetDataFromSInt32Array (int32_t* array, size_t array_len)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
if (!array || array_len == 0)
{
if (log)
- log->Printf ("SBData::SetDataFromSInt32Array (array=%p, array_len = %zu) => "
- "false", array, array_len);
+ log->Printf("SBData::SetDataFromSInt32Array (array=%p, array_len = %" PRIu64 ") => "
+ "false", static_cast<void*>(array),
+ static_cast<uint64_t>(array_len));
return false;
}
-
+
size_t data_len = array_len * sizeof(int32_t);
-
+
lldb::DataBufferSP buffer_sp(new DataBufferHeap(array, data_len));
-
+
if (!m_opaque_sp.get())
m_opaque_sp.reset(new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize()));
else
m_opaque_sp->SetData(buffer_sp);
-
+
if (log)
- log->Printf ("SBData::SetDataFromSInt32Array (array=%p, array_len = %zu) => "
- "true", array, array_len);
-
+ log->Printf("SBData::SetDataFromSInt32Array (array=%p, array_len = %" PRIu64 ") => "
+ "true", static_cast<void*>(array),
+ static_cast<uint64_t>(array_len));
+
return true;
}
@@ -759,27 +777,29 @@ bool
SBData::SetDataFromDoubleArray (double* array, size_t array_len)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
if (!array || array_len == 0)
{
if (log)
- log->Printf ("SBData::SetDataFromDoubleArray (array=%p, array_len = %zu) => "
- "false", array, array_len);
+ log->Printf("SBData::SetDataFromDoubleArray (array=%p, array_len = %" PRIu64 ") => "
+ "false", static_cast<void*>(array),
+ static_cast<uint64_t>(array_len));
return false;
}
-
+
size_t data_len = array_len * sizeof(double);
-
+
lldb::DataBufferSP buffer_sp(new DataBufferHeap(array, data_len));
-
+
if (!m_opaque_sp.get())
m_opaque_sp.reset(new DataExtractor(buffer_sp, GetByteOrder(), GetAddressByteSize()));
else
m_opaque_sp->SetData(buffer_sp);
-
+
if (log)
- log->Printf ("SBData::SetDataFromDoubleArray (array=%p, array_len = %zu) => "
- "true", array, array_len);
-
+ log->Printf("SBData::SetDataFromDoubleArray (array=%p, array_len = %" PRIu64 ") => "
+ "true", static_cast<void*>(array),
+ static_cast<uint64_t>(array_len));
+
return true;
}
diff --git a/source/API/SBDebugger.cpp b/source/API/SBDebugger.cpp
index 8d6887a6c280..dae567525a4a 100644
--- a/source/API/SBDebugger.cpp
+++ b/source/API/SBDebugger.cpp
@@ -38,13 +38,14 @@
#include "lldb/Core/State.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/DataFormatters/DataVisualization.h"
-#include "lldb/Host/DynamicLibrary.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/OptionGroupPlatform.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/TargetList.h"
+#include "llvm/Support/DynamicLibrary.h"
+
using namespace lldb;
using namespace lldb_private;
@@ -72,22 +73,22 @@ SBInputReader::IsActive() const
return false;
}
-static lldb::DynamicLibrarySP
+static llvm::sys::DynamicLibrary
LoadPlugin (const lldb::DebuggerSP &debugger_sp, const FileSpec& spec, Error& error)
{
- lldb::DynamicLibrarySP dynlib_sp(new lldb_private::DynamicLibrary(spec));
- if (dynlib_sp && dynlib_sp->IsValid())
+ llvm::sys::DynamicLibrary dynlib = llvm::sys::DynamicLibrary::getPermanentLibrary(spec.GetPath().c_str());
+ if (dynlib.isValid())
{
typedef bool (*LLDBCommandPluginInit) (lldb::SBDebugger& debugger);
lldb::SBDebugger debugger_sb(debugger_sp);
// This calls the bool lldb::PluginInitialize(lldb::SBDebugger debugger) function.
// TODO: mangle this differently for your system - on OSX, the first underscore needs to be removed and the second one stays
- LLDBCommandPluginInit init_func = dynlib_sp->GetSymbol<LLDBCommandPluginInit>("_ZN4lldb16PluginInitializeENS_10SBDebuggerE");
+ LLDBCommandPluginInit init_func = (LLDBCommandPluginInit)dynlib.getAddressOfSymbol("_ZN4lldb16PluginInitializeENS_10SBDebuggerE");
if (init_func)
{
if (init_func(debugger_sb))
- return dynlib_sp;
+ return dynlib;
else
error.SetErrorString("plug-in refused to load (lldb::PluginInitialize(lldb::SBDebugger) returned false)");
}
@@ -103,7 +104,7 @@ LoadPlugin (const lldb::DebuggerSP &debugger_sp, const FileSpec& spec, Error& er
else
error.SetErrorString("no such file");
}
- return lldb::DynamicLibrarySP();
+ return llvm::sys::DynamicLibrary();
}
void
@@ -131,8 +132,9 @@ SBDebugger::Clear ()
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBDebugger(%p)::Clear ()", m_opaque_sp.get());
-
+ log->Printf ("SBDebugger(%p)::Clear ()",
+ static_cast<void*>(m_opaque_sp.get()));
+
if (m_opaque_sp)
m_opaque_sp->ClearIOHandlers ();
@@ -158,13 +160,24 @@ SBDebugger::Create(bool source_init_files, lldb::LogOutputCallback callback, voi
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBDebugger debugger;
+
+ // Currently we have issues if this function is called simultaneously on two different
+ // threads. The issues mainly revolve around the fact that the lldb_private::FormatManager
+ // uses global collections and having two threads parsing the .lldbinit files can cause
+ // mayhem. So to get around this for now we need to use a mutex to prevent bad things
+ // from happening.
+ static Mutex g_mutex(Mutex::eMutexTypeRecursive);
+ Mutex::Locker locker(g_mutex);
+
debugger.reset(Debugger::CreateInstance(callback, baton));
if (log)
{
SBStream sstr;
debugger.GetDescription (sstr);
- log->Printf ("SBDebugger::Create () => SBDebugger(%p): %s", debugger.m_opaque_sp.get(), sstr.GetData());
+ log->Printf ("SBDebugger::Create () => SBDebugger(%p): %s",
+ static_cast<void*>(debugger.m_opaque_sp.get()),
+ sstr.GetData());
}
SBCommandInterpreter interp = debugger.GetCommandInterpreter();
@@ -187,16 +200,18 @@ void
SBDebugger::Destroy (SBDebugger &debugger)
{
Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
if (log)
{
SBStream sstr;
debugger.GetDescription (sstr);
- log->Printf ("SBDebugger::Destroy () => SBDebugger(%p): %s", debugger.m_opaque_sp.get(), sstr.GetData());
+ log->Printf ("SBDebugger::Destroy () => SBDebugger(%p): %s",
+ static_cast<void*>(debugger.m_opaque_sp.get()),
+ sstr.GetData());
}
-
+
Debugger::Destroy (debugger.m_opaque_sp);
-
+
if (debugger.m_opaque_sp.get() != NULL)
debugger.m_opaque_sp.reset();
}
@@ -293,8 +308,9 @@ SBDebugger::SetInputFileHandle (FILE *fh, bool transfer_ownership)
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBDebugger(%p)::SetInputFileHandle (fh=%p, transfer_ownership=%i)", m_opaque_sp.get(),
- fh, transfer_ownership);
+ log->Printf ("SBDebugger(%p)::SetInputFileHandle (fh=%p, transfer_ownership=%i)",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(fh), transfer_ownership);
if (m_opaque_sp)
m_opaque_sp->SetInputFileHandle (fh, transfer_ownership);
@@ -307,8 +323,9 @@ SBDebugger::SetOutputFileHandle (FILE *fh, bool transfer_ownership)
if (log)
- log->Printf ("SBDebugger(%p)::SetOutputFileHandle (fh=%p, transfer_ownership=%i)", m_opaque_sp.get(),
- fh, transfer_ownership);
+ log->Printf ("SBDebugger(%p)::SetOutputFileHandle (fh=%p, transfer_ownership=%i)",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(fh), transfer_ownership);
if (m_opaque_sp)
m_opaque_sp->SetOutputFileHandle (fh, transfer_ownership);
@@ -321,8 +338,9 @@ SBDebugger::SetErrorFileHandle (FILE *fh, bool transfer_ownership)
if (log)
- log->Printf ("SBDebugger(%p)::SetErrorFileHandle (fh=%p, transfer_ownership=%i)", m_opaque_sp.get(),
- fh, transfer_ownership);
+ log->Printf ("SBDebugger(%p)::SetErrorFileHandle (fh=%p, transfer_ownership=%i)",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(fh), transfer_ownership);
if (m_opaque_sp)
m_opaque_sp->SetErrorFileHandle (fh, transfer_ownership);
@@ -389,8 +407,9 @@ SBDebugger::GetCommandInterpreter ()
sb_interpreter.reset (&m_opaque_sp->GetCommandInterpreter());
if (log)
- log->Printf ("SBDebugger(%p)::GetCommandInterpreter () => SBCommandInterpreter(%p)",
- m_opaque_sp.get(), sb_interpreter.get());
+ log->Printf ("SBDebugger(%p)::GetCommandInterpreter () => SBCommandInterpreter(%p)",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(sb_interpreter.get()));
return sb_interpreter;
}
@@ -443,8 +462,9 @@ SBDebugger::GetListener ()
sb_listener.reset(&m_opaque_sp->GetListener(), false);
if (log)
- log->Printf ("SBDebugger(%p)::GetListener () => SBListener(%p)", m_opaque_sp.get(),
- sb_listener.get());
+ log->Printf ("SBDebugger(%p)::GetListener () => SBListener(%p)",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(sb_listener.get()));
return sb_listener;
}
@@ -601,14 +621,14 @@ SBDebugger::CreateTarget (const char *filename,
sb_error.Clear();
OptionGroupPlatform platform_options (false);
platform_options.SetPlatformName (platform_name);
-
+
sb_error.ref() = m_opaque_sp->GetTargetList().CreateTarget (*m_opaque_sp,
filename,
target_triple,
add_dependent_modules,
&platform_options,
target_sp);
-
+
if (sb_error.Success())
sb_target.SetSP (target_sp);
}
@@ -616,20 +636,14 @@ SBDebugger::CreateTarget (const char *filename,
{
sb_error.SetErrorString("invalid target");
}
-
+
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- {
- log->Printf ("SBDebugger(%p)::CreateTarget (filename=\"%s\", triple=%s, platform_name=%s, add_dependent_modules=%u, error=%s) => SBTarget(%p)",
- m_opaque_sp.get(),
- filename,
- target_triple,
- platform_name,
- add_dependent_modules,
- sb_error.GetCString(),
- target_sp.get());
- }
-
+ log->Printf ("SBDebugger(%p)::CreateTarget (filename=\"%s\", triple=%s, platform_name=%s, add_dependent_modules=%u, error=%s) => SBTarget(%p)",
+ static_cast<void*>(m_opaque_sp.get()), filename,
+ target_triple, platform_name, add_dependent_modules,
+ sb_error.GetCString(), static_cast<void*>(target_sp.get()));
+
return sb_target;
}
@@ -650,13 +664,12 @@ SBDebugger::CreateTargetWithFileAndTargetTriple (const char *filename,
target_sp));
sb_target.SetSP (target_sp);
}
-
+
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- {
- log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndTargetTriple (filename=\"%s\", triple=%s) => SBTarget(%p)",
- m_opaque_sp.get(), filename, target_triple, target_sp.get());
- }
+ log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndTargetTriple (filename=\"%s\", triple=%s) => SBTarget(%p)",
+ static_cast<void*>(m_opaque_sp.get()), filename,
+ target_triple, static_cast<void*>(target_sp.get()));
return sb_target;
}
@@ -688,10 +701,9 @@ SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *arch_
}
if (log)
- {
- log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndArch (filename=\"%s\", arch=%s) => SBTarget(%p)",
- m_opaque_sp.get(), filename, arch_cstr, target_sp.get());
- }
+ log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndArch (filename=\"%s\", arch=%s) => SBTarget(%p)",
+ static_cast<void*>(m_opaque_sp.get()), filename, arch_cstr,
+ static_cast<void*>(target_sp.get()));
return sb_target;
}
@@ -723,10 +735,9 @@ SBDebugger::CreateTarget (const char *filename)
}
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- {
- log->Printf ("SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)",
- m_opaque_sp.get(), filename, target_sp.get());
- }
+ log->Printf ("SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)",
+ static_cast<void*>(m_opaque_sp.get()), filename,
+ static_cast<void*>(target_sp.get()));
return sb_target;
}
@@ -750,9 +761,9 @@ SBDebugger::DeleteTarget (lldb::SBTarget &target)
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- {
- log->Printf ("SBDebugger(%p)::DeleteTarget (SBTarget(%p)) => %i", m_opaque_sp.get(), target.m_opaque_sp.get(), result);
- }
+ log->Printf ("SBDebugger(%p)::DeleteTarget (SBTarget(%p)) => %i",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(target.m_opaque_sp.get()), result);
return result;
}
@@ -850,8 +861,9 @@ SBDebugger::GetSelectedTarget ()
{
SBStream sstr;
sb_target.GetDescription (sstr, eDescriptionLevelBrief);
- log->Printf ("SBDebugger(%p)::GetSelectedTarget () => SBTarget(%p): %s", m_opaque_sp.get(),
- target_sp.get(), sstr.GetData());
+ log->Printf ("SBDebugger(%p)::GetSelectedTarget () => SBTarget(%p): %s",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(target_sp.get()), sstr.GetData());
}
return sb_target;
@@ -871,8 +883,9 @@ SBDebugger::SetSelectedTarget (SBTarget &sb_target)
{
SBStream sstr;
sb_target.GetDescription (sstr, eDescriptionLevelBrief);
- log->Printf ("SBDebugger(%p)::SetSelectedTarget () => SBTarget(%p): %s", m_opaque_sp.get(),
- target_sp.get(), sstr.GetData());
+ log->Printf ("SBDebugger(%p)::SetSelectedTarget () => SBTarget(%p): %s",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(target_sp.get()), sstr.GetData());
}
}
@@ -888,10 +901,10 @@ SBDebugger::GetSelectedPlatform()
sb_platform.SetSP(debugger_sp->GetPlatformList().GetSelectedPlatform());
}
if (log)
- {
- log->Printf ("SBDebugger(%p)::GetSelectedPlatform () => SBPlatform(%p): %s", m_opaque_sp.get(),
- sb_platform.GetSP().get(), sb_platform.GetName());
- }
+ log->Printf ("SBDebugger(%p)::GetSelectedPlatform () => SBPlatform(%p): %s",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(sb_platform.GetSP().get()),
+ sb_platform.GetName());
return sb_platform;
}
@@ -899,17 +912,18 @@ void
SBDebugger::SetSelectedPlatform(SBPlatform &sb_platform)
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
DebuggerSP debugger_sp(m_opaque_sp);
if (debugger_sp)
{
debugger_sp->GetPlatformList().SetSelectedPlatform(sb_platform.GetSP());
}
+
if (log)
- {
- log->Printf ("SBDebugger(%p)::SetSelectedPlatform (SBPlatform(%p) %s)", m_opaque_sp.get(),
- sb_platform.GetSP().get(), sb_platform.GetName());
- }
+ log->Printf ("SBDebugger(%p)::SetSelectedPlatform (SBPlatform(%p) %s)",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(sb_platform.GetSP().get()),
+ sb_platform.GetName());
}
void
@@ -1077,9 +1091,10 @@ const char *
SBDebugger::GetPrompt() const
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
if (log)
- log->Printf ("SBDebugger(%p)::GetPrompt () => \"%s\"", m_opaque_sp.get(),
+ log->Printf ("SBDebugger(%p)::GetPrompt () => \"%s\"",
+ static_cast<void*>(m_opaque_sp.get()),
(m_opaque_sp ? m_opaque_sp->GetPrompt() : ""));
if (m_opaque_sp)
diff --git a/source/API/SBDeclaration.cpp b/source/API/SBDeclaration.cpp
index fc90156e75ad..8aea675afeba 100644
--- a/source/API/SBDeclaration.cpp
+++ b/source/API/SBDeclaration.cpp
@@ -74,19 +74,21 @@ SBFileSpec
SBDeclaration::GetFileSpec () const
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
SBFileSpec sb_file_spec;
if (m_opaque_ap.get() && m_opaque_ap->GetFile())
sb_file_spec.SetFileSpec(m_opaque_ap->GetFile());
-
+
if (log)
{
SBStream sstr;
sb_file_spec.GetDescription (sstr);
- log->Printf ("SBLineEntry(%p)::GetFileSpec () => SBFileSpec(%p): %s", m_opaque_ap.get(),
- sb_file_spec.get(), sstr.GetData());
+ log->Printf ("SBLineEntry(%p)::GetFileSpec () => SBFileSpec(%p): %s",
+ static_cast<void*>(m_opaque_ap.get()),
+ static_cast<const void*>(sb_file_spec.get()),
+ sstr.GetData());
}
-
+
return sb_file_spec;
}
@@ -94,14 +96,15 @@ uint32_t
SBDeclaration::GetLine () const
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
uint32_t line = 0;
if (m_opaque_ap.get())
line = m_opaque_ap->GetLine();
-
+
if (log)
- log->Printf ("SBLineEntry(%p)::GetLine () => %u", m_opaque_ap.get(), line);
-
+ log->Printf ("SBLineEntry(%p)::GetLine () => %u",
+ static_cast<void*>(m_opaque_ap.get()), line);
+
return line;
}
diff --git a/source/API/SBError.cpp b/source/API/SBError.cpp
index bd6b54300f60..157997b2502f 100644
--- a/source/API/SBError.cpp
+++ b/source/API/SBError.cpp
@@ -77,7 +77,8 @@ SBError::Fail () const
ret_value = m_opaque_ap->Fail();
if (log)
- log->Printf ("SBError(%p)::Fail () => %i", m_opaque_ap.get(), ret_value);
+ log->Printf ("SBError(%p)::Fail () => %i",
+ static_cast<void*>(m_opaque_ap.get()), ret_value);
return ret_value;
}
@@ -91,7 +92,8 @@ SBError::Success () const
ret_value = m_opaque_ap->Success();
if (log)
- log->Printf ("SBError(%p)::Success () => %i", m_opaque_ap.get(), ret_value);
+ log->Printf ("SBError(%p)::Success () => %i",
+ static_cast<void*>(m_opaque_ap.get()), ret_value);
return ret_value;
}
@@ -106,7 +108,8 @@ SBError::GetError () const
err = m_opaque_ap->GetError();
if (log)
- log->Printf ("SBError(%p)::GetError () => 0x%8.8x", m_opaque_ap.get(), err);
+ log->Printf ("SBError(%p)::GetError () => 0x%8.8x",
+ static_cast<void*>(m_opaque_ap.get()), err);
return err;
@@ -121,7 +124,8 @@ SBError::GetType () const
err_type = m_opaque_ap->GetType();
if (log)
- log->Printf ("SBError(%p)::GetType () => %i", m_opaque_ap.get(), err_type);
+ log->Printf ("SBError(%p)::GetType () => %i",
+ static_cast<void*>(m_opaque_ap.get()), err_type);
return err_type;
}
diff --git a/source/API/SBEvent.cpp b/source/API/SBEvent.cpp
index d5d4a84bc1fd..57a699fd739d 100644
--- a/source/API/SBEvent.cpp
+++ b/source/API/SBEvent.cpp
@@ -92,9 +92,11 @@ SBEvent::GetType () const
{
StreamString sstr;
if (lldb_event && lldb_event->GetBroadcaster() && lldb_event->GetBroadcaster()->GetEventNames(sstr, event_type, true))
- log->Printf ("SBEvent(%p)::GetType () => 0x%8.8x (%s)", get(), event_type, sstr.GetData());
+ log->Printf ("SBEvent(%p)::GetType () => 0x%8.8x (%s)",
+ static_cast<void*>(get()), event_type, sstr.GetData());
else
- log->Printf ("SBEvent(%p)::GetType () => 0x%8.8x", get(), event_type);
+ log->Printf ("SBEvent(%p)::GetType () => 0x%8.8x",
+ static_cast<void*>(get()), event_type);
}
@@ -141,11 +143,10 @@ SBEvent::BroadcasterMatchesRef (const SBBroadcaster &broadcaster)
// For logging, this gets a little chatty so only enable this when verbose logging is on
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE));
if (log)
- log->Printf ("SBEvent(%p)::BroadcasterMatchesRef (SBBroadcaster(%p): %s) => %i",
- get(),
- broadcaster.get(),
- broadcaster.GetName(),
- success);
+ log->Printf ("SBEvent(%p)::BroadcasterMatchesRef (SBBroadcaster(%p): %s) => %i",
+ static_cast<void*>(get()),
+ static_cast<void*>(broadcaster.get()),
+ broadcaster.GetName(), success);
return success;
}
@@ -206,8 +207,8 @@ SBEvent::GetCStringFromEvent (const SBEvent &event)
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBEvent(%p)::GetCStringFromEvent () => \"%s\"",
- event.get(),
+ log->Printf ("SBEvent(%p)::GetCStringFromEvent () => \"%s\"",
+ static_cast<void*>(event.get()),
reinterpret_cast<const char *>(EventDataBytes::GetBytesFromEvent (event.get())));
return reinterpret_cast<const char *>(EventDataBytes::GetBytesFromEvent (event.get()));
diff --git a/source/API/SBExpressionOptions.cpp b/source/API/SBExpressionOptions.cpp
index ae1c8f99df30..448ff4cf6dd6 100644
--- a/source/API/SBExpressionOptions.cpp
+++ b/source/API/SBExpressionOptions.cpp
@@ -101,6 +101,18 @@ SBExpressionOptions::SetTimeoutInMicroSeconds (uint32_t timeout)
m_opaque_ap->SetTimeoutUsec (timeout);
}
+uint32_t
+SBExpressionOptions::GetOneThreadTimeoutInMicroSeconds () const
+{
+ return m_opaque_ap->GetOneThreadTimeoutUsec ();
+}
+
+void
+SBExpressionOptions::SetOneThreadTimeoutInMicroSeconds (uint32_t timeout)
+{
+ m_opaque_ap->SetOneThreadTimeoutUsec (timeout);
+}
+
bool
SBExpressionOptions::GetTryAllThreads () const
{
@@ -114,6 +126,18 @@ SBExpressionOptions::SetTryAllThreads (bool run_others)
}
bool
+SBExpressionOptions::GetStopOthers () const
+{
+ return m_opaque_ap->GetStopOthers ();
+}
+
+void
+SBExpressionOptions::SetStopOthers (bool run_others)
+{
+ m_opaque_ap->SetStopOthers (run_others);
+}
+
+bool
SBExpressionOptions::GetTrapExceptions () const
{
return m_opaque_ap->GetTrapExceptions ();
@@ -125,6 +149,43 @@ SBExpressionOptions::SetTrapExceptions (bool trap_exceptions)
m_opaque_ap->SetTrapExceptions (trap_exceptions);
}
+void
+SBExpressionOptions::SetLanguage (lldb::LanguageType language)
+{
+ m_opaque_ap->SetLanguage(language);
+}
+
+void
+SBExpressionOptions::SetCancelCallback (lldb::ExpressionCancelCallback callback, void *baton)
+{
+ m_opaque_ap->SetCancelCallback (callback, baton);
+}
+
+bool
+SBExpressionOptions::GetGenerateDebugInfo ()
+{
+ return m_opaque_ap->GetGenerateDebugInfo();
+}
+
+void
+SBExpressionOptions::SetGenerateDebugInfo (bool b)
+{
+ return m_opaque_ap->SetGenerateDebugInfo(b);
+}
+
+bool
+SBExpressionOptions::GetSuppressPersistentResult ()
+{
+ return m_opaque_ap->GetResultIsInternal ();
+}
+
+void
+SBExpressionOptions::SetSuppressPersistentResult (bool b)
+{
+ return m_opaque_ap->SetResultIsInternal (b);
+}
+
+
EvaluateExpressionOptions *
SBExpressionOptions::get() const
{
diff --git a/source/API/SBFileSpec.cpp b/source/API/SBFileSpec.cpp
index 4fd2866c9b05..8d63fc587d81 100644
--- a/source/API/SBFileSpec.cpp
+++ b/source/API/SBFileSpec.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+#include <inttypes.h> // PRIu64
#include <limits.h>
#include "lldb/API/SBFileSpec.h"
@@ -15,6 +16,8 @@
#include "lldb/Core/Log.h"
#include "lldb/Core/Stream.h"
+#include "llvm/ADT/SmallString.h"
+
using namespace lldb;
using namespace lldb_private;
@@ -35,7 +38,7 @@ SBFileSpec::SBFileSpec (const lldb_private::FileSpec& fspec) :
{
}
-// Deprected!!!
+// Deprecated!!!
SBFileSpec::SBFileSpec (const char *path) :
m_opaque_ap(new FileSpec (path, true))
{
@@ -72,7 +75,9 @@ SBFileSpec::Exists () const
bool result = m_opaque_ap->Exists();
if (log)
- log->Printf ("SBFileSpec(%p)::Exists () => %s", m_opaque_ap.get(), (result ? "true" : "false"));
+ log->Printf ("SBFileSpec(%p)::Exists () => %s",
+ static_cast<void*>(m_opaque_ap.get()),
+ (result ? "true" : "false"));
return result;
}
@@ -86,7 +91,11 @@ SBFileSpec::ResolveExecutableLocation ()
int
SBFileSpec::ResolvePath (const char *src_path, char *dst_path, size_t dst_len)
{
- return lldb_private::FileSpec::Resolve (src_path, dst_path, dst_len);
+ llvm::SmallString<64> result(src_path);
+ lldb_private::FileSpec::Resolve (result);
+ size_t result_length = std::min(dst_len-1, result.size());
+ ::strncpy(dst_path, result.c_str(), result_length + 1);
+ return result_length;
}
const char *
@@ -98,9 +107,11 @@ SBFileSpec::GetFilename() const
if (log)
{
if (s)
- log->Printf ("SBFileSpec(%p)::GetFilename () => \"%s\"", m_opaque_ap.get(), s);
+ log->Printf ("SBFileSpec(%p)::GetFilename () => \"%s\"",
+ static_cast<void*>(m_opaque_ap.get()), s);
else
- log->Printf ("SBFileSpec(%p)::GetFilename () => NULL", m_opaque_ap.get());
+ log->Printf ("SBFileSpec(%p)::GetFilename () => NULL",
+ static_cast<void*>(m_opaque_ap.get()));
}
return s;
@@ -114,9 +125,11 @@ SBFileSpec::GetDirectory() const
if (log)
{
if (s)
- log->Printf ("SBFileSpec(%p)::GetDirectory () => \"%s\"", m_opaque_ap.get(), s);
+ log->Printf ("SBFileSpec(%p)::GetDirectory () => \"%s\"",
+ static_cast<void*>(m_opaque_ap.get()), s);
else
- log->Printf ("SBFileSpec(%p)::GetDirectory () => NULL", m_opaque_ap.get());
+ log->Printf ("SBFileSpec(%p)::GetDirectory () => NULL",
+ static_cast<void*>(m_opaque_ap.get()));
}
return s;
}
@@ -148,7 +161,8 @@ SBFileSpec::GetPath (char *dst_path, size_t dst_len) const
if (log)
log->Printf ("SBFileSpec(%p)::GetPath (dst_path=\"%.*s\", dst_len=%" PRIu64 ") => %u",
- m_opaque_ap.get(), result, dst_path, (uint64_t)dst_len, result);
+ static_cast<void*>(m_opaque_ap.get()), result, dst_path,
+ static_cast<uint64_t>(dst_len), result);
if (result == 0 && dst_path && dst_len > 0)
*dst_path = '\0';
diff --git a/source/API/SBFileSpecList.cpp b/source/API/SBFileSpecList.cpp
index 3ebf3cc80a2a..a457a754f0d0 100644
--- a/source/API/SBFileSpecList.cpp
+++ b/source/API/SBFileSpecList.cpp
@@ -38,7 +38,8 @@ SBFileSpecList::SBFileSpecList (const SBFileSpecList &rhs) :
if (log)
{
log->Printf ("SBFileSpecList::SBFileSpecList (const SBFileSpecList rhs.ap=%p) => SBFileSpecList(%p)",
- rhs.m_opaque_ap.get(), m_opaque_ap.get());
+ static_cast<void*>(rhs.m_opaque_ap.get()),
+ static_cast<void*>(m_opaque_ap.get()));
}
}
diff --git a/source/API/SBFrame.cpp b/source/API/SBFrame.cpp
index 44fc654c44b6..325f40fd5b56 100644
--- a/source/API/SBFrame.cpp
+++ b/source/API/SBFrame.cpp
@@ -63,9 +63,9 @@ SBFrame::SBFrame (const StackFrameSP &lldb_object_sp) :
{
SBStream sstr;
GetDescription (sstr);
- log->Printf ("SBFrame::SBFrame (sp=%p) => SBFrame(%p): %s",
- lldb_object_sp.get(), lldb_object_sp.get(), sstr.GetData());
-
+ log->Printf ("SBFrame::SBFrame (sp=%p) => SBFrame(%p): %s",
+ static_cast<void*>(lldb_object_sp.get()),
+ static_cast<void*>(lldb_object_sp.get()), sstr.GetData());
}
}
@@ -141,8 +141,9 @@ SBFrame::GetSymbolContext (uint32_t resolve_scope) const
}
if (log)
- log->Printf ("SBFrame(%p)::GetSymbolContext (resolve_scope=0x%8.8x) => SBSymbolContext(%p)",
- frame, resolve_scope, sb_sym_ctx.get());
+ log->Printf ("SBFrame(%p)::GetSymbolContext (resolve_scope=0x%8.8x) => SBSymbolContext(%p)",
+ static_cast<void*>(frame), resolve_scope,
+ static_cast<void*>(sb_sym_ctx.get()));
return sb_sym_ctx;
}
@@ -184,8 +185,9 @@ SBFrame::GetModule () const
}
if (log)
- log->Printf ("SBFrame(%p)::GetModule () => SBModule(%p)",
- frame, module_sp.get());
+ log->Printf ("SBFrame(%p)::GetModule () => SBModule(%p)",
+ static_cast<void*>(frame),
+ static_cast<void*>(module_sp.get()));
return sb_module;
}
@@ -224,8 +226,9 @@ SBFrame::GetCompileUnit () const
}
}
if (log)
- log->Printf ("SBFrame(%p)::GetCompileUnit () => SBCompileUnit(%p)",
- frame, sb_comp_unit.get());
+ log->Printf ("SBFrame(%p)::GetCompileUnit () => SBCompileUnit(%p)",
+ static_cast<void*>(frame),
+ static_cast<void*>(sb_comp_unit.get()));
return sb_comp_unit;
}
@@ -264,8 +267,9 @@ SBFrame::GetFunction () const
}
}
if (log)
- log->Printf ("SBFrame(%p)::GetFunction () => SBFunction(%p)",
- frame, sb_function.get());
+ log->Printf ("SBFrame(%p)::GetFunction () => SBFunction(%p)",
+ static_cast<void*>(frame),
+ static_cast<void*>(sb_function.get()));
return sb_function;
}
@@ -304,8 +308,9 @@ SBFrame::GetSymbol () const
}
}
if (log)
- log->Printf ("SBFrame(%p)::GetSymbol () => SBSymbol(%p)",
- frame, sb_symbol.get());
+ log->Printf ("SBFrame(%p)::GetSymbol () => SBSymbol(%p)",
+ static_cast<void*>(frame),
+ static_cast<void*>(sb_symbol.get()));
return sb_symbol;
}
@@ -339,12 +344,14 @@ SBFrame::GetBlock () const
else
{
if (log)
- log->Printf ("SBFrame(%p)::GetBlock () => error: process is running", frame);
+ log->Printf ("SBFrame(%p)::GetBlock () => error: process is running",
+ static_cast<void*>(frame));
}
}
if (log)
- log->Printf ("SBFrame(%p)::GetBlock () => SBBlock(%p)",
- frame, sb_block.GetPtr());
+ log->Printf ("SBFrame(%p)::GetBlock () => SBBlock(%p)",
+ static_cast<void*>(frame),
+ static_cast<void*>(sb_block.GetPtr()));
return sb_block;
}
@@ -382,8 +389,9 @@ SBFrame::GetFrameBlock () const
}
}
if (log)
- log->Printf ("SBFrame(%p)::GetFrameBlock () => SBBlock(%p)",
- frame, sb_block.GetPtr());
+ log->Printf ("SBFrame(%p)::GetFrameBlock () => SBBlock(%p)",
+ static_cast<void*>(frame),
+ static_cast<void*>(sb_block.GetPtr()));
return sb_block;
}
@@ -421,8 +429,9 @@ SBFrame::GetLineEntry () const
}
}
if (log)
- log->Printf ("SBFrame(%p)::GetLineEntry () => SBLineEntry(%p)",
- frame, sb_line_entry.get());
+ log->Printf ("SBFrame(%p)::GetLineEntry () => SBLineEntry(%p)",
+ static_cast<void*>(frame),
+ static_cast<void*>(sb_line_entry.get()));
return sb_line_entry;
}
@@ -430,16 +439,16 @@ uint32_t
SBFrame::GetFrameID () const
{
uint32_t frame_idx = UINT32_MAX;
-
+
ExecutionContext exe_ctx(m_opaque_sp.get());
StackFrame *frame = exe_ctx.GetFramePtr();
if (frame)
frame_idx = frame->GetFrameIndex ();
-
+
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBFrame(%p)::GetFrameID () => %u",
- frame, frame_idx);
+ log->Printf ("SBFrame(%p)::GetFrameID () => %u",
+ static_cast<void*>(frame), frame_idx);
return frame_idx;
}
@@ -478,7 +487,8 @@ SBFrame::GetPC () const
}
if (log)
- log->Printf ("SBFrame(%p)::GetPC () => 0x%" PRIx64, frame, addr);
+ log->Printf ("SBFrame(%p)::GetPC () => 0x%" PRIx64,
+ static_cast<void*>(frame), addr);
return addr;
}
@@ -519,7 +529,7 @@ SBFrame::SetPC (addr_t new_pc)
if (log)
log->Printf ("SBFrame(%p)::SetPC (new_pc=0x%" PRIx64 ") => %i",
- frame, new_pc, ret_val);
+ static_cast<void*>(frame), new_pc, ret_val);
return ret_val;
}
@@ -558,7 +568,8 @@ SBFrame::GetSP () const
}
}
if (log)
- log->Printf ("SBFrame(%p)::GetSP () => 0x%" PRIx64, frame, addr);
+ log->Printf ("SBFrame(%p)::GetSP () => 0x%" PRIx64,
+ static_cast<void*>(frame), addr);
return addr;
}
@@ -599,7 +610,8 @@ SBFrame::GetFP () const
}
if (log)
- log->Printf ("SBFrame(%p)::GetFP () => 0x%" PRIx64, frame, addr);
+ log->Printf ("SBFrame(%p)::GetFP () => 0x%" PRIx64,
+ static_cast<void*>(frame), addr);
return addr;
}
@@ -638,7 +650,9 @@ SBFrame::GetPCAddress () const
}
}
if (log)
- log->Printf ("SBFrame(%p)::GetPCAddress () => SBAddress(%p)", frame, sb_addr.get());
+ log->Printf ("SBFrame(%p)::GetPCAddress () => SBAddress(%p)",
+ static_cast<void*>(frame),
+ static_cast<void*>(sb_addr.get()));
return sb_addr;
}
@@ -727,7 +741,6 @@ SBFrame::FindVariable (const char *name)
}
return value;
}
-
SBValue
SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic)
@@ -742,7 +755,7 @@ SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic)
log->Printf ("SBFrame::FindVariable called with empty name");
return sb_value;
}
-
+
ValueObjectSP value_sp;
Mutex::Locker api_locker;
ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
@@ -766,7 +779,7 @@ SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic)
const bool can_create = true;
const bool get_parent_variables = true;
const bool stop_if_block_is_inlined_function = true;
-
+
if (sc.block->AppendVariables (can_create,
get_parent_variables,
stop_if_block_is_inlined_function,
@@ -794,10 +807,11 @@ SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic)
log->Printf ("SBFrame::FindVariable () => error: process is running");
}
}
-
+
if (log)
- log->Printf ("SBFrame(%p)::FindVariable (name=\"%s\") => SBValue(%p)",
- frame, name, value_sp.get());
+ log->Printf ("SBFrame(%p)::FindVariable (name=\"%s\") => SBValue(%p)",
+ static_cast<void*>(frame), name,
+ static_cast<void*>(value_sp.get()));
return sb_value;
}
@@ -822,14 +836,14 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBValue sb_value;
-
+
if (name == NULL || name[0] == '\0')
{
if (log)
log->Printf ("SBFrame::FindValue called with empty name.");
return sb_value;
}
-
+
ValueObjectSP value_sp;
Mutex::Locker api_locker;
ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
@@ -846,7 +860,7 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
if (frame)
{
VariableList variable_list;
-
+
switch (value_type)
{
case eValueTypeVariableGlobal: // global variable
@@ -854,7 +868,6 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
case eValueTypeVariableArgument: // function argument variables
case eValueTypeVariableLocal: // function local variables
{
-
SymbolContext sc (frame->GetSymbolContext (eSymbolContextBlock));
const bool can_create = true;
@@ -957,12 +970,12 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
log->Printf ("SBFrame::FindValue () => error: process is running");
}
}
-
+
if (log)
- log->Printf ("SBFrame(%p)::FindVariableInScope (name=\"%s\", value_type=%i) => SBValue(%p)",
- frame, name, value_type, value_sp.get());
+ log->Printf ("SBFrame(%p)::FindVariableInScope (name=\"%s\", value_type=%i) => SBValue(%p)",
+ static_cast<void*>(frame), name, value_type,
+ static_cast<void*>(value_sp.get()));
-
return sb_value;
}
@@ -999,10 +1012,9 @@ SBFrame::GetThread () const
{
SBStream sstr;
sb_thread.GetDescription (sstr);
- log->Printf ("SBFrame(%p)::GetThread () => SBThread(%p): %s",
- exe_ctx.GetFramePtr(),
- thread_sp.get(),
- sstr.GetData());
+ log->Printf ("SBFrame(%p)::GetThread () => SBThread(%p): %s",
+ static_cast<void*>(exe_ctx.GetFramePtr()),
+ static_cast<void*>(thread_sp.get()), sstr.GetData());
}
return sb_thread;
@@ -1039,11 +1051,12 @@ SBFrame::Disassemble () const
{
if (log)
log->Printf ("SBFrame::Disassemble () => error: process is running");
- }
+ }
}
if (log)
- log->Printf ("SBFrame(%p)::Disassemble () => %s", frame, disassembly);
+ log->Printf ("SBFrame(%p)::Disassemble () => %s",
+ static_cast<void*>(frame), disassembly);
return disassembly;
}
@@ -1084,12 +1097,9 @@ SBFrame::GetVariables (bool arguments,
Target *target = exe_ctx.GetTargetPtr();
if (log)
- log->Printf ("SBFrame::GetVariables (arguments=%i, locals=%i, statics=%i, in_scope_only=%i)",
- arguments,
- locals,
- statics,
- in_scope_only);
-
+ log->Printf ("SBFrame::GetVariables (arguments=%i, locals=%i, statics=%i, in_scope_only=%i)",
+ arguments, locals, statics, in_scope_only);
+
Process *process = exe_ctx.GetProcessPtr();
if (target && process)
{
@@ -1156,13 +1166,13 @@ SBFrame::GetVariables (bool arguments,
{
if (log)
log->Printf ("SBFrame::GetVariables () => error: process is running");
- }
+ }
}
if (log)
- {
- log->Printf ("SBFrame(%p)::GetVariables (...) => SBValueList(%p)", frame, value_list.opaque_ptr());
- }
+ log->Printf ("SBFrame(%p)::GetVariables (...) => SBValueList(%p)",
+ static_cast<void*>(frame),
+ static_cast<void*>(value_list.opaque_ptr()));
return value_list;
}
@@ -1207,11 +1217,13 @@ SBFrame::GetRegisters ()
{
if (log)
log->Printf ("SBFrame::GetRegisters () => error: process is running");
- }
+ }
}
if (log)
- log->Printf ("SBFrame(%p)::GetRegisters () => SBValueList(%p)", frame, value_list.opaque_ptr());
+ log->Printf ("SBFrame(%p)::GetRegisters () => SBValueList(%p)",
+ static_cast<void*>(frame),
+ static_cast<void*>(value_list.opaque_ptr()));
return value_list;
}
@@ -1265,11 +1277,13 @@ SBFrame::FindRegister (const char *name)
{
if (log)
log->Printf ("SBFrame::FindRegister () => error: process is running");
- }
+ }
}
if (log)
- log->Printf ("SBFrame(%p)::FindRegister () => SBValue(%p)", frame, value_sp.get());
+ log->Printf ("SBFrame(%p)::FindRegister () => SBValue(%p)",
+ static_cast<void*>(frame),
+ static_cast<void*>(value_sp.get()));
return result;
}
@@ -1355,19 +1369,19 @@ lldb::SBValue
SBFrame::EvaluateExpression (const char *expr, const SBExpressionOptions &options)
{
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
Log *expr_log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
- ExecutionResults exe_results = eExecutionSetupError;
+ ExpressionResults exe_results = eExpressionSetupError;
SBValue expr_result;
-
+
if (expr == NULL || expr[0] == '\0')
{
if (log)
log->Printf ("SBFrame::EvaluateExpression called with an empty expression");
return expr_result;
}
-
+
ValueObjectSP expr_value_sp;
Mutex::Locker api_locker;
@@ -1379,7 +1393,7 @@ SBFrame::EvaluateExpression (const char *expr, const SBExpressionOptions &option
StackFrame *frame = NULL;
Target *target = exe_ctx.GetTargetPtr();
Process *process = exe_ctx.GetProcessPtr();
-
+
if (target && process)
{
Process::StopLocker stop_locker;
@@ -1395,7 +1409,7 @@ SBFrame::EvaluateExpression (const char *expr, const SBExpressionOptions &option
Host::SetCrashDescriptionWithFormat ("SBFrame::EvaluateExpression (expr = \"%s\", fetch_dynamic_value = %u) %s",
expr, options.GetFetchDynamicValue(), frame_description.GetString().c_str());
}
-
+
exe_results = target->EvaluateExpression (expr,
frame,
expr_value_sp,
@@ -1415,21 +1429,18 @@ SBFrame::EvaluateExpression (const char *expr, const SBExpressionOptions &option
{
if (log)
log->Printf ("SBFrame::EvaluateExpression () => error: process is running");
- }
+ }
}
#ifndef LLDB_DISABLE_PYTHON
if (expr_log)
- expr_log->Printf("** [SBFrame::EvaluateExpression] Expression result is %s, summary %s **",
- expr_result.GetValue(),
- expr_result.GetSummary());
-
+ expr_log->Printf("** [SBFrame::EvaluateExpression] Expression result is %s, summary %s **",
+ expr_result.GetValue(), expr_result.GetSummary());
+
if (log)
- log->Printf ("SBFrame(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p) (execution result=%d)",
- frame,
- expr,
- expr_value_sp.get(),
- exe_results);
+ log->Printf ("SBFrame(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p) (execution result=%d)",
+ static_cast<void*>(frame), expr,
+ static_cast<void*>(expr_value_sp.get()), exe_results);
#endif
return expr_result;
diff --git a/source/API/SBFunction.cpp b/source/API/SBFunction.cpp
index bb7ea2e9f202..3d185da17f26 100644
--- a/source/API/SBFunction.cpp
+++ b/source/API/SBFunction.cpp
@@ -66,9 +66,11 @@ SBFunction::GetName() const
if (log)
{
if (cstr)
- log->Printf ("SBFunction(%p)::GetName () => \"%s\"", m_opaque_ptr, cstr);
+ log->Printf ("SBFunction(%p)::GetName () => \"%s\"",
+ static_cast<void*>(m_opaque_ptr), cstr);
else
- log->Printf ("SBFunction(%p)::GetName () => NULL", m_opaque_ptr);
+ log->Printf ("SBFunction(%p)::GetName () => NULL",
+ static_cast<void*>(m_opaque_ptr));
}
return cstr;
}
@@ -83,9 +85,11 @@ SBFunction::GetMangledName () const
if (log)
{
if (cstr)
- log->Printf ("SBFunction(%p)::GetMangledName () => \"%s\"", m_opaque_ptr, cstr);
+ log->Printf ("SBFunction(%p)::GetMangledName () => \"%s\"",
+ static_cast<void*>(m_opaque_ptr), cstr);
else
- log->Printf ("SBFunction(%p)::GetMangledName () => NULL", m_opaque_ptr);
+ log->Printf ("SBFunction(%p)::GetMangledName () => NULL",
+ static_cast<void*>(m_opaque_ptr));
}
return cstr;
}
diff --git a/source/API/SBHostOS.cpp b/source/API/SBHostOS.cpp
index 166403103ad5..ec1e2f2e9cba 100644
--- a/source/API/SBHostOS.cpp
+++ b/source/API/SBHostOS.cpp
@@ -12,6 +12,7 @@
#include "lldb/Host/FileSpec.h"
#include "lldb/Core/Log.h"
#include "lldb/Host/Host.h"
+#include "lldb/Host/HostInfo.h"
using namespace lldb;
using namespace lldb_private;
@@ -22,7 +23,7 @@ SBFileSpec
SBHostOS::GetProgramFileSpec ()
{
SBFileSpec sb_filespec;
- sb_filespec.SetFileSpec (Host::GetProgramFileSpec ());
+ sb_filespec.SetFileSpec(HostInfo::GetProgramFileSpec());
return sb_filespec;
}
@@ -31,18 +32,29 @@ SBHostOS::GetLLDBPythonPath ()
{
SBFileSpec sb_lldb_python_filespec;
FileSpec lldb_python_spec;
- if (Host::GetLLDBPath (ePathTypePythonDir, lldb_python_spec))
+ if (HostInfo::GetLLDBPath(ePathTypePythonDir, lldb_python_spec))
{
sb_lldb_python_filespec.SetFileSpec (lldb_python_spec);
}
return sb_lldb_python_filespec;
}
+
+SBFileSpec
+SBHostOS::GetLLDBPath (lldb::PathType path_type)
+{
+ SBFileSpec sb_fspec;
+ FileSpec fspec;
+ if (HostInfo::GetLLDBPath(path_type, fspec))
+ sb_fspec.SetFileSpec (fspec);
+ return sb_fspec;
+}
+
lldb::thread_t
SBHostOS::ThreadCreate
(
const char *name,
- thread_func_t thread_function,
+ lldb::thread_func_t thread_function,
void *thread_arg,
SBError *error_ptr
)
@@ -50,8 +62,10 @@ SBHostOS::ThreadCreate
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBHostOS::ThreadCreate (name=\"%s\", thread_function=%p, thread_arg=%p, error_ptr=%p)", name,
- thread_function, thread_arg, error_ptr);
+ log->Printf ("SBHostOS::ThreadCreate (name=\"%s\", thread_function=%p, thread_arg=%p, error_ptr=%p)",
+ name, reinterpret_cast<void*>(reinterpret_cast<intptr_t>(thread_function)),
+ static_cast<void*>(thread_arg),
+ static_cast<void*>(error_ptr));
// FIXME: You should log the return value?
@@ -77,7 +91,7 @@ SBHostOS::ThreadDetach (lldb::thread_t thread, SBError *error_ptr)
}
bool
-SBHostOS::ThreadJoin (lldb::thread_t thread, thread_result_t *result, SBError *error_ptr)
+SBHostOS::ThreadJoin (lldb::thread_t thread, lldb::thread_result_t *result, SBError *error_ptr)
{
return Host::ThreadJoin (thread, result, error_ptr ? error_ptr->get() : NULL);
}
diff --git a/source/API/SBLineEntry.cpp b/source/API/SBLineEntry.cpp
index 0864a2e006c3..833eea3e35c4 100644
--- a/source/API/SBLineEntry.cpp
+++ b/source/API/SBLineEntry.cpp
@@ -66,7 +66,6 @@ SBLineEntry::~SBLineEntry ()
SBAddress
SBLineEntry::GetStartAddress () const
{
-
SBAddress sb_address;
if (m_opaque_ap.get())
sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress());
@@ -78,8 +77,9 @@ SBLineEntry::GetStartAddress () const
const Address *addr = sb_address.get();
if (addr)
addr->Dump (&sstr, NULL, Address::DumpStyleModuleWithFileAddress, Address::DumpStyleInvalid, 4);
- log->Printf ("SBLineEntry(%p)::GetStartAddress () => SBAddress (%p): %s",
- m_opaque_ap.get(), sb_address.get(), sstr.GetData());
+ log->Printf ("SBLineEntry(%p)::GetStartAddress () => SBAddress (%p): %s",
+ static_cast<void*>(m_opaque_ap.get()),
+ static_cast<void*>(sb_address.get()), sstr.GetData());
}
return sb_address;
@@ -101,8 +101,9 @@ SBLineEntry::GetEndAddress () const
const Address *addr = sb_address.get();
if (addr)
addr->Dump (&sstr, NULL, Address::DumpStyleModuleWithFileAddress, Address::DumpStyleInvalid, 4);
- log->Printf ("SBLineEntry(%p)::GetEndAddress () => SBAddress (%p): %s",
- m_opaque_ap.get(), sb_address.get(), sstr.GetData());
+ log->Printf ("SBLineEntry(%p)::GetEndAddress () => SBAddress (%p): %s",
+ static_cast<void*>(m_opaque_ap.get()),
+ static_cast<void*>(sb_address.get()), sstr.GetData());
}
return sb_address;
}
@@ -127,8 +128,10 @@ SBLineEntry::GetFileSpec () const
{
SBStream sstr;
sb_file_spec.GetDescription (sstr);
- log->Printf ("SBLineEntry(%p)::GetFileSpec () => SBFileSpec(%p): %s", m_opaque_ap.get(),
- sb_file_spec.get(), sstr.GetData());
+ log->Printf ("SBLineEntry(%p)::GetFileSpec () => SBFileSpec(%p): %s",
+ static_cast<void*>(m_opaque_ap.get()),
+ static_cast<const void*>(sb_file_spec.get()),
+ sstr.GetData());
}
return sb_file_spec;
@@ -144,7 +147,8 @@ SBLineEntry::GetLine () const
line = m_opaque_ap->line;
if (log)
- log->Printf ("SBLineEntry(%p)::GetLine () => %u", m_opaque_ap.get(), line);
+ log->Printf ("SBLineEntry(%p)::GetLine () => %u",
+ static_cast<void*>(m_opaque_ap.get()), line);
return line;
}
diff --git a/source/API/SBListener.cpp b/source/API/SBListener.cpp
index 2e67b4c24e86..bad9ba82bc91 100644
--- a/source/API/SBListener.cpp
+++ b/source/API/SBListener.cpp
@@ -42,7 +42,7 @@ SBListener::SBListener (const char *name) :
if (log)
log->Printf ("SBListener::SBListener (name=\"%s\") => SBListener(%p)",
- name, m_opaque_ptr);
+ name, static_cast<void*>(m_opaque_ptr));
}
@@ -110,7 +110,7 @@ SBListener::StartListeningForEventClass (SBDebugger &debugger,
else
return 0;
}
-
+
bool
SBListener::StopListeningForEventClass (SBDebugger &debugger,
const char *broadcaster_class,
@@ -127,7 +127,7 @@ SBListener::StopListeningForEventClass (SBDebugger &debugger,
else
return false;
}
-
+
uint32_t
SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t event_mask)
{
@@ -136,23 +136,23 @@ SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t
{
acquired_event_mask = m_opaque_ptr->StartListeningForEvents (broadcaster.get(), event_mask);
}
-
+
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
StreamString sstr_requested;
StreamString sstr_acquired;
-
+
Broadcaster *lldb_broadcaster = broadcaster.get();
if (lldb_broadcaster)
{
const bool got_requested_names = lldb_broadcaster->GetEventNames (sstr_requested, event_mask, false);
const bool got_acquired_names = lldb_broadcaster->GetEventNames (sstr_acquired, acquired_event_mask, false);
log->Printf ("SBListener(%p)::StartListeneingForEvents (SBBroadcaster(%p): %s, event_mask=0x%8.8x%s%s%s) => 0x%8.8x%s%s%s",
- m_opaque_ptr,
- lldb_broadcaster,
- lldb_broadcaster->GetBroadcasterName().GetCString(),
- event_mask,
+ static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(lldb_broadcaster),
+ lldb_broadcaster->GetBroadcasterName().GetCString(),
+ event_mask,
got_requested_names ? " (" : "",
sstr_requested.GetData(),
got_requested_names ? ")" : "",
@@ -163,12 +163,10 @@ SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t
}
else
{
- log->Printf ("SBListener(%p)::StartListeneingForEvents (SBBroadcaster(%p), event_mask=0x%8.8x) => 0x%8.8x",
- m_opaque_ptr,
- lldb_broadcaster,
- event_mask,
+ log->Printf ("SBListener(%p)::StartListeneingForEvents (SBBroadcaster(%p), event_mask=0x%8.8x) => 0x%8.8x",
+ static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(lldb_broadcaster), event_mask,
acquired_event_mask);
-
}
}
@@ -194,12 +192,14 @@ SBListener::WaitForEvent (uint32_t timeout_secs, SBEvent &event)
if (timeout_secs == UINT32_MAX)
{
log->Printf ("SBListener(%p)::WaitForEvent (timeout_secs=INFINITE, SBEvent(%p))...",
- m_opaque_ptr, event.get());
+ static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(event.get()));
}
else
{
log->Printf ("SBListener(%p)::WaitForEvent (timeout_secs=%d, SBEvent(%p))...",
- m_opaque_ptr, timeout_secs, event.get());
+ static_cast<void*>(m_opaque_ptr), timeout_secs,
+ static_cast<void*>(event.get()));
}
}
bool success = false;
@@ -226,12 +226,14 @@ SBListener::WaitForEvent (uint32_t timeout_secs, SBEvent &event)
if (timeout_secs == UINT32_MAX)
{
log->Printf ("SBListener(%p)::WaitForEvent (timeout_secs=INFINITE, SBEvent(%p)) => %i",
- m_opaque_ptr, event.get(), success);
+ static_cast<void*>(m_opaque_ptr),
+ static_cast<void*>(event.get()), success);
}
else
{
log->Printf ("SBListener(%p)::WaitForEvent (timeout_secs=%d, SBEvent(%p)) => %i",
- m_opaque_ptr, timeout_secs, event.get(), success);
+ static_cast<void*>(m_opaque_ptr), timeout_secs,
+ static_cast<void*>(event.get()), success);
}
}
if (!success)
diff --git a/source/API/SBModule.cpp b/source/API/SBModule.cpp
index c8543d4de298..0d7dda1aa1f7 100644
--- a/source/API/SBModule.cpp
+++ b/source/API/SBModule.cpp
@@ -110,10 +110,9 @@ SBModule::GetFileSpec () const
file_spec.SetFileSpec(module_sp->GetFileSpec());
if (log)
- {
- log->Printf ("SBModule(%p)::GetFileSpec () => SBFileSpec(%p)",
- module_sp.get(), file_spec.get());
- }
+ log->Printf ("SBModule(%p)::GetFileSpec () => SBFileSpec(%p)",
+ static_cast<void*>(module_sp.get()),
+ static_cast<const void*>(file_spec.get()));
return file_spec;
}
@@ -122,20 +121,18 @@ lldb::SBFileSpec
SBModule::GetPlatformFileSpec () const
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
SBFileSpec file_spec;
ModuleSP module_sp (GetSP ());
if (module_sp)
file_spec.SetFileSpec(module_sp->GetPlatformFileSpec());
-
+
if (log)
- {
- log->Printf ("SBModule(%p)::GetPlatformFileSpec () => SBFileSpec(%p)",
- module_sp.get(), file_spec.get());
- }
-
+ log->Printf ("SBModule(%p)::GetPlatformFileSpec () => SBFileSpec(%p)",
+ static_cast<void*>(module_sp.get()),
+ static_cast<const void*>(file_spec.get()));
+
return file_spec;
-
}
bool
@@ -143,22 +140,19 @@ SBModule::SetPlatformFileSpec (const lldb::SBFileSpec &platform_file)
{
bool result = false;
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
ModuleSP module_sp (GetSP ());
if (module_sp)
{
module_sp->SetPlatformFileSpec(*platform_file);
result = true;
}
-
+
if (log)
- {
- log->Printf ("SBModule(%p)::SetPlatformFileSpec (SBFileSpec(%p (%s)) => %i",
- module_sp.get(),
- platform_file.get(),
- platform_file->GetPath().c_str(),
- result);
- }
+ log->Printf ("SBModule(%p)::SetPlatformFileSpec (SBFileSpec(%p (%s)) => %i",
+ static_cast<void*>(module_sp.get()),
+ static_cast<const void*>(platform_file.get()),
+ platform_file->GetPath().c_str(), result);
return result;
}
@@ -201,10 +195,12 @@ SBModule::GetUUIDBytes () const
{
StreamString s;
module_sp->GetUUID().Dump (&s);
- log->Printf ("SBModule(%p)::GetUUIDBytes () => %s", module_sp.get(), s.GetData());
+ log->Printf ("SBModule(%p)::GetUUIDBytes () => %s",
+ static_cast<void*>(module_sp.get()), s.GetData());
}
else
- log->Printf ("SBModule(%p)::GetUUIDBytes () => NULL", module_sp.get());
+ log->Printf ("SBModule(%p)::GetUUIDBytes () => NULL",
+ static_cast<void*>(module_sp.get()));
}
return uuid_bytes;
}
@@ -225,6 +221,7 @@ SBModule::GetUUIDString () const
if (!uuid_string.empty())
{
strncpy (uuid_string_buffer, uuid_string.c_str(), sizeof (uuid_string_buffer));
+ uuid_string_buffer[sizeof (uuid_string_buffer) - 1] = '\0';
uuid_c_string = uuid_string_buffer;
}
@@ -234,10 +231,12 @@ SBModule::GetUUIDString () const
{
StreamString s;
module_sp->GetUUID().Dump (&s);
- log->Printf ("SBModule(%p)::GetUUIDString () => %s", module_sp.get(), s.GetData());
+ log->Printf ("SBModule(%p)::GetUUIDString () => %s",
+ static_cast<void*>(module_sp.get()), s.GetData());
}
else
- log->Printf ("SBModule(%p)::GetUUIDString () => NULL", module_sp.get());
+ log->Printf ("SBModule(%p)::GetUUIDString () => NULL",
+ static_cast<void*>(module_sp.get()));
}
return uuid_c_string;
}
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;
diff --git a/source/API/SBQueue.cpp b/source/API/SBQueue.cpp
index 8d67a48d6b81..b19ed72543c2 100644
--- a/source/API/SBQueue.cpp
+++ b/source/API/SBQueue.cpp
@@ -9,10 +9,14 @@
#include "lldb/lldb-python.h"
+#include <inttypes.h>
+
#include "lldb/API/SBQueue.h"
#include "lldb/API/SBProcess.h"
#include "lldb/API/SBThread.h"
+#include "lldb/API/SBQueueItem.h"
+
#include "lldb/Core/Log.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Queue.h"
@@ -96,7 +100,8 @@ namespace lldb_private
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBQueue(%p)::GetQueueID () => 0x%" PRIx64, this, result);
+ log->Printf ("SBQueue(%p)::GetQueueID () => 0x%" PRIx64,
+ static_cast<const void*>(this), result);
return result;
}
@@ -111,10 +116,11 @@ namespace lldb_private
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBQueueImpl(%p)::GetIndexID () => %d", this, result);
+ log->Printf ("SBQueueImpl(%p)::GetIndexID () => %d",
+ static_cast<const void*>(this), result);
return result;
}
-
+
const char *
GetName () const
{
@@ -124,14 +130,16 @@ namespace lldb_private
{
name = queue_sp->GetName();
}
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBQueueImpl(%p)::GetName () => %s", this, name ? name : "NULL");
-
+ log->Printf ("SBQueueImpl(%p)::GetName () => %s",
+ static_cast<const void*>(this),
+ name ? name : "NULL");
+
return name;
}
-
+
void
FetchThreads ()
{
@@ -158,7 +166,7 @@ namespace lldb_private
}
}
}
-
+
void
FetchItems ()
{
@@ -185,12 +193,12 @@ namespace lldb_private
}
}
}
-
+
uint32_t
GetNumThreads ()
{
uint32_t result = 0;
-
+
FetchThreads();
if (m_thread_list_fetched)
{
@@ -198,12 +206,12 @@ namespace lldb_private
}
return result;
}
-
+
lldb::SBThread
GetThreadAtIndex (uint32_t idx)
{
FetchThreads();
-
+
SBThread sb_thread;
QueueSP queue_sp = m_queue_wp.lock();
if (queue_sp && idx < m_threads.size())
@@ -220,21 +228,24 @@ namespace lldb_private
}
return sb_thread;
}
-
-
+
uint32_t
GetNumPendingItems ()
{
uint32_t result = 0;
- FetchItems();
-
- if (m_pending_items_fetched)
+
+ QueueSP queue_sp = m_queue_wp.lock();
+ if (m_pending_items_fetched == false && queue_sp)
+ {
+ result = queue_sp->GetNumPendingWorkItems();
+ }
+ else
{
result = m_pending_items.size();
}
return result;
}
-
+
lldb::SBQueueItem
GetPendingItemAtIndex (uint32_t idx)
{
@@ -246,7 +257,17 @@ namespace lldb_private
}
return result;
}
-
+
+ uint32_t
+ GetNumRunningItems ()
+ {
+ uint32_t result = 0;
+ QueueSP queue_sp = m_queue_wp.lock();
+ if (queue_sp)
+ result = queue_sp->GetNumRunningWorkItems();
+ return result;
+ }
+
lldb::SBProcess
GetProcess ()
{
@@ -259,6 +280,17 @@ namespace lldb_private
return result;
}
+ lldb::QueueKind
+ GetKind ()
+ {
+ lldb::QueueKind kind = eQueueKindUnknown;
+ QueueSP queue_sp = m_queue_wp.lock();
+ if (queue_sp)
+ kind = queue_sp->GetKind();
+
+ return kind;
+ }
+
private:
lldb::QueueWP m_queue_wp;
std::vector<lldb::ThreadWP> m_threads; // threads currently executing this queue's items
@@ -301,13 +333,21 @@ SBQueue::~SBQueue()
bool
SBQueue::IsValid() const
{
- return m_opaque_sp->IsValid();
+ bool is_valid = m_opaque_sp->IsValid ();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::IsValid() == %s", m_opaque_sp->GetQueueID(),
+ is_valid ? "true" : "false");
+ return is_valid;
}
void
SBQueue::Clear ()
{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::Clear()", m_opaque_sp->GetQueueID());
m_opaque_sp->Clear();
}
@@ -321,48 +361,92 @@ SBQueue::SetQueue (const QueueSP& queue_sp)
lldb::queue_id_t
SBQueue::GetQueueID () const
{
- return m_opaque_sp->GetQueueID ();
+ lldb::queue_id_t qid = m_opaque_sp->GetQueueID ();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetQueueID() == 0x%" PRIx64, m_opaque_sp->GetQueueID(), (uint64_t) qid);
+ return qid;
}
uint32_t
SBQueue::GetIndexID () const
{
- return m_opaque_sp->GetIndexID ();
+ uint32_t index_id = m_opaque_sp->GetIndexID ();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetIndexID() == 0x%" PRIx32, m_opaque_sp->GetQueueID(), index_id);
+ return index_id;
}
const char *
SBQueue::GetName () const
{
- return m_opaque_sp->GetName ();
+ const char *name = m_opaque_sp->GetName ();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetName() == %s", m_opaque_sp->GetQueueID(),
+ name ? name : "");
+ return name;
}
uint32_t
SBQueue::GetNumThreads ()
{
- return m_opaque_sp->GetNumThreads ();
+ uint32_t numthreads = m_opaque_sp->GetNumThreads ();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetNumThreads() == %d", m_opaque_sp->GetQueueID(), numthreads);
+ return numthreads;
}
SBThread
SBQueue::GetThreadAtIndex (uint32_t idx)
{
- return m_opaque_sp->GetThreadAtIndex (idx);
+ SBThread th = m_opaque_sp->GetThreadAtIndex (idx);
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetThreadAtIndex(%d)", m_opaque_sp->GetQueueID(), idx);
+ return th;
}
uint32_t
SBQueue::GetNumPendingItems ()
{
- return m_opaque_sp->GetNumPendingItems ();
+ uint32_t pending_items = m_opaque_sp->GetNumPendingItems ();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetNumPendingItems() == %d", m_opaque_sp->GetQueueID(), pending_items);
+ return pending_items;
}
SBQueueItem
SBQueue::GetPendingItemAtIndex (uint32_t idx)
{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetPendingItemAtIndex(%d)", m_opaque_sp->GetQueueID(), idx);
return m_opaque_sp->GetPendingItemAtIndex (idx);
}
+uint32_t
+SBQueue::GetNumRunningItems ()
+{
+ uint32_t running_items = m_opaque_sp->GetNumRunningItems ();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetNumRunningItems() == %d", m_opaque_sp->GetQueueID(), running_items);
+ return running_items;
+}
+
SBProcess
SBQueue::GetProcess ()
{
return m_opaque_sp->GetProcess();
}
+
+lldb::QueueKind
+SBQueue::GetKind ()
+{
+ return m_opaque_sp->GetKind();
+}
diff --git a/source/API/SBQueueItem.cpp b/source/API/SBQueueItem.cpp
index 481d51e55426..6a1aa7bec61a 100644
--- a/source/API/SBQueueItem.cpp
+++ b/source/API/SBQueueItem.cpp
@@ -14,6 +14,8 @@
#include "lldb/API/SBQueueItem.h"
#include "lldb/API/SBThread.h"
#include "lldb/Core/Address.h"
+#include "lldb/Core/Log.h"
+#include "lldb/Target/Process.h"
#include "lldb/Target/QueueItem.h"
#include "lldb/Target/Thread.h"
@@ -44,13 +46,23 @@ SBQueueItem::~SBQueueItem()
bool
SBQueueItem::IsValid() const
{
- return m_queue_item_sp.get() != NULL;
+ bool is_valid = m_queue_item_sp.get() != NULL;
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueueItem(%p)::IsValid() == %s",
+ static_cast<void*>(m_queue_item_sp.get()),
+ is_valid ? "true" : "false");
+ return is_valid;
}
void
SBQueueItem::Clear ()
{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueueItem(%p)::Clear()",
+ static_cast<void*>(m_queue_item_sp.get()));
m_queue_item_sp.reset();
}
@@ -66,10 +78,15 @@ lldb::QueueItemKind
SBQueueItem::GetKind () const
{
QueueItemKind result = eQueueItemKindUnknown;
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (m_queue_item_sp)
{
result = m_queue_item_sp->GetKind ();
}
+ if (log)
+ log->Printf("SBQueueItem(%p)::GetKind() == %d",
+ static_cast<void*>(m_queue_item_sp.get()),
+ static_cast<int>(result));
return result;
}
@@ -86,10 +103,21 @@ SBAddress
SBQueueItem::GetAddress () const
{
SBAddress result;
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (m_queue_item_sp)
{
result.SetAddress (&m_queue_item_sp->GetAddress());
}
+ if (log)
+ {
+ StreamString sstr;
+ const Address *addr = result.get();
+ if (addr)
+ addr->Dump (&sstr, NULL, Address::DumpStyleModuleWithFileAddress, Address::DumpStyleInvalid, 4);
+ log->Printf ("SBQueueItem(%p)::GetAddress() == SBAddress(%p): %s",
+ static_cast<void*>(m_queue_item_sp.get()),
+ static_cast<void*>(result.get()), sstr.GetData());
+ }
return result;
}
@@ -106,14 +134,34 @@ SBThread
SBQueueItem::GetExtendedBacktraceThread (const char *type)
{
SBThread result;
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (m_queue_item_sp)
{
- ThreadSP thread_sp;
- ConstString type_const (type);
- thread_sp = m_queue_item_sp->GetExtendedBacktraceThread (type_const);
- if (thread_sp)
+ ProcessSP process_sp = m_queue_item_sp->GetProcessSP();
+ Process::StopLocker stop_locker;
+ if (process_sp && stop_locker.TryLock(&process_sp->GetRunLock()))
{
- result.SetThread (thread_sp);
+ ThreadSP thread_sp;
+ ConstString type_const (type);
+ thread_sp = m_queue_item_sp->GetExtendedBacktraceThread (type_const);
+ if (thread_sp)
+ {
+ // Save this in the Process' ExtendedThreadList so a strong pointer retains the
+ // object
+ process_sp->GetExtendedThreadList().AddThread (thread_sp);
+ result.SetThread (thread_sp);
+ if (log)
+ {
+ const char *queue_name = thread_sp->GetQueueName();
+ if (queue_name == NULL)
+ queue_name = "";
+ log->Printf ("SBQueueItem(%p)::GetExtendedBacktraceThread() = new extended Thread created (%p) with queue_id 0x%" PRIx64 " queue name '%s'",
+ static_cast<void*>(m_queue_item_sp.get()),
+ static_cast<void*>(thread_sp.get()),
+ static_cast<uint64_t>(thread_sp->GetQueueID()),
+ queue_name);
+ }
+ }
}
}
return result;
diff --git a/source/API/SBStream.cpp b/source/API/SBStream.cpp
index 531ab9f463ce..f5b5c08411c7 100644
--- a/source/API/SBStream.cpp
+++ b/source/API/SBStream.cpp
@@ -82,6 +82,8 @@ SBStream::RedirectToFile (const char *path, bool append)
uint32_t open_options = File::eOpenOptionWrite | File::eOpenOptionCanCreate;
if (append)
open_options |= File::eOpenOptionAppend;
+ else
+ open_options |= File::eOpenOptionTruncate;
stream_file->GetFile().Open (path, open_options, lldb::eFilePermissionsFileDefault);
m_opaque_ap.reset (stream_file);
diff --git a/source/API/SBSymbol.cpp b/source/API/SBSymbol.cpp
index ef3d0764c963..12a3b317d501 100644
--- a/source/API/SBSymbol.cpp
+++ b/source/API/SBSymbol.cpp
@@ -67,7 +67,8 @@ SBSymbol::GetName() const
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBSymbol(%p)::GetName () => \"%s\"", m_opaque_ptr, name ? name : "");
+ log->Printf ("SBSymbol(%p)::GetName () => \"%s\"",
+ static_cast<void*>(m_opaque_ptr), name ? name : "");
return name;
}
@@ -79,7 +80,8 @@ SBSymbol::GetMangledName () const
name = m_opaque_ptr->GetMangled().GetMangledName().AsCString();
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBSymbol(%p)::GetMangledName () => \"%s\"", m_opaque_ptr, name ? name : "");
+ log->Printf ("SBSymbol(%p)::GetMangledName () => \"%s\"",
+ static_cast<void*>(m_opaque_ptr), name ? name : "");
return name;
}
diff --git a/source/API/SBSymbolContext.cpp b/source/API/SBSymbolContext.cpp
index 479b0f75bfe9..481fa1a1d1a2 100644
--- a/source/API/SBSymbolContext.cpp
+++ b/source/API/SBSymbolContext.cpp
@@ -101,8 +101,9 @@ SBSymbolContext::GetModule ()
{
SBStream sstr;
sb_module.GetDescription (sstr);
- log->Printf ("SBSymbolContext(%p)::GetModule () => SBModule(%p): %s",
- m_opaque_ap.get(), module_sp.get(), sstr.GetData());
+ log->Printf ("SBSymbolContext(%p)::GetModule () => SBModule(%p): %s",
+ static_cast<void*>(m_opaque_ap.get()),
+ static_cast<void*>(module_sp.get()), sstr.GetData());
}
return sb_module;
@@ -120,15 +121,16 @@ SBSymbolContext::GetFunction ()
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Function *function = NULL;
-
+
if (m_opaque_ap.get())
function = m_opaque_ap->function;
SBFunction sb_function (function);
if (log)
- log->Printf ("SBSymbolContext(%p)::GetFunction () => SBFunction(%p)",
- m_opaque_ap.get(), function);
+ log->Printf ("SBSymbolContext(%p)::GetFunction () => SBFunction(%p)",
+ static_cast<void*>(m_opaque_ap.get()),
+ static_cast<void*>(function));
return sb_function;
}
@@ -150,8 +152,9 @@ SBSymbolContext::GetLineEntry ()
if (log)
{
- log->Printf ("SBSymbolContext(%p)::GetLineEntry () => SBLineEntry(%p)",
- m_opaque_ap.get(), sb_line_entry.get());
+ log->Printf ("SBSymbolContext(%p)::GetLineEntry () => SBLineEntry(%p)",
+ static_cast<void*>(m_opaque_ap.get()),
+ static_cast<void*>(sb_line_entry.get()));
}
return sb_line_entry;
@@ -163,19 +166,18 @@ SBSymbolContext::GetSymbol ()
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Symbol *symbol = NULL;
-
+
if (m_opaque_ap.get())
symbol = m_opaque_ap->symbol;
SBSymbol sb_symbol (symbol);
if (log)
- {
- log->Printf ("SBSymbolContext(%p)::GetSymbol () => SBSymbol(%p)",
- m_opaque_ap.get(), symbol);
- }
+ log->Printf ("SBSymbolContext(%p)::GetSymbol () => SBSymbol(%p)",
+ static_cast<void*>(m_opaque_ap.get()),
+ static_cast<void*>(symbol));
- return sb_symbol;
+ return sb_symbol;
}
void
diff --git a/source/API/SBTarget.cpp b/source/API/SBTarget.cpp
index 224349c0bce6..3d5828c5fe00 100644
--- a/source/API/SBTarget.cpp
+++ b/source/API/SBTarget.cpp
@@ -120,6 +120,18 @@ SBLaunchInfo::SetGroupID (uint32_t gid)
m_opaque_sp->SetGroupID (gid);
}
+SBFileSpec
+SBLaunchInfo::GetExecutableFile ()
+{
+ return SBFileSpec (m_opaque_sp->GetExecutableFile());
+}
+
+void
+SBLaunchInfo::SetExecutableFile (SBFileSpec exe_file, bool add_as_first_arg)
+{
+ m_opaque_sp->SetExecutableFile(exe_file.ref(), add_as_first_arg);
+}
+
uint32_t
SBLaunchInfo::GetNumArguments ()
{
@@ -268,6 +280,29 @@ SBLaunchInfo::AddSuppressFileAction (int fd, bool read, bool write)
return m_opaque_sp->AppendSuppressFileAction(fd, read, write);
}
+void
+SBLaunchInfo::SetLaunchEventData (const char *data)
+{
+ m_opaque_sp->SetLaunchEventData (data);
+}
+
+const char *
+SBLaunchInfo::GetLaunchEventData () const
+{
+ return m_opaque_sp->GetLaunchEventData ();
+}
+
+void
+SBLaunchInfo::SetDetachOnError (bool enable)
+{
+ m_opaque_sp->SetDetachOnError (enable);
+}
+
+bool
+SBLaunchInfo::GetDetachOnError () const
+{
+ return m_opaque_sp->GetDetachOnError ();
+}
SBAttachInfo::SBAttachInfo () :
m_opaque_sp (new ProcessAttachInfo())
@@ -541,10 +576,9 @@ SBTarget::GetProcess ()
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- {
- log->Printf ("SBTarget(%p)::GetProcess () => SBProcess(%p)",
- target_sp.get(), process_sp.get());
- }
+ log->Printf ("SBTarget(%p)::GetProcess () => SBProcess(%p)",
+ static_cast<void*>(target_sp.get()),
+ static_cast<void*>(process_sp.get()));
return sb_process;
}
@@ -641,19 +675,15 @@ SBTarget::Launch
TargetSP target_sp(GetSP());
if (log)
- {
log->Printf ("SBTarget(%p)::Launch (argv=%p, envp=%p, stdin=%s, stdout=%s, stderr=%s, working-dir=%s, launch_flags=0x%x, stop_at_entry=%i, &error (%p))...",
- target_sp.get(),
- argv,
- envp,
- stdin_path ? stdin_path : "NULL",
- stdout_path ? stdout_path : "NULL",
- stderr_path ? stderr_path : "NULL",
+ static_cast<void*>(target_sp.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()));
if (target_sp)
{
@@ -667,17 +697,17 @@ SBTarget::Launch
if (process_sp)
{
state = process_sp->GetState();
-
+
if (process_sp->IsAlive() && state != eStateConnected)
- {
+ {
if (state == eStateAttaching)
error.SetErrorString ("process attach is in progress");
else
error.SetErrorString ("a process is already being debugged");
return sb_process;
- }
+ }
}
-
+
if (state == eStateConnected)
{
// If we are already connected, then we have already specified the
@@ -694,7 +724,7 @@ SBTarget::Launch
launch_flags |= eLaunchFlagDisableSTDIO;
ProcessLaunchInfo launch_info (stdin_path, stdout_path, stderr_path, working_directory, launch_flags);
-
+
Module *exe_module = target_sp->GetExecutableModulePointer();
if (exe_module)
launch_info.SetExecutableFile(exe_module->GetPlatformFileSpec(), true);
@@ -717,10 +747,9 @@ SBTarget::Launch
log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
- {
- log->Printf ("SBTarget(%p)::Launch (...) => SBProcess(%p)",
- target_sp.get(), sb_process.GetSP().get());
- }
+ log->Printf ("SBTarget(%p)::Launch (...) => SBProcess(%p)",
+ static_cast<void*>(target_sp.get()),
+ static_cast<void*>(sb_process.GetSP().get()));
return sb_process;
}
@@ -729,46 +758,48 @@ SBProcess
SBTarget::Launch (SBLaunchInfo &sb_launch_info, SBError& error)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
SBProcess sb_process;
TargetSP target_sp(GetSP());
-
+
if (log)
- {
- log->Printf ("SBTarget(%p)::Launch (launch_info, error)...", target_sp.get());
- }
-
+ log->Printf ("SBTarget(%p)::Launch (launch_info, error)...",
+ static_cast<void*>(target_sp.get()));
+
if (target_sp)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
StateType state = eStateInvalid;
{
- ProcessSP process_sp = target_sp->GetProcessSP();
- if (process_sp)
- {
- state = process_sp->GetState();
-
- if (process_sp->IsAlive() && state != eStateConnected)
- {
- if (state == eStateAttaching)
- error.SetErrorString ("process attach is in progress");
- else
- error.SetErrorString ("a process is already being debugged");
- return sb_process;
- }
- }
+ ProcessSP process_sp = target_sp->GetProcessSP();
+ if (process_sp)
+ {
+ state = process_sp->GetState();
+
+ if (process_sp->IsAlive() && state != eStateConnected)
+ {
+ if (state == eStateAttaching)
+ error.SetErrorString ("process attach is in progress");
+ else
+ error.SetErrorString ("a process is already being debugged");
+ return sb_process;
+ }
+ }
}
lldb_private::ProcessLaunchInfo &launch_info = sb_launch_info.ref();
- Module *exe_module = target_sp->GetExecutableModulePointer();
- if (exe_module)
- launch_info.SetExecutableFile(exe_module->GetPlatformFileSpec(), true);
+ if (!launch_info.GetExecutableFile())
+ {
+ Module *exe_module = target_sp->GetExecutableModulePointer();
+ if (exe_module)
+ launch_info.SetExecutableFile(exe_module->GetPlatformFileSpec(), true);
+ }
const ArchSpec &arch_spec = target_sp->GetArchitecture();
if (arch_spec.IsValid())
launch_info.GetArchitecture () = arch_spec;
-
+
error.SetError (target_sp->Launch (target_sp->GetDebugger().GetListener(), launch_info));
sb_process.SetSP(target_sp->GetProcessSP());
}
@@ -776,14 +807,13 @@ SBTarget::Launch (SBLaunchInfo &sb_launch_info, SBError& error)
{
error.SetErrorString ("SBTarget is invalid");
}
-
+
log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
- {
log->Printf ("SBTarget(%p)::Launch (...) => SBProcess(%p)",
- target_sp.get(), sb_process.GetSP().get());
- }
-
+ static_cast<void*>(target_sp.get()),
+ static_cast<void*>(sb_process.GetSP().get()));
+
return sb_process;
}
@@ -791,41 +821,39 @@ lldb::SBProcess
SBTarget::Attach (SBAttachInfo &sb_attach_info, SBError& error)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
SBProcess sb_process;
ProcessSP process_sp;
TargetSP target_sp(GetSP());
-
+
if (log)
- {
- log->Printf ("SBTarget(%p)::Attach (sb_attach_info, error)...", target_sp.get());
- }
-
+ log->Printf ("SBTarget(%p)::Attach (sb_attach_info, error)...",
+ static_cast<void*>(target_sp.get()));
+
if (target_sp)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
-
+
StateType state = eStateInvalid;
process_sp = target_sp->GetProcessSP();
if (process_sp)
{
state = process_sp->GetState();
-
+
if (process_sp->IsAlive() && state != eStateConnected)
- {
+ {
if (state == eStateAttaching)
error.SetErrorString ("process attach is in progress");
else
error.SetErrorString ("a process is already being debugged");
if (log)
- {
log->Printf ("SBTarget(%p)::Attach (...) => error %s",
- target_sp.get(), error.GetCString());
- }
+ static_cast<void*>(target_sp.get()),
+ error.GetCString());
return sb_process;
- }
+ }
}
-
+
if (state != eStateConnected)
process_sp = target_sp->CreateProcess (target_sp->GetDebugger().GetListener(), NULL, NULL);
@@ -850,7 +878,7 @@ SBTarget::Attach (SBAttachInfo &sb_attach_info, SBError& error)
if (log)
{
log->Printf ("SBTarget(%p)::Attach (...) => error %s",
- target_sp.get(), error.GetCString());
+ static_cast<void*>(target_sp.get()), error.GetCString());
}
return sb_process;
}
@@ -875,13 +903,12 @@ SBTarget::Attach (SBAttachInfo &sb_attach_info, SBError& error)
{
error.SetErrorString ("SBTarget is invalid");
}
-
+
if (log)
- {
log->Printf ("SBTarget(%p)::Attach (...) => SBProcess(%p)",
- target_sp.get(), process_sp.get());
- }
-
+ static_cast<void*>(target_sp.get()),
+ static_cast<void*>(process_sp.get()));
+
return sb_process;
}
@@ -913,10 +940,9 @@ SBTarget::AttachToProcessWithID
TargetSP target_sp(GetSP());
if (log)
- {
- log->Printf ("SBTarget(%p)::AttachToProcessWithID (listener, pid=%" PRId64 ", error)...", target_sp.get(), pid);
- }
-
+ log->Printf ("SBTarget(%p)::AttachToProcessWithID (listener, pid=%" PRId64 ", error)...",
+ static_cast<void*>(target_sp.get()), pid);
+
if (target_sp)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
@@ -926,15 +952,15 @@ SBTarget::AttachToProcessWithID
if (process_sp)
{
state = process_sp->GetState();
-
+
if (process_sp->IsAlive() && state != eStateConnected)
- {
+ {
if (state == eStateAttaching)
error.SetErrorString ("process attach is in progress");
else
error.SetErrorString ("a process is already being debugged");
return sb_process;
- }
+ }
}
if (state == eStateConnected)
@@ -958,10 +984,10 @@ SBTarget::AttachToProcessWithID
if (process_sp)
{
sb_process.SetSP (process_sp);
-
+
ProcessAttachInfo attach_info;
attach_info.SetProcessID (pid);
-
+
PlatformSP platform_sp = target_sp->GetPlatform();
ProcessInstanceInfo instance_info;
if (platform_sp->GetProcessInfo(pid, instance_info))
@@ -986,12 +1012,11 @@ SBTarget::AttachToProcessWithID
{
error.SetErrorString ("SBTarget is invalid");
}
-
+
if (log)
- {
log->Printf ("SBTarget(%p)::AttachToProcessWithID (...) => SBProcess(%p)",
- target_sp.get(), process_sp.get());
- }
+ static_cast<void*>(target_sp.get()),
+ static_cast<void*>(process_sp.get()));
return sb_process;
}
@@ -1005,16 +1030,16 @@ SBTarget::AttachToProcessWithName
)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
SBProcess sb_process;
ProcessSP process_sp;
TargetSP target_sp(GetSP());
-
+
if (log)
- {
- log->Printf ("SBTarget(%p)::AttachToProcessWithName (listener, name=%s, wait_for=%s, error)...", target_sp.get(), name, wait_for ? "true" : "false");
- }
-
+ log->Printf ("SBTarget(%p)::AttachToProcessWithName (listener, name=%s, wait_for=%s, error)...",
+ static_cast<void*>(target_sp.get()), name,
+ wait_for ? "true" : "false");
+
if (name && target_sp)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
@@ -1024,17 +1049,17 @@ SBTarget::AttachToProcessWithName
if (process_sp)
{
state = process_sp->GetState();
-
+
if (process_sp->IsAlive() && state != eStateConnected)
- {
+ {
if (state == eStateAttaching)
error.SetErrorString ("process attach is in progress");
else
error.SetErrorString ("a process is already being debugged");
return sb_process;
- }
+ }
}
-
+
if (state == eStateConnected)
{
// If we are already connected, then we have already specified the
@@ -1078,12 +1103,11 @@ SBTarget::AttachToProcessWithName
{
error.SetErrorString ("SBTarget is invalid");
}
-
+
if (log)
- {
log->Printf ("SBTarget(%p)::AttachToPorcessWithName (...) => SBProcess(%p)",
- target_sp.get(), process_sp.get());
- }
+ static_cast<void*>(target_sp.get()),
+ static_cast<void*>(process_sp.get()));
return sb_process;
}
@@ -1101,12 +1125,11 @@ SBTarget::ConnectRemote
SBProcess sb_process;
ProcessSP process_sp;
TargetSP target_sp(GetSP());
-
+
if (log)
- {
- log->Printf ("SBTarget(%p)::ConnectRemote (listener, url=%s, plugin_name=%s, error)...", target_sp.get(), url, plugin_name);
- }
-
+ log->Printf ("SBTarget(%p)::ConnectRemote (listener, url=%s, plugin_name=%s, error)...",
+ static_cast<void*>(target_sp.get()), url, plugin_name);
+
if (target_sp)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
@@ -1114,8 +1137,7 @@ SBTarget::ConnectRemote
process_sp = target_sp->CreateProcess (listener.ref(), plugin_name, NULL);
else
process_sp = target_sp->CreateProcess (target_sp->GetDebugger().GetListener(), plugin_name, NULL);
-
-
+
if (process_sp)
{
sb_process.SetSP (process_sp);
@@ -1130,12 +1152,11 @@ SBTarget::ConnectRemote
{
error.SetErrorString ("SBTarget is invalid");
}
-
+
if (log)
- {
log->Printf ("SBTarget(%p)::ConnectRemote (...) => SBProcess(%p)",
- target_sp.get(), process_sp.get());
- }
+ static_cast<void*>(target_sp.get()),
+ static_cast<void*>(process_sp.get()));
return sb_process;
}
@@ -1155,8 +1176,9 @@ SBTarget::GetExecutable ()
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
- log->Printf ("SBTarget(%p)::GetExecutable () => SBFileSpec(%p)",
- target_sp.get(), exe_file_spec.get());
+ log->Printf ("SBTarget(%p)::GetExecutable () => SBFileSpec(%p)",
+ static_cast<void*>(target_sp.get()),
+ static_cast<const void*>(exe_file_spec.get()));
}
return exe_file_spec;
@@ -1258,7 +1280,7 @@ SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec,
if (target_sp && line != 0)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
-
+
const LazyBool check_inlines = eLazyBoolCalculate;
const LazyBool skip_prologue = eLazyBoolCalculate;
const bool internal = false;
@@ -1272,12 +1294,9 @@ SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec,
sb_bp.GetDescription (sstr);
char path[PATH_MAX];
sb_file_spec->GetPath (path, sizeof(path));
- log->Printf ("SBTarget(%p)::BreakpointCreateByLocation ( %s:%u ) => SBBreakpoint(%p): %s",
- target_sp.get(),
- path,
- line,
- sb_bp.get(),
- sstr.GetData());
+ log->Printf ("SBTarget(%p)::BreakpointCreateByLocation ( %s:%u ) => SBBreakpoint(%p): %s",
+ static_cast<void*>(target_sp.get()), path, line,
+ static_cast<void*>(sb_bp.get()), sstr.GetData());
}
return sb_bp;
@@ -1294,7 +1313,7 @@ SBTarget::BreakpointCreateByName (const char *symbol_name,
if (target_sp.get())
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
-
+
const bool internal = false;
const bool hardware = false;
const LazyBool skip_prologue = eLazyBoolCalculate;
@@ -1309,12 +1328,11 @@ SBTarget::BreakpointCreateByName (const char *symbol_name,
*sb_bp = target_sp->CreateBreakpoint (NULL, NULL, symbol_name, eFunctionNameTypeAuto, skip_prologue, internal, hardware);
}
}
-
+
if (log)
- {
- log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", module=\"%s\") => SBBreakpoint(%p)",
- target_sp.get(), symbol_name, module_name, sb_bp.get());
- }
+ log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", module=\"%s\") => SBBreakpoint(%p)",
+ static_cast<void*>(target_sp.get()), symbol_name,
+ module_name, static_cast<void*>(sb_bp.get()));
return sb_bp;
}
@@ -1352,12 +1370,11 @@ SBTarget::BreakpointCreateByName (const char *symbol_name,
internal,
hardware);
}
-
+
if (log)
- {
- log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", name_type: %d) => SBBreakpoint(%p)",
- target_sp.get(), symbol_name, name_type_mask, sb_bp.get());
- }
+ log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbol=\"%s\", name_type: %d) => SBBreakpoint(%p)",
+ static_cast<void*>(target_sp.get()), symbol_name,
+ name_type_mask, static_cast<void*>(sb_bp.get()));
return sb_bp;
}
@@ -1388,10 +1405,11 @@ SBTarget::BreakpointCreateByNames (const char *symbol_names[],
internal,
hardware);
}
-
+
if (log)
{
- log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbols={", target_sp.get());
+ log->Printf ("SBTarget(%p)::BreakpointCreateByName (symbols={",
+ static_cast<void*>(target_sp.get()));
for (uint32_t i = 0 ; i < num_names; i++)
{
char sep;
@@ -1403,9 +1421,9 @@ SBTarget::BreakpointCreateByNames (const char *symbol_names[],
log->Printf ("\"%s\"%c ", symbol_names[i], sep);
else
log->Printf ("\"<NULL>\"%c ", sep);
-
}
- log->Printf ("name_type: %d) => SBBreakpoint(%p)", name_type_mask, sb_bp.get());
+ log->Printf ("name_type: %d) => SBBreakpoint(%p)", name_type_mask,
+ static_cast<void*>(sb_bp.get()));
}
return sb_bp;
@@ -1426,12 +1444,12 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex,
const bool internal = false;
const bool hardware = false;
const LazyBool skip_prologue = eLazyBoolCalculate;
-
+
if (module_name && module_name[0])
{
FileSpecList module_spec_list;
module_spec_list.Append (FileSpec (module_name, false));
-
+
*sb_bp = target_sp->CreateFuncRegexBreakpoint (&module_spec_list, NULL, regexp, skip_prologue, internal, hardware);
}
else
@@ -1441,10 +1459,9 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex,
}
if (log)
- {
- log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_regex=\"%s\", module_name=\"%s\") => SBBreakpoint(%p)",
- target_sp.get(), symbol_name_regex, module_name, sb_bp.get());
- }
+ log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_regex=\"%s\", module_name=\"%s\") => SBBreakpoint(%p)",
+ static_cast<void*>(target_sp.get()), symbol_name_regex,
+ module_name, static_cast<void*>(sb_bp.get()));
return sb_bp;
}
@@ -1465,15 +1482,14 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex,
const bool internal = false;
const bool hardware = false;
const LazyBool skip_prologue = eLazyBoolCalculate;
-
+
*sb_bp = target_sp->CreateFuncRegexBreakpoint (module_list.get(), comp_unit_list.get(), regexp, skip_prologue, internal, hardware);
}
if (log)
- {
- log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_regex=\"%s\") => SBBreakpoint(%p)",
- target_sp.get(), symbol_name_regex, sb_bp.get());
- }
+ log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (symbol_regex=\"%s\") => SBBreakpoint(%p)",
+ static_cast<void*>(target_sp.get()), symbol_name_regex,
+ static_cast<void*>(sb_bp.get()));
return sb_bp;
}
@@ -1491,11 +1507,12 @@ SBTarget::BreakpointCreateByAddress (addr_t address)
const bool hardware = false;
*sb_bp = target_sp->CreateBreakpoint (address, false, hardware);
}
-
+
if (log)
- {
- log->Printf ("SBTarget(%p)::BreakpointCreateByAddress (address=%" PRIu64 ") => SBBreakpoint(%p)", target_sp.get(), (uint64_t) address, sb_bp.get());
- }
+ log->Printf ("SBTarget(%p)::BreakpointCreateByAddress (address=%" PRIu64 ") => SBBreakpoint(%p)",
+ static_cast<void*>(target_sp.get()),
+ static_cast<uint64_t>(address),
+ static_cast<void*>(sb_bp.get()));
return sb_bp;
}
@@ -1516,12 +1533,12 @@ SBTarget::BreakpointCreateBySourceRegex (const char *source_regex,
FileSpecList source_file_spec_list;
const bool hardware = false;
source_file_spec_list.Append (source_file.ref());
-
+
if (module_name && module_name[0])
{
FileSpecList module_spec_list;
module_spec_list.Append (FileSpec (module_name, false));
-
+
*sb_bp = target_sp->CreateSourceRegexBreakpoint (&module_spec_list, &source_file_spec_list, regexp, false, hardware);
}
else
@@ -1534,8 +1551,9 @@ SBTarget::BreakpointCreateBySourceRegex (const char *source_regex,
{
char path[PATH_MAX];
source_file->GetPath (path, sizeof(path));
- log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (source_regex=\"%s\", file=\"%s\", module_name=\"%s\") => SBBreakpoint(%p)",
- target_sp.get(), source_regex, path, module_name, sb_bp.get());
+ log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (source_regex=\"%s\", file=\"%s\", module_name=\"%s\") => SBBreakpoint(%p)",
+ static_cast<void*>(target_sp.get()), source_regex, path,
+ module_name, static_cast<void*>(sb_bp.get()));
}
return sb_bp;
@@ -1559,10 +1577,9 @@ SBTarget::BreakpointCreateBySourceRegex (const char *source_regex,
}
if (log)
- {
- log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (source_regex=\"%s\") => SBBreakpoint(%p)",
- target_sp.get(), source_regex, sb_bp.get());
- }
+ log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (source_regex=\"%s\") => SBBreakpoint(%p)",
+ static_cast<void*>(target_sp.get()), source_regex,
+ static_cast<void*>(sb_bp.get()));
return sb_bp;
}
@@ -1584,14 +1601,11 @@ SBTarget::BreakpointCreateForException (lldb::LanguageType language,
}
if (log)
- {
- log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (Language: %s, catch: %s throw: %s) => SBBreakpoint(%p)",
- target_sp.get(),
+ log->Printf ("SBTarget(%p)::BreakpointCreateByRegex (Language: %s, catch: %s throw: %s) => SBBreakpoint(%p)",
+ static_cast<void*>(target_sp.get()),
LanguageRuntime::GetNameForLanguageType(language),
- catch_bp ? "on" : "off",
- throw_bp ? "on" : "off",
- sb_bp.get());
- }
+ catch_bp ? "on" : "off", throw_bp ? "on" : "off",
+ static_cast<void*>(sb_bp.get()));
return sb_bp;
}
@@ -1635,9 +1649,9 @@ SBTarget::BreakpointDelete (break_id_t bp_id)
}
if (log)
- {
- log->Printf ("SBTarget(%p)::BreakpointDelete (bp_id=%d) => %i", target_sp.get(), (uint32_t) bp_id, result);
- }
+ log->Printf ("SBTarget(%p)::BreakpointDelete (bp_id=%d) => %i",
+ static_cast<void*>(target_sp.get()),
+ static_cast<uint32_t>(bp_id), result);
return result;
}
@@ -1656,10 +1670,10 @@ SBTarget::FindBreakpointByID (break_id_t bp_id)
}
if (log)
- {
- log->Printf ("SBTarget(%p)::FindBreakpointByID (bp_id=%d) => SBBreakpoint(%p)",
- target_sp.get(), (uint32_t) bp_id, sb_breakpoint.get());
- }
+ log->Printf ("SBTarget(%p)::FindBreakpointByID (bp_id=%d) => SBBreakpoint(%p)",
+ static_cast<void*>(target_sp.get()),
+ static_cast<uint32_t>(bp_id),
+ static_cast<void*>(sb_breakpoint.get()));
return sb_breakpoint;
}
@@ -1744,9 +1758,9 @@ SBTarget::DeleteWatchpoint (watch_id_t wp_id)
}
if (log)
- {
- log->Printf ("SBTarget(%p)::WatchpointDelete (wp_id=%d) => %i", target_sp.get(), (uint32_t) wp_id, result);
- }
+ log->Printf ("SBTarget(%p)::WatchpointDelete (wp_id=%d) => %i",
+ static_cast<void*>(target_sp.get()),
+ static_cast<uint32_t>(wp_id), result);
return result;
}
@@ -1769,10 +1783,10 @@ SBTarget::FindWatchpointByID (lldb::watch_id_t wp_id)
}
if (log)
- {
- log->Printf ("SBTarget(%p)::FindWatchpointByID (bp_id=%d) => SBWatchpoint(%p)",
- target_sp.get(), (uint32_t) wp_id, watchpoint_sp.get());
- }
+ log->Printf ("SBTarget(%p)::FindWatchpointByID (bp_id=%d) => SBWatchpoint(%p)",
+ static_cast<void*>(target_sp.get()),
+ static_cast<uint32_t>(wp_id),
+ static_cast<void*>(watchpoint_sp.get()));
return sb_watchpoint;
}
@@ -1781,7 +1795,7 @@ lldb::SBWatchpoint
SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write, SBError &error)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
SBWatchpoint sb_watchpoint;
lldb::WatchpointSP watchpoint_sp;
TargetSP target_sp(GetSP());
@@ -1798,7 +1812,7 @@ SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write, S
error.SetErrorString("Can't create a watchpoint that is neither read nor write.");
return sb_watchpoint;
}
-
+
// Target::CreateWatchpoint() is thread safe.
Error cw_error;
// This API doesn't take in a type, so we can't figure out what it is.
@@ -1807,13 +1821,13 @@ SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write, S
error.SetError(cw_error);
sb_watchpoint.SetSP (watchpoint_sp);
}
-
+
if (log)
- {
log->Printf ("SBTarget(%p)::WatchAddress (addr=0x%" PRIx64 ", 0x%u) => SBWatchpoint(%p)",
- target_sp.get(), addr, (uint32_t) size, watchpoint_sp.get());
- }
-
+ static_cast<void*>(target_sp.get()), addr,
+ static_cast<uint32_t>(size),
+ static_cast<void*>(watchpoint_sp.get()));
+
return sb_watchpoint;
}
@@ -1860,7 +1874,7 @@ SBTarget::CreateValueFromAddress (const char *name, SBAddress addr, SBType type)
if (pointer_ast_type)
{
lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t)));
-
+
ExecutionContext exe_ctx (ExecutionContextRef(ExecutionContext(m_opaque_sp.get(),false)));
ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
pointer_ast_type,
@@ -1868,7 +1882,7 @@ SBTarget::CreateValueFromAddress (const char *name, SBAddress addr, SBType type)
buffer,
exe_ctx.GetByteOrder(),
exe_ctx.GetAddressByteSize()));
-
+
if (ptr_result_valobj_sp)
{
ptr_result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress);
@@ -1884,9 +1898,12 @@ SBTarget::CreateValueFromAddress (const char *name, SBAddress addr, SBType type)
if (log)
{
if (new_value_sp)
- log->Printf ("SBTarget(%p)::CreateValueFromAddress => \"%s\"", m_opaque_sp.get(), new_value_sp->GetName().AsCString());
+ log->Printf ("SBTarget(%p)::CreateValueFromAddress => \"%s\"",
+ static_cast<void*>(m_opaque_sp.get()),
+ new_value_sp->GetName().AsCString());
else
- log->Printf ("SBTarget(%p)::CreateValueFromAddress => NULL", m_opaque_sp.get());
+ log->Printf ("SBTarget(%p)::CreateValueFromAddress => NULL",
+ static_cast<void*>(m_opaque_sp.get()));
}
return sb_value;
}
@@ -1981,7 +1998,8 @@ SBTarget::GetNumModules () const
}
if (log)
- log->Printf ("SBTarget(%p)::GetNumModules () => %d", target_sp.get(), num);
+ log->Printf ("SBTarget(%p)::GetNumModules () => %d",
+ static_cast<void*>(target_sp.get()), num);
return num;
}
@@ -1992,7 +2010,8 @@ SBTarget::Clear ()
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBTarget(%p)::Clear ()", m_opaque_sp.get());
+ log->Printf ("SBTarget(%p)::Clear ()",
+ static_cast<void*>(m_opaque_sp.get()));
m_opaque_sp.reset();
}
@@ -2063,10 +2082,9 @@ SBTarget::GetModuleAtIndex (uint32_t idx)
}
if (log)
- {
- log->Printf ("SBTarget(%p)::GetModuleAtIndex (idx=%d) => SBModule(%p)",
- target_sp.get(), idx, module_sp.get());
- }
+ log->Printf ("SBTarget(%p)::GetModuleAtIndex (idx=%d) => SBModule(%p)",
+ static_cast<void*>(target_sp.get()), idx,
+ static_cast<void*>(module_sp.get()));
return sb_module;
}
@@ -2088,10 +2106,11 @@ SBTarget::GetBroadcaster () const
TargetSP target_sp(GetSP());
SBBroadcaster broadcaster(target_sp.get(), false);
-
+
if (log)
- log->Printf ("SBTarget(%p)::GetBroadcaster () => SBBroadcaster(%p)",
- target_sp.get(), broadcaster.get());
+ log->Printf ("SBTarget(%p)::GetBroadcaster () => SBBroadcaster(%p)",
+ static_cast<void*>(target_sp.get()),
+ static_cast<void*>(broadcaster.get()));
return broadcaster;
}
@@ -2432,10 +2451,6 @@ SBTarget::SetSectionLoadAddress (lldb::SBSection section,
else
{
ProcessSP process_sp (target_sp->GetProcessSP());
- uint32_t stop_id = 0;
- if (process_sp)
- stop_id = process_sp->GetStopID();
-
if (target_sp->SetSectionLoadAddress (section_sp, section_base_addr))
{
// Flush info in the process (stack frames, etc)
@@ -2468,10 +2483,6 @@ SBTarget::ClearSectionLoadAddress (lldb::SBSection section)
else
{
ProcessSP process_sp (target_sp->GetProcessSP());
- uint32_t stop_id = 0;
- if (process_sp)
- stop_id = process_sp->GetStopID();
-
if (target_sp->SetSectionUnloaded (section.GetSP()))
{
// Flush info in the process (stack frames, etc)
@@ -2547,9 +2558,6 @@ SBTarget::ClearModuleLoadAddress (lldb::SBModule module)
if (section_list)
{
ProcessSP process_sp (target_sp->GetProcessSP());
- uint32_t stop_id = 0;
- if (process_sp)
- stop_id = process_sp->GetStopID();
bool changed = false;
const size_t num_sections = section_list->GetSize();
@@ -2557,7 +2565,7 @@ SBTarget::ClearModuleLoadAddress (lldb::SBModule module)
{
SectionSP section_sp (section_list->GetSectionAtIndex(sect_idx));
if (section_sp)
- changed |= target_sp->SetSectionUnloaded (section_sp) > 0;
+ changed |= target_sp->SetSectionUnloaded (section_sp);
}
if (changed)
{
@@ -2619,7 +2627,7 @@ SBTarget::EvaluateExpression (const char *expr, const SBExpressionOptions &optio
Log *log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Log * expr_log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
SBValue expr_result;
- ExecutionResults exe_results = eExecutionSetupError;
+ ExpressionResults exe_results = eExpressionSetupError;
ValueObjectSP expr_value_sp;
TargetSP target_sp(GetSP());
StackFrame *frame = NULL;
@@ -2631,16 +2639,16 @@ SBTarget::EvaluateExpression (const char *expr, const SBExpressionOptions &optio
log->Printf ("SBTarget::EvaluateExpression called with an empty expression");
return expr_result;
}
-
+
Mutex::Locker api_locker (target_sp->GetAPIMutex());
ExecutionContext exe_ctx (m_opaque_sp.get());
-
+
if (log)
log->Printf ("SBTarget()::EvaluateExpression (expr=\"%s\")...", expr);
-
+
frame = exe_ctx.GetFramePtr();
Target *target = exe_ctx.GetTargetPtr();
-
+
if (target)
{
#ifdef LLDB_CONFIGURATION_DEBUG
@@ -2669,17 +2677,14 @@ SBTarget::EvaluateExpression (const char *expr, const SBExpressionOptions &optio
#ifndef LLDB_DISABLE_PYTHON
if (expr_log)
expr_log->Printf("** [SBTarget::EvaluateExpression] Expression result is %s, summary %s **",
- expr_result.GetValue(),
- expr_result.GetSummary());
-
+ expr_result.GetValue(), expr_result.GetSummary());
+
if (log)
log->Printf ("SBTarget(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p) (execution result=%d)",
- frame,
- expr,
- expr_value_sp.get(),
- exe_results);
+ static_cast<void*>(frame), expr,
+ static_cast<void*>(expr_value_sp.get()), exe_results);
#endif
-
+
return expr_result;
}
diff --git a/source/API/SBThread.cpp b/source/API/SBThread.cpp
index 4170d5b230bb..a0bfa4313535 100644
--- a/source/API/SBThread.cpp
+++ b/source/API/SBThread.cpp
@@ -19,10 +19,12 @@
#include "lldb/Core/State.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
+#include "lldb/Core/StructuredData.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Target/SystemRuntime.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/Process.h"
+#include "lldb/Target/Queue.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Target/StopInfo.h"
@@ -88,6 +90,42 @@ SBThread::~SBThread()
{
}
+lldb::SBQueue
+SBThread::GetQueue () const
+{
+ SBQueue sb_queue;
+ QueueSP queue_sp;
+ Mutex::Locker api_locker;
+ ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (exe_ctx.HasThreadScope())
+ {
+ Process::StopLocker stop_locker;
+ if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock()))
+ {
+ queue_sp = exe_ctx.GetThreadPtr()->GetQueue();
+ if (queue_sp)
+ {
+ sb_queue.SetQueue (queue_sp);
+ }
+ }
+ else
+ {
+ if (log)
+ log->Printf ("SBThread(%p)::GetQueueKind() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
+ }
+ }
+
+ if (log)
+ log->Printf ("SBThread(%p)::GetQueueKind () => SBQueue(%p)",
+ static_cast<void*>(exe_ctx.GetThreadPtr()), static_cast<void*>(queue_sp.get()));
+
+ return sb_queue;
+}
+
+
bool
SBThread::IsValid() const
{
@@ -120,12 +158,14 @@ SBThread::GetStopReason()
else
{
if (log)
- log->Printf ("SBThread(%p)::GetStopReason() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetStopReason() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
if (log)
- log->Printf ("SBThread(%p)::GetStopReason () => %s", exe_ctx.GetThreadPtr(),
+ log->Printf ("SBThread(%p)::GetStopReason () => %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
Thread::StopReasonAsCString (reason));
return reason;
@@ -183,7 +223,8 @@ SBThread::GetStopReasonDataCount ()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBThread(%p)::GetStopReasonDataCount() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetStopReasonDataCount() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
return 0;
@@ -226,7 +267,7 @@ SBThread::GetStopReasonDataAtIndex (uint32_t idx)
BreakpointLocationSP bp_loc_sp (bp_site_sp->GetOwnerAtIndex (bp_index));
if (bp_loc_sp)
{
- if (bp_index & 1)
+ if (idx & 1)
{
// Odd idx, return the breakpoint location ID
return bp_loc_sp->GetID();
@@ -257,7 +298,8 @@ SBThread::GetStopReasonDataAtIndex (uint32_t idx)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBThread(%p)::GetStopReasonDataAtIndex() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetStopReasonDataAtIndex() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
return 0;
@@ -284,8 +326,9 @@ SBThread::GetStopDescription (char *dst, size_t dst_len)
if (stop_desc)
{
if (log)
- log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => \"%s\"",
- exe_ctx.GetThreadPtr(), stop_desc);
+ log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => \"%s\"",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ stop_desc);
if (dst)
return ::snprintf (dst, dst_len, "%s", stop_desc);
else
@@ -362,19 +405,20 @@ SBThread::GetStopDescription (char *dst, size_t dst_len)
default:
break;
}
-
+
if (stop_desc && stop_desc[0])
{
if (log)
- log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => '%s'",
- exe_ctx.GetThreadPtr(), stop_desc);
+ log->Printf ("SBThread(%p)::GetStopDescription (dst, dst_len) => '%s'",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ stop_desc);
if (dst)
return ::snprintf (dst, dst_len, "%s", stop_desc) + 1; // Include the NULL byte
if (stop_desc_len == 0)
stop_desc_len = ::strlen (stop_desc) + 1; // Include the NULL byte
-
+
return stop_desc_len;
}
}
@@ -384,7 +428,8 @@ SBThread::GetStopDescription (char *dst, size_t dst_len)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBThread(%p)::GetStopDescription() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetStopDescription() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
if (dst)
@@ -414,16 +459,18 @@ SBThread::GetStopReturnValue ()
else
{
if (log)
- log->Printf ("SBThread(%p)::GetStopReturnValue() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetStopReturnValue() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
-
+
if (log)
- log->Printf ("SBThread(%p)::GetStopReturnValue () => %s", exe_ctx.GetThreadPtr(),
- return_valobj_sp.get()
- ? return_valobj_sp->GetValueAsCString()
- : "<no return value>");
-
+ log->Printf ("SBThread(%p)::GetStopReturnValue () => %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ return_valobj_sp.get()
+ ? return_valobj_sp->GetValueAsCString()
+ : "<no return value>");
+
return SBValue (return_valobj_sp);
}
@@ -469,12 +516,15 @@ SBThread::GetName () const
else
{
if (log)
- log->Printf ("SBThread(%p)::GetName() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetName() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
-
+
if (log)
- log->Printf ("SBThread(%p)::GetName () => %s", exe_ctx.GetThreadPtr(), name ? name : "NULL");
+ log->Printf ("SBThread(%p)::GetName () => %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ name ? name : "NULL");
return name;
}
@@ -497,12 +547,15 @@ SBThread::GetQueueName () const
else
{
if (log)
- log->Printf ("SBThread(%p)::GetQueueName() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetQueueName() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
-
+
if (log)
- log->Printf ("SBThread(%p)::GetQueueName () => %s", exe_ctx.GetThreadPtr(), name ? name : "NULL");
+ log->Printf ("SBThread(%p)::GetQueueName () => %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ name ? name : "NULL");
return name;
}
@@ -525,16 +578,86 @@ SBThread::GetQueueID () const
else
{
if (log)
- log->Printf ("SBThread(%p)::GetQueueID() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetQueueID() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
-
+
if (log)
- log->Printf ("SBThread(%p)::GetQueueID () => 0x%" PRIx64, exe_ctx.GetThreadPtr(), id);
+ log->Printf ("SBThread(%p)::GetQueueID () => 0x%" PRIx64,
+ static_cast<void*>(exe_ctx.GetThreadPtr()), id);
return id;
}
+bool
+SBThread::GetInfoItemByPathAsString (const char *path, SBStream &strm)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ bool success = false;
+ Mutex::Locker api_locker;
+ ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+
+ if (exe_ctx.HasThreadScope())
+ {
+ Process::StopLocker stop_locker;
+ if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock()))
+ {
+ Thread *thread = exe_ctx.GetThreadPtr();
+ StructuredData::ObjectSP info_root_sp = thread->GetExtendedInfo();
+ if (info_root_sp)
+ {
+ StructuredData::ObjectSP node = info_root_sp->GetObjectForDotSeparatedPath (path);
+ if (node)
+ {
+ if (node->GetType() == StructuredData::Type::eTypeString)
+ {
+ strm.Printf ("%s", node->GetAsString()->GetValue().c_str());
+ success = true;
+ }
+ if (node->GetType() == StructuredData::Type::eTypeInteger)
+ {
+ strm.Printf ("0x%" PRIx64, node->GetAsInteger()->GetValue());
+ success = true;
+ }
+ if (node->GetType() == StructuredData::Type::eTypeFloat)
+ {
+ strm.Printf ("0x%f", node->GetAsFloat()->GetValue());
+ success = true;
+ }
+ if (node->GetType() == StructuredData::Type::eTypeBoolean)
+ {
+ if (node->GetAsBoolean()->GetValue() == true)
+ strm.Printf ("true");
+ else
+ strm.Printf ("false");
+ success = true;
+ }
+ if (node->GetType() == StructuredData::Type::eTypeNull)
+ {
+ strm.Printf ("null");
+ success = true;
+ }
+ }
+ }
+ }
+ else
+ {
+ if (log)
+ log->Printf ("SBThread(%p)::GetInfoItemByPathAsString() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
+ }
+ }
+
+ if (log)
+ log->Printf ("SBThread(%p)::GetInfoItemByPathAsString () => %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ strm.GetData());
+
+ return success;
+}
+
+
SBError
SBThread::ResumeNewPlan (ExecutionContext &exe_ctx, ThreadPlan *new_plan)
{
@@ -587,9 +710,10 @@ SBThread::StepOver (lldb::RunMode stop_other_threads)
if (log)
- log->Printf ("SBThread(%p)::StepOver (stop_other_threads='%s')", exe_ctx.GetThreadPtr(),
+ log->Printf ("SBThread(%p)::StepOver (stop_other_threads='%s')",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
Thread::RunModeAsCString (stop_other_threads));
-
+
if (exe_ctx.HasThreadScope())
{
Thread *thread = exe_ctx.GetThreadPtr();
@@ -601,17 +725,19 @@ SBThread::StepOver (lldb::RunMode stop_other_threads)
{
if (frame_sp->HasDebugInformation ())
{
+ const LazyBool avoid_no_debug = eLazyBoolCalculate;
SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
new_plan_sp = thread->QueueThreadPlanForStepOverRange (abort_other_plans,
sc.line_entry.range,
sc,
- stop_other_threads);
+ stop_other_threads,
+ avoid_no_debug);
}
else
{
new_plan_sp = thread->QueueThreadPlanForStepSingleInstruction (true,
- abort_other_plans,
- stop_other_threads);
+ abort_other_plans,
+ stop_other_threads);
}
}
@@ -636,10 +762,10 @@ SBThread::StepInto (const char *target_name, lldb::RunMode stop_other_threads)
if (log)
log->Printf ("SBThread(%p)::StepInto (target_name='%s', stop_other_threads='%s')",
- exe_ctx.GetThreadPtr(),
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
target_name? target_name: "<NULL>",
Thread::RunModeAsCString (stop_other_threads));
-
+
if (exe_ctx.HasThreadScope())
{
bool abort_other_plans = false;
@@ -650,22 +776,24 @@ SBThread::StepInto (const char *target_name, lldb::RunMode stop_other_threads)
if (frame_sp && frame_sp->HasDebugInformation ())
{
- bool avoid_code_without_debug_info = true;
+ const LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate;
+ const LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate;
SymbolContext sc(frame_sp->GetSymbolContext(eSymbolContextEverything));
new_plan_sp = thread->QueueThreadPlanForStepInRange (abort_other_plans,
sc.line_entry.range,
sc,
target_name,
stop_other_threads,
- avoid_code_without_debug_info);
+ step_in_avoids_code_without_debug_info,
+ step_out_avoids_code_without_debug_info);
}
else
{
new_plan_sp = thread->QueueThreadPlanForStepSingleInstruction (false,
- abort_other_plans,
- stop_other_threads);
+ abort_other_plans,
+ stop_other_threads);
}
-
+
// This returns an error, we should use it!
ResumeNewPlan (exe_ctx, new_plan_sp.get());
}
@@ -681,8 +809,9 @@ SBThread::StepOut ()
if (log)
- log->Printf ("SBThread(%p)::StepOut ()", exe_ctx.GetThreadPtr());
-
+ log->Printf ("SBThread(%p)::StepOut ()",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
+
if (exe_ctx.HasThreadScope())
{
bool abort_other_plans = false;
@@ -690,14 +819,16 @@ SBThread::StepOut ()
Thread *thread = exe_ctx.GetThreadPtr();
+ const LazyBool avoid_no_debug = eLazyBoolCalculate;
ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepOut (abort_other_plans,
- NULL,
- false,
- stop_other_threads,
- eVoteYes,
- eVoteNoOpinion,
- 0));
-
+ NULL,
+ false,
+ stop_other_threads,
+ eVoteYes,
+ eVoteNoOpinion,
+ 0,
+ avoid_no_debug));
+
// This returns an error, we should use it!
ResumeNewPlan (exe_ctx, new_plan_sp.get());
}
@@ -716,7 +847,10 @@ SBThread::StepOutOfFrame (lldb::SBFrame &sb_frame)
{
SBStream frame_desc_strm;
sb_frame.GetDescription (frame_desc_strm);
- log->Printf ("SBThread(%p)::StepOutOfFrame (frame = SBFrame(%p): %s)", exe_ctx.GetThreadPtr(), frame_sp.get(), frame_desc_strm.GetData());
+ log->Printf ("SBThread(%p)::StepOutOfFrame (frame = SBFrame(%p): %s)",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ static_cast<void*>(frame_sp.get()),
+ frame_desc_strm.GetData());
}
if (exe_ctx.HasThreadScope())
@@ -726,13 +860,13 @@ SBThread::StepOutOfFrame (lldb::SBFrame &sb_frame)
Thread *thread = exe_ctx.GetThreadPtr();
ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepOut (abort_other_plans,
- NULL,
- false,
- stop_other_threads,
- eVoteYes,
+ NULL,
+ false,
+ stop_other_threads,
+ eVoteYes,
eVoteNoOpinion,
frame_sp->GetFrameIndex()));
-
+
// This returns an error, we should use it!
ResumeNewPlan (exe_ctx, new_plan_sp.get());
}
@@ -749,13 +883,14 @@ SBThread::StepInstruction (bool step_over)
if (log)
- log->Printf ("SBThread(%p)::StepInstruction (step_over=%i)", exe_ctx.GetThreadPtr(), step_over);
-
+ log->Printf ("SBThread(%p)::StepInstruction (step_over=%i)",
+ static_cast<void*>(exe_ctx.GetThreadPtr()), step_over);
+
if (exe_ctx.HasThreadScope())
{
Thread *thread = exe_ctx.GetThreadPtr();
ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForStepSingleInstruction (step_over, true, true));
-
+
// This returns an error, we should use it!
ResumeNewPlan (exe_ctx, new_plan_sp.get());
}
@@ -771,8 +906,9 @@ SBThread::RunToAddress (lldb::addr_t addr)
if (log)
- log->Printf ("SBThread(%p)::RunToAddress (addr=0x%" PRIx64 ")", exe_ctx.GetThreadPtr(), addr);
-
+ log->Printf ("SBThread(%p)::RunToAddress (addr=0x%" PRIx64 ")",
+ static_cast<void*>(exe_ctx.GetThreadPtr()), addr);
+
if (exe_ctx.HasThreadScope())
{
bool abort_other_plans = false;
@@ -783,7 +919,7 @@ SBThread::RunToAddress (lldb::addr_t addr)
Thread *thread = exe_ctx.GetThreadPtr();
ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForRunToAddress (abort_other_plans, target_addr, stop_other_threads));
-
+
// This returns an error, we should use it!
ResumeNewPlan (exe_ctx, new_plan_sp.get());
}
@@ -797,7 +933,7 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame,
SBError sb_error;
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
char path[PATH_MAX];
-
+
Mutex::Locker api_locker;
ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
@@ -808,11 +944,10 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame,
SBStream frame_desc_strm;
sb_frame.GetDescription (frame_desc_strm);
sb_file_spec->GetPath (path, sizeof(path));
- log->Printf ("SBThread(%p)::StepOverUntil (frame = SBFrame(%p): %s, file+line = %s:%u)",
- exe_ctx.GetThreadPtr(),
- frame_sp.get(),
- frame_desc_strm.GetData(),
- path, line);
+ log->Printf ("SBThread(%p)::StepOverUntil (frame = SBFrame(%p): %s, file+line = %s:%u)",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ static_cast<void*>(frame_sp.get()),
+ frame_desc_strm.GetData(), path, line);
}
if (exe_ctx.HasThreadScope())
@@ -825,14 +960,14 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame,
sb_error.SetErrorString("invalid line argument");
return sb_error;
}
-
+
if (!frame_sp)
{
frame_sp = thread->GetSelectedFrame ();
if (!frame_sp)
frame_sp = thread->GetStackFrameAtIndex (0);
}
-
+
SymbolContext frame_sc;
if (!frame_sp)
{
@@ -845,13 +980,13 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame,
eSymbolContextFunction |
eSymbolContextLineEntry |
eSymbolContextSymbol );
-
+
if (frame_sc.comp_unit == NULL)
{
sb_error.SetErrorStringWithFormat("frame %u doesn't have debug information", frame_sp->GetFrameIndex());
return sb_error;
}
-
+
FileSpec step_file_spec;
if (sb_file_spec.IsValid())
{
@@ -868,15 +1003,15 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame,
return sb_error;
}
}
-
+
// Grab the current function, then we will make sure the "until" address is
// within the function. We discard addresses that are out of the current
// function, and then if there are no addresses remaining, give an appropriate
// error message.
-
+
bool all_in_function = true;
AddressRange fun_range = frame_sc.function->GetAddressRange();
-
+
std::vector<addr_t> step_over_until_addrs;
const bool abort_other_plans = false;
const bool stop_other_threads = false;
@@ -908,7 +1043,7 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame,
}
}
}
-
+
if (step_over_until_addrs.empty())
{
if (all_in_function)
@@ -947,7 +1082,9 @@ SBThread::JumpToLine (lldb::SBFileSpec &file_spec, uint32_t line)
ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
if (log)
- log->Printf ("SBThread(%p)::JumpToLine (file+line = %s:%u)", exe_ctx.GetThreadPtr(), file_spec->GetPath().c_str(), line);
+ log->Printf ("SBThread(%p)::JumpToLine (file+line = %s:%u)",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ file_spec->GetPath().c_str(), line);
if (!exe_ctx.HasThreadScope())
{
@@ -966,7 +1103,7 @@ SBError
SBThread::ReturnFromFrame (SBFrame &frame, SBValue &return_value)
{
SBError sb_error;
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Mutex::Locker api_locker;
@@ -974,14 +1111,16 @@ SBThread::ReturnFromFrame (SBFrame &frame, SBValue &return_value)
if (log)
- log->Printf ("SBThread(%p)::ReturnFromFrame (frame=%d)", exe_ctx.GetThreadPtr(), frame.GetFrameID());
-
+ log->Printf ("SBThread(%p)::ReturnFromFrame (frame=%d)",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ frame.GetFrameID());
+
if (exe_ctx.HasThreadScope())
{
Thread *thread = exe_ctx.GetThreadPtr();
sb_error.SetError (thread->ReturnFromFrame(frame.GetFrameSP(), return_value.GetSP()));
}
-
+
return sb_error;
}
@@ -1003,11 +1142,13 @@ SBThread::Suspend()
else
{
if (log)
- log->Printf ("SBThread(%p)::Suspend() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::Suspend() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
if (log)
- log->Printf ("SBThread(%p)::Suspend() => %i", exe_ctx.GetThreadPtr(), result);
+ log->Printf ("SBThread(%p)::Suspend() => %i",
+ static_cast<void*>(exe_ctx.GetThreadPtr()), result);
return result;
}
@@ -1022,17 +1163,20 @@ SBThread::Resume ()
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock()))
{
- exe_ctx.GetThreadPtr()->SetResumeState (eStateRunning);
+ const bool override_suspend = true;
+ exe_ctx.GetThreadPtr()->SetResumeState (eStateRunning, override_suspend);
result = true;
}
else
{
if (log)
- log->Printf ("SBThread(%p)::Resume() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::Resume() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
if (log)
- log->Printf ("SBThread(%p)::Resume() => %i", exe_ctx.GetThreadPtr(), result);
+ log->Printf ("SBThread(%p)::Resume() => %i",
+ static_cast<void*>(exe_ctx.GetThreadPtr()), result);
return result;
}
@@ -1070,8 +1214,10 @@ SBThread::GetProcess ()
{
SBStream frame_desc_strm;
sb_process.GetDescription (frame_desc_strm);
- log->Printf ("SBThread(%p)::GetProcess () => SBProcess(%p): %s", exe_ctx.GetThreadPtr(),
- sb_process.GetSP().get(), frame_desc_strm.GetData());
+ log->Printf ("SBThread(%p)::GetProcess () => SBProcess(%p): %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ static_cast<void*>(sb_process.GetSP().get()),
+ frame_desc_strm.GetData());
}
return sb_process;
@@ -1096,12 +1242,14 @@ SBThread::GetNumFrames ()
else
{
if (log)
- log->Printf ("SBThread(%p)::GetNumFrames() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetNumFrames() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
if (log)
- log->Printf ("SBThread(%p)::GetNumFrames () => %u", exe_ctx.GetThreadPtr(), num_frames);
+ log->Printf ("SBThread(%p)::GetNumFrames () => %u",
+ static_cast<void*>(exe_ctx.GetThreadPtr()), num_frames);
return num_frames;
}
@@ -1127,7 +1275,8 @@ SBThread::GetFrameAtIndex (uint32_t idx)
else
{
if (log)
- log->Printf ("SBThread(%p)::GetFrameAtIndex() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetFrameAtIndex() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
@@ -1135,8 +1284,10 @@ SBThread::GetFrameAtIndex (uint32_t idx)
{
SBStream frame_desc_strm;
sb_frame.GetDescription (frame_desc_strm);
- log->Printf ("SBThread(%p)::GetFrameAtIndex (idx=%d) => SBFrame(%p): %s",
- exe_ctx.GetThreadPtr(), idx, frame_sp.get(), frame_desc_strm.GetData());
+ log->Printf ("SBThread(%p)::GetFrameAtIndex (idx=%d) => SBFrame(%p): %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()), idx,
+ static_cast<void*>(frame_sp.get()),
+ frame_desc_strm.GetData());
}
return sb_frame;
@@ -1163,7 +1314,8 @@ SBThread::GetSelectedFrame ()
else
{
if (log)
- log->Printf ("SBThread(%p)::GetSelectedFrame() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetSelectedFrame() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
@@ -1171,8 +1323,10 @@ SBThread::GetSelectedFrame ()
{
SBStream frame_desc_strm;
sb_frame.GetDescription (frame_desc_strm);
- log->Printf ("SBThread(%p)::GetSelectedFrame () => SBFrame(%p): %s",
- exe_ctx.GetThreadPtr(), frame_sp.get(), frame_desc_strm.GetData());
+ log->Printf ("SBThread(%p)::GetSelectedFrame () => SBFrame(%p): %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ static_cast<void*>(frame_sp.get()),
+ frame_desc_strm.GetData());
}
return sb_frame;
@@ -1204,7 +1358,8 @@ SBThread::SetSelectedFrame (uint32_t idx)
else
{
if (log)
- log->Printf ("SBThread(%p)::SetSelectedFrame() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::SetSelectedFrame() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
@@ -1212,8 +1367,10 @@ SBThread::SetSelectedFrame (uint32_t idx)
{
SBStream frame_desc_strm;
sb_frame.GetDescription (frame_desc_strm);
- log->Printf ("SBThread(%p)::SetSelectedFrame (idx=%u) => SBFrame(%p): %s",
- exe_ctx.GetThreadPtr(), idx, frame_sp.get(), frame_desc_strm.GetData());
+ log->Printf ("SBThread(%p)::SetSelectedFrame (idx=%u) => SBFrame(%p): %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()), idx,
+ static_cast<void*>(frame_sp.get()),
+ frame_desc_strm.GetData());
}
return sb_frame;
}
@@ -1316,7 +1473,11 @@ SBThread::GetExtendedBacktraceThread (const char *type)
const char *queue_name = new_thread_sp->GetQueueName();
if (queue_name == NULL)
queue_name = "";
- log->Printf ("SBThread(%p)::GetExtendedBacktraceThread() => new extended Thread created (%p) with queue_id 0x%" PRIx64 " queue name '%s'", exe_ctx.GetThreadPtr(), new_thread_sp.get(), new_thread_sp->GetQueueID(), queue_name);
+ log->Printf ("SBThread(%p)::GetExtendedBacktraceThread() => new extended Thread created (%p) with queue_id 0x%" PRIx64 " queue name '%s'",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ static_cast<void*>(new_thread_sp.get()),
+ new_thread_sp->GetQueueID(),
+ queue_name);
}
}
}
@@ -1326,10 +1487,14 @@ SBThread::GetExtendedBacktraceThread (const char *type)
else
{
if (log)
- log->Printf ("SBThread(%p)::GetExtendedBacktraceThread() => error: process is running", exe_ctx.GetThreadPtr());
+ log->Printf ("SBThread(%p)::GetExtendedBacktraceThread() => error: process is running",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
+ if (log && sb_origin_thread.IsValid() == false)
+ log->Printf("SBThread(%p)::GetExtendedBacktraceThread() is not returning a Valid thread",
+ static_cast<void*>(exe_ctx.GetThreadPtr()));
return sb_origin_thread;
}
@@ -1341,3 +1506,12 @@ SBThread::GetExtendedBacktraceOriginatingIndexID ()
return thread_sp->GetExtendedBacktraceOriginatingIndexID();
return LLDB_INVALID_INDEX32;
}
+
+bool
+SBThread::SafeToCallFunctions ()
+{
+ ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
+ if (thread_sp)
+ return thread_sp->SafeToCallFunctions();
+ return true;
+}
diff --git a/source/API/SBType.cpp b/source/API/SBType.cpp
index 5ca7ddf3d813..064fb32c953f 100644
--- a/source/API/SBType.cpp
+++ b/source/API/SBType.cpp
@@ -9,6 +9,7 @@
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBType.h"
+#include "lldb/API/SBTypeEnumMember.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Log.h"
@@ -17,6 +18,8 @@
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Symbol/Type.h"
+#include "clang/AST/Decl.h"
+
using namespace lldb;
using namespace lldb_private;
using namespace clang;
@@ -364,6 +367,27 @@ SBType::GetVirtualBaseClassAtIndex (uint32_t idx)
return sb_type_member;
}
+SBTypeEnumMemberList
+SBType::GetEnumMembers ()
+{
+ SBTypeEnumMemberList sb_enum_member_list;
+ if (IsValid())
+ {
+ const clang::EnumDecl *enum_decl = m_opaque_sp->GetClangASTType(true).GetFullyUnqualifiedType().GetAsEnumDecl();
+ if (enum_decl)
+ {
+ clang::EnumDecl::enumerator_iterator enum_pos, enum_end_pos;
+ for (enum_pos = enum_decl->enumerator_begin(), enum_end_pos = enum_decl->enumerator_end(); enum_pos != enum_end_pos; ++enum_pos)
+ {
+ SBTypeEnumMember enum_member;
+ enum_member.reset(new TypeEnumMemberImpl(*enum_pos, ClangASTType(m_opaque_sp->GetClangASTContext(true), enum_decl->getIntegerType())));
+ sb_enum_member_list.Append(enum_member);
+ }
+ }
+ }
+ return sb_enum_member_list;
+}
+
SBTypeMember
SBType::GetFieldAtIndex (uint32_t idx)
{
@@ -414,6 +438,14 @@ SBType::GetName()
return m_opaque_sp->GetName().GetCString();
}
+const char *
+SBType::GetDisplayTypeName ()
+{
+ if (!IsValid())
+ return "";
+ return m_opaque_sp->GetDisplayTypeName().GetCString();
+}
+
lldb::TypeClass
SBType::GetTypeClass ()
{
diff --git a/source/API/SBTypeEnumMember.cpp b/source/API/SBTypeEnumMember.cpp
new file mode 100644
index 000000000000..47c57dd213fb
--- /dev/null
+++ b/source/API/SBTypeEnumMember.cpp
@@ -0,0 +1,192 @@
+//===-- SBTypeEnumMember.cpp ---------------------------------- -*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/API/SBDefines.h"
+#include "lldb/API/SBType.h"
+#include "lldb/API/SBTypeEnumMember.h"
+#include "lldb/API/SBStream.h"
+#include "lldb/Core/Stream.h"
+#include "lldb/Symbol/ClangASTType.h"
+#include "lldb/Symbol/Type.h"
+
+using namespace lldb;
+using namespace lldb_private;
+using namespace clang;
+
+SBTypeEnumMember::SBTypeEnumMember() :
+ m_opaque_sp()
+{
+}
+
+SBTypeEnumMember::~SBTypeEnumMember()
+{
+}
+SBTypeEnumMember::SBTypeEnumMember (const lldb::TypeEnumMemberImplSP &enum_member_sp) :
+ m_opaque_sp(enum_member_sp)
+{
+}
+
+SBTypeEnumMember::SBTypeEnumMember (const SBTypeEnumMember& rhs) :
+ m_opaque_sp()
+{
+ if (this != &rhs)
+ {
+ if (rhs.IsValid())
+ m_opaque_sp.reset(new TypeEnumMemberImpl(rhs.ref()));
+ }
+}
+
+SBTypeEnumMember&
+SBTypeEnumMember::operator = (const SBTypeEnumMember& rhs)
+{
+ if (this != &rhs)
+ {
+ if (rhs.IsValid())
+ m_opaque_sp.reset(new TypeEnumMemberImpl(rhs.ref()));
+ }
+ return *this;
+}
+
+bool
+SBTypeEnumMember::IsValid() const
+{
+ return m_opaque_sp.get();
+}
+
+const char *
+SBTypeEnumMember::GetName ()
+{
+ if (m_opaque_sp.get())
+ return m_opaque_sp->GetName().GetCString();
+ return NULL;
+}
+
+int64_t
+SBTypeEnumMember::GetValueAsSigned()
+{
+ if (m_opaque_sp.get())
+ return m_opaque_sp->GetValueAsSigned();
+ return 0;
+}
+
+uint64_t
+SBTypeEnumMember::GetValueAsUnsigned()
+{
+ if (m_opaque_sp.get())
+ return m_opaque_sp->GetValueAsUnsigned();
+ return 0;
+}
+
+SBType
+SBTypeEnumMember::GetType ()
+{
+ SBType sb_type;
+ if (m_opaque_sp.get())
+ {
+ sb_type.SetSP(m_opaque_sp->GetIntegerType());
+ }
+ return sb_type;
+
+}
+
+void
+SBTypeEnumMember::reset(TypeEnumMemberImpl *type_member_impl)
+{
+ m_opaque_sp.reset(type_member_impl);
+}
+
+TypeEnumMemberImpl &
+SBTypeEnumMember::ref ()
+{
+ if (m_opaque_sp.get() == NULL)
+ m_opaque_sp.reset (new TypeEnumMemberImpl());
+ return *m_opaque_sp.get();
+}
+
+const TypeEnumMemberImpl &
+SBTypeEnumMember::ref () const
+{
+ return *m_opaque_sp.get();
+}
+
+
+SBTypeEnumMemberList::SBTypeEnumMemberList() :
+ m_opaque_ap(new TypeEnumMemberListImpl())
+{
+}
+
+SBTypeEnumMemberList::SBTypeEnumMemberList(const SBTypeEnumMemberList& rhs) :
+ m_opaque_ap(new TypeEnumMemberListImpl())
+{
+ for (uint32_t i = 0, rhs_size = const_cast<SBTypeEnumMemberList&>(rhs).GetSize(); i < rhs_size; i++)
+ Append(const_cast<SBTypeEnumMemberList&>(rhs).GetTypeEnumMemberAtIndex(i));
+}
+
+bool
+SBTypeEnumMemberList::IsValid ()
+{
+ return (m_opaque_ap.get() != NULL);
+}
+
+SBTypeEnumMemberList&
+SBTypeEnumMemberList::operator = (const SBTypeEnumMemberList& rhs)
+{
+ if (this != &rhs)
+ {
+ m_opaque_ap.reset (new TypeEnumMemberListImpl());
+ for (uint32_t i = 0, rhs_size = const_cast<SBTypeEnumMemberList&>(rhs).GetSize(); i < rhs_size; i++)
+ Append(const_cast<SBTypeEnumMemberList&>(rhs).GetTypeEnumMemberAtIndex(i));
+ }
+ return *this;
+}
+
+void
+SBTypeEnumMemberList::Append (SBTypeEnumMember enum_member)
+{
+ if (enum_member.IsValid())
+ m_opaque_ap->Append (enum_member.m_opaque_sp);
+}
+
+SBTypeEnumMember
+SBTypeEnumMemberList::GetTypeEnumMemberAtIndex(uint32_t index)
+{
+ if (m_opaque_ap.get())
+ return SBTypeEnumMember(m_opaque_ap->GetTypeEnumMemberAtIndex(index));
+ return SBTypeEnumMember();
+}
+
+uint32_t
+SBTypeEnumMemberList::GetSize()
+{
+ return m_opaque_ap->GetSize();
+}
+
+SBTypeEnumMemberList::~SBTypeEnumMemberList()
+{
+}
+
+bool
+SBTypeEnumMember::GetDescription (lldb::SBStream &description,
+ lldb::DescriptionLevel description_level)
+{
+ Stream &strm = description.ref();
+
+ if (m_opaque_sp.get())
+ {
+ if( m_opaque_sp->GetIntegerType()->GetDescription(strm, description_level) )
+ {
+ strm.Printf(" %s", m_opaque_sp->GetName().GetCString());
+ }
+ }
+ else
+ {
+ strm.PutCString ("No value");
+ }
+ return true;
+}
diff --git a/source/API/SBUnixSignals.cpp b/source/API/SBUnixSignals.cpp
new file mode 100644
index 000000000000..ca321d82fd60
--- /dev/null
+++ b/source/API/SBUnixSignals.cpp
@@ -0,0 +1,199 @@
+//===-- SBUnixSignals.cpp -------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/lldb-defines.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Target/UnixSignals.h"
+#include "lldb/Core/Log.h"
+
+#include "lldb/API/SBUnixSignals.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+SBUnixSignals::SBUnixSignals ()
+{}
+
+SBUnixSignals::SBUnixSignals (const SBUnixSignals &rhs) :
+ m_opaque_wp(rhs.m_opaque_wp)
+{
+}
+
+SBUnixSignals::SBUnixSignals (ProcessSP &process_sp) :
+ m_opaque_wp(process_sp)
+{
+}
+
+const SBUnixSignals&
+SBUnixSignals::operator = (const SBUnixSignals& rhs)
+{
+ if (this != &rhs)
+ m_opaque_wp = rhs.m_opaque_wp;
+ return *this;
+}
+
+SBUnixSignals::~SBUnixSignals()
+{
+}
+
+ProcessSP
+SBUnixSignals::GetSP() const
+{
+ return m_opaque_wp.lock();
+}
+
+void
+SBUnixSignals::SetSP (const ProcessSP &process_sp)
+{
+ m_opaque_wp = process_sp;
+}
+
+void
+SBUnixSignals::Clear ()
+{
+ m_opaque_wp.reset();
+}
+
+bool
+SBUnixSignals::IsValid() const
+{
+ return (bool) GetSP();
+}
+
+const char *
+SBUnixSignals::GetSignalAsCString (int32_t signo) const
+{
+ ProcessSP process_sp(GetSP());
+ if (process_sp) return process_sp->GetUnixSignals().GetSignalAsCString(signo);
+ return NULL;
+}
+
+int32_t
+SBUnixSignals::GetSignalNumberFromName (const char *name) const
+{
+ ProcessSP process_sp(GetSP());
+ if (process_sp) return process_sp->GetUnixSignals().GetSignalNumberFromName(name);
+ return -1;
+}
+
+bool
+SBUnixSignals::GetShouldSuppress (int32_t signo) const
+{
+ ProcessSP process_sp(GetSP());
+ if (process_sp) return process_sp->GetUnixSignals().GetShouldSuppress(signo);
+ return false;
+}
+
+bool
+SBUnixSignals::SetShouldSuppress (int32_t signo, bool value)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ ProcessSP process_sp(GetSP());
+
+ if (log)
+ {
+ log->Printf ("SBUnixSignals(%p)::SetShouldSuppress (signo=%d, value=%d)",
+ static_cast<void*>(process_sp.get()),
+ signo,
+ value);
+ }
+
+ if (process_sp) return process_sp->GetUnixSignals().SetShouldSuppress(signo, value);
+ return false;
+}
+
+bool
+SBUnixSignals::GetShouldStop (int32_t signo) const
+{
+ ProcessSP process_sp(GetSP());
+ if (process_sp) return process_sp->GetUnixSignals().GetShouldStop(signo);
+ return false;
+}
+
+bool
+SBUnixSignals::SetShouldStop (int32_t signo, bool value)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ ProcessSP process_sp(GetSP());
+
+ if (log)
+ {
+ log->Printf ("SBUnixSignals(%p)::SetShouldStop (signo=%d, value=%d)",
+ static_cast<void*>(process_sp.get()),
+ signo,
+ value);
+ }
+
+ if (process_sp) return process_sp->GetUnixSignals().SetShouldStop(signo, value);
+ return false;
+}
+
+bool
+SBUnixSignals::GetShouldNotify (int32_t signo) const
+{
+ ProcessSP process_sp(GetSP());
+ if (process_sp) return process_sp->GetUnixSignals().GetShouldNotify(signo);
+ return false;
+}
+
+bool
+SBUnixSignals::SetShouldNotify (int32_t signo, bool value)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ ProcessSP process_sp(GetSP());
+
+ if (log)
+ {
+ log->Printf ("SBUnixSignals(%p)::SetShouldNotify (signo=%d, value=%d)",
+ static_cast<void*>(process_sp.get()),
+ signo,
+ value);
+ }
+
+ if (process_sp) return process_sp->GetUnixSignals().SetShouldNotify(signo, value);
+ return false;
+}
+
+int32_t
+SBUnixSignals::GetNumSignals () const
+{
+ if (auto process_sp = GetSP())
+ {
+ // only valid while we hold process_sp
+ UnixSignals *unix_signals_ptr = &process_sp->GetUnixSignals();
+ int32_t num_signals = 0;
+ for (int32_t signo = unix_signals_ptr->GetFirstSignalNumber();
+ signo != LLDB_INVALID_SIGNAL_NUMBER;
+ signo = unix_signals_ptr->GetNextSignalNumber(signo))
+ {
+ num_signals++;
+ }
+ return num_signals;
+ }
+ return LLDB_INVALID_SIGNAL_NUMBER;
+}
+
+int32_t
+SBUnixSignals::GetSignalAtIndex (int32_t index) const
+{
+ if (auto process_sp = GetSP())
+ {
+ // only valid while we hold process_sp
+ UnixSignals *unix_signals_ptr = &process_sp->GetUnixSignals();
+ int32_t idx = 0;
+ for (int32_t signo = unix_signals_ptr->GetFirstSignalNumber();
+ signo != LLDB_INVALID_SIGNAL_NUMBER;
+ signo = unix_signals_ptr->GetNextSignalNumber(signo))
+ {
+ if (index == idx) return signo;
+ idx++;
+ }
+ }
+ return LLDB_INVALID_SIGNAL_NUMBER;
+}
diff --git a/source/API/SBValue.cpp b/source/API/SBValue.cpp
index 4bd018352ff2..3a9621b1e3bc 100644
--- a/source/API/SBValue.cpp
+++ b/source/API/SBValue.cpp
@@ -58,7 +58,7 @@ public:
ValueImpl ()
{
}
-
+
ValueImpl (lldb::ValueObjectSP in_valobj_sp,
lldb::DynamicValueType use_dynamic,
bool use_synthetic,
@@ -71,7 +71,7 @@ public:
if (!m_name.IsEmpty() && m_valobj_sp)
m_valobj_sp->SetName(m_name);
}
-
+
ValueImpl (const ValueImpl& rhs) :
m_valobj_sp(rhs.m_valobj_sp),
m_use_dynamic(rhs.m_use_dynamic),
@@ -79,7 +79,7 @@ public:
m_name (rhs.m_name)
{
}
-
+
ValueImpl &
operator = (const ValueImpl &rhs)
{
@@ -92,7 +92,7 @@ public:
}
return *this;
}
-
+
bool
IsValid ()
{
@@ -115,13 +115,13 @@ public:
return false;
}
}
-
+
lldb::ValueObjectSP
GetRootSP ()
{
return m_valobj_sp;
}
-
+
lldb::ValueObjectSP
GetSP (Process::StopLocker &stop_locker, Mutex::Locker &api_locker, Error &error)
{
@@ -131,26 +131,27 @@ public:
error.SetErrorString("invalid value object");
return m_valobj_sp;
}
-
+
lldb::ValueObjectSP value_sp = m_valobj_sp;
-
+
Target *target = value_sp->GetTargetSP().get();
if (target)
api_locker.Lock(target->GetAPIMutex());
else
return ValueObjectSP();
-
+
ProcessSP process_sp(value_sp->GetProcessSP());
if (process_sp && !stop_locker.TryLock (&process_sp->GetRunLock()))
{
// We don't allow people to play around with ValueObject if the process is running.
// If you want to look at values, pause the process, then look.
if (log)
- log->Printf ("SBValue(%p)::GetSP() => error: process is running", value_sp.get());
+ log->Printf ("SBValue(%p)::GetSP() => error: process is running",
+ static_cast<void*>(value_sp.get()));
error.SetErrorString ("process must be stopped.");
return ValueObjectSP();
}
-
+
if (value_sp->GetDynamicValue(m_use_dynamic))
value_sp = value_sp->GetDynamicValue(m_use_dynamic);
if (value_sp->GetSyntheticValue(m_use_synthetic))
@@ -159,34 +160,34 @@ public:
error.SetErrorString("invalid value object");
if (!m_name.IsEmpty())
value_sp->SetName(m_name);
-
+
return value_sp;
}
-
+
void
SetUseDynamic (lldb::DynamicValueType use_dynamic)
{
m_use_dynamic = use_dynamic;
}
-
+
void
SetUseSynthetic (bool use_synthetic)
{
m_use_synthetic = use_synthetic;
}
-
+
lldb::DynamicValueType
GetUseDynamic ()
{
return m_use_dynamic;
}
-
+
bool
GetUseSynthetic ()
{
return m_use_synthetic;
}
-
+
// All the derived values that we would make from the m_valobj_sp will share
// the ExecutionContext with m_valobj_sp, so we don't need to do the calculations
// in GetSP to return the Target, Process, Thread or Frame. It is convenient to
@@ -199,7 +200,7 @@ public:
else
return TargetSP();
}
-
+
ProcessSP
GetProcessSP ()
{
@@ -208,7 +209,7 @@ public:
else
return ProcessSP();
}
-
+
ThreadSP
GetThreadSP ()
{
@@ -217,7 +218,7 @@ public:
else
return ThreadSP();
}
-
+
StackFrameSP
GetFrameSP ()
{
@@ -226,7 +227,7 @@ public:
else
return StackFrameSP();
}
-
+
private:
lldb::ValueObjectSP m_valobj_sp;
lldb::DynamicValueType m_use_dynamic;
@@ -337,16 +338,18 @@ SBValue::GetName()
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
name = value_sp->GetName().GetCString();
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (name)
- log->Printf ("SBValue(%p)::GetName () => \"%s\"", value_sp.get(), name);
+ log->Printf ("SBValue(%p)::GetName () => \"%s\"",
+ static_cast<void*>(value_sp.get()), name);
else
- log->Printf ("SBValue(%p)::GetName () => NULL", value_sp.get());
+ log->Printf ("SBValue(%p)::GetName () => NULL",
+ static_cast<void*>(value_sp.get()));
}
-
+
return name;
}
@@ -361,13 +364,40 @@ SBValue::GetTypeName ()
{
name = value_sp->GetQualifiedTypeName().GetCString();
}
+
+ if (log)
+ {
+ if (name)
+ log->Printf ("SBValue(%p)::GetTypeName () => \"%s\"",
+ static_cast<void*>(value_sp.get()), name);
+ else
+ log->Printf ("SBValue(%p)::GetTypeName () => NULL",
+ static_cast<void*>(value_sp.get()));
+ }
+
+ return name;
+}
+
+const char *
+SBValue::GetDisplayTypeName ()
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ const char *name = NULL;
+ ValueLocker locker;
+ lldb::ValueObjectSP value_sp(GetSP(locker));
+ if (value_sp)
+ {
+ name = value_sp->GetDisplayTypeName().GetCString();
+ }
if (log)
{
if (name)
- log->Printf ("SBValue(%p)::GetTypeName () => \"%s\"", value_sp.get(), name);
+ log->Printf ("SBValue(%p)::GetTypeName () => \"%s\"",
+ static_cast<void*>(value_sp.get()), name);
else
- log->Printf ("SBValue(%p)::GetTypeName () => NULL", value_sp.get());
+ log->Printf ("SBValue(%p)::GetTypeName () => NULL",
+ static_cast<void*>(value_sp.get()));
}
return name;
@@ -378,17 +408,19 @@ SBValue::GetByteSize ()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
size_t result = 0;
-
+
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
{
result = value_sp->GetByteSize();
}
-
+
if (log)
- log->Printf ("SBValue(%p)::GetByteSize () => %" PRIu64, value_sp.get(), (uint64_t)result);
-
+ log->Printf ("SBValue(%p)::GetByteSize () => %" PRIu64,
+ static_cast<void*>(value_sp.get()),
+ static_cast<uint64_t>(result));
+
return result;
}
@@ -396,18 +428,19 @@ bool
SBValue::IsInScope ()
{
bool result = false;
-
+
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
{
result = value_sp->IsInScope ();
}
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::IsInScope () => %i", value_sp.get(), result);
-
+ log->Printf ("SBValue(%p)::IsInScope () => %i",
+ static_cast<void*>(value_sp.get()), result);
+
return result;
}
@@ -415,7 +448,7 @@ const char *
SBValue::GetValue ()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
const char *cstr = NULL;
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
@@ -426,11 +459,13 @@ SBValue::GetValue ()
if (log)
{
if (cstr)
- log->Printf ("SBValue(%p)::GetValue() => \"%s\"", value_sp.get(), cstr);
+ log->Printf ("SBValue(%p)::GetValue() => \"%s\"",
+ static_cast<void*>(value_sp.get()), cstr);
else
- log->Printf ("SBValue(%p)::GetValue() => NULL", value_sp.get());
+ log->Printf ("SBValue(%p)::GetValue() => NULL",
+ static_cast<void*>(value_sp.get()));
}
-
+
return cstr;
}
@@ -442,20 +477,44 @@ SBValue::GetValueType ()
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
result = value_sp->GetValueType();
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
switch (result)
{
- case eValueTypeInvalid: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeInvalid", value_sp.get()); break;
- case eValueTypeVariableGlobal: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableGlobal", value_sp.get()); break;
- case eValueTypeVariableStatic: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableStatic", value_sp.get()); break;
- case eValueTypeVariableArgument:log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableArgument", value_sp.get()); break;
- case eValueTypeVariableLocal: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableLocal", value_sp.get()); break;
- case eValueTypeRegister: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegister", value_sp.get()); break;
- case eValueTypeRegisterSet: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegisterSet", value_sp.get()); break;
- case eValueTypeConstResult: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeConstResult", value_sp.get()); break;
+ case eValueTypeInvalid:
+ log->Printf ("SBValue(%p)::GetValueType () => eValueTypeInvalid",
+ static_cast<void*>(value_sp.get()));
+ break;
+ case eValueTypeVariableGlobal:
+ log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableGlobal",
+ static_cast<void*>(value_sp.get()));
+ break;
+ case eValueTypeVariableStatic:
+ log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableStatic",
+ static_cast<void*>(value_sp.get()));
+ break;
+ case eValueTypeVariableArgument:
+ log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableArgument",
+ static_cast<void*>(value_sp.get()));
+ break;
+ case eValueTypeVariableLocal:
+ log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableLocal",
+ static_cast<void*>(value_sp.get()));
+ break;
+ case eValueTypeRegister:
+ log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegister",
+ static_cast<void*>(value_sp.get()));
+ break;
+ case eValueTypeRegisterSet:
+ log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegisterSet",
+ static_cast<void*>(value_sp.get()));
+ break;
+ case eValueTypeConstResult:
+ log->Printf ("SBValue(%p)::GetValueType () => eValueTypeConstResult",
+ static_cast<void*>(value_sp.get()));
+ break;
}
}
return result;
@@ -475,9 +534,11 @@ SBValue::GetObjectDescription ()
if (log)
{
if (cstr)
- log->Printf ("SBValue(%p)::GetObjectDescription() => \"%s\"", value_sp.get(), cstr);
+ log->Printf ("SBValue(%p)::GetObjectDescription() => \"%s\"",
+ static_cast<void*>(value_sp.get()), cstr);
else
- log->Printf ("SBValue(%p)::GetObjectDescription() => NULL", value_sp.get());
+ log->Printf ("SBValue(%p)::GetObjectDescription() => NULL",
+ static_cast<void*>(value_sp.get()));
}
return cstr;
}
@@ -498,9 +559,12 @@ SBValue::GetType()
if (log)
{
if (type_sp)
- log->Printf ("SBValue(%p)::GetType => SBType(%p)", value_sp.get(), type_sp.get());
+ log->Printf ("SBValue(%p)::GetType => SBType(%p)",
+ static_cast<void*>(value_sp.get()),
+ static_cast<void*>(type_sp.get()));
else
- log->Printf ("SBValue(%p)::GetType => NULL", value_sp.get());
+ log->Printf ("SBValue(%p)::GetType => NULL",
+ static_cast<void*>(value_sp.get()));
}
return sb_type;
}
@@ -517,8 +581,9 @@ SBValue::GetValueDidChange ()
result = value_sp->GetValueDidChange ();
}
if (log)
- log->Printf ("SBValue(%p)::GetValueDidChange() => %i", value_sp.get(), result);
-
+ log->Printf ("SBValue(%p)::GetValueDidChange() => %i",
+ static_cast<void*>(value_sp.get()), result);
+
return result;
}
@@ -537,9 +602,11 @@ SBValue::GetSummary ()
if (log)
{
if (cstr)
- log->Printf ("SBValue(%p)::GetSummary() => \"%s\"", value_sp.get(), cstr);
+ log->Printf ("SBValue(%p)::GetSummary() => \"%s\"",
+ static_cast<void*>(value_sp.get()), cstr);
else
- log->Printf ("SBValue(%p)::GetSummary() => NULL", value_sp.get());
+ log->Printf ("SBValue(%p)::GetSummary() => NULL",
+ static_cast<void*>(value_sp.get()));
}
return cstr;
}
@@ -559,9 +626,11 @@ SBValue::GetLocation ()
if (log)
{
if (cstr)
- log->Printf ("SBValue(%p)::GetLocation() => \"%s\"", value_sp.get(), cstr);
+ log->Printf ("SBValue(%p)::GetLocation() => \"%s\"",
+ static_cast<void*>(value_sp.get()), cstr);
else
- log->Printf ("SBValue(%p)::GetLocation() => NULL", value_sp.get());
+ log->Printf ("SBValue(%p)::GetLocation() => NULL",
+ static_cast<void*>(value_sp.get()));
}
return cstr;
}
@@ -587,10 +656,11 @@ SBValue::SetValueFromCString (const char *value_str, lldb::SBError& error)
}
else
error.SetErrorStringWithFormat ("Could not get value: %s", locker.GetError().AsCString());
-
+
if (log)
- log->Printf ("SBValue(%p)::SetValueFromCString(\"%s\") => %i", value_sp.get(), value_str, success);
-
+ log->Printf ("SBValue(%p)::SetValueFromCString(\"%s\") => %i",
+ static_cast<void*>(value_sp.get()), value_str, success);
+
return success;
}
@@ -698,11 +768,11 @@ SBValue::CreateChildAtOffset (const char *name, uint32_t offset, SBType type)
{
if (new_value_sp)
log->Printf ("SBValue(%p)::CreateChildAtOffset => \"%s\"",
- value_sp.get(),
+ static_cast<void*>(value_sp.get()),
new_value_sp->GetName().AsCString());
else
log->Printf ("SBValue(%p)::CreateChildAtOffset => NULL",
- value_sp.get());
+ static_cast<void*>(value_sp.get()));
}
return sb_value;
}
@@ -757,15 +827,11 @@ SBValue::CreateValueFromExpression (const char *name, const char *expression, SB
{
if (new_value_sp)
log->Printf ("SBValue(%p)::CreateValueFromExpression(name=\"%s\", expression=\"%s\") => SBValue (%p)",
- value_sp.get(),
- name,
- expression,
- new_value_sp.get());
+ static_cast<void*>(value_sp.get()), name, expression,
+ static_cast<void*>(new_value_sp.get()));
else
log->Printf ("SBValue(%p)::CreateValueFromExpression(name=\"%s\", expression=\"%s\") => NULL",
- value_sp.get(),
- name,
- expression);
+ static_cast<void*>(value_sp.get()), name, expression);
}
return sb_value;
}
@@ -784,7 +850,7 @@ SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, SBType s
if (pointer_ast_type)
{
lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t)));
-
+
ExecutionContext exe_ctx (value_sp->GetExecutionContextRef());
ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
pointer_ast_type,
@@ -792,7 +858,7 @@ SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, SBType s
buffer,
exe_ctx.GetByteOrder(),
exe_ctx.GetAddressByteSize()));
-
+
if (ptr_result_valobj_sp)
{
ptr_result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress);
@@ -808,9 +874,12 @@ SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, SBType s
if (log)
{
if (new_value_sp)
- log->Printf ("SBValue(%p)::CreateValueFromAddress => \"%s\"", value_sp.get(), new_value_sp->GetName().AsCString());
+ log->Printf ("SBValue(%p)::CreateValueFromAddress => \"%s\"",
+ static_cast<void*>(value_sp.get()),
+ new_value_sp->GetName().AsCString());
else
- log->Printf ("SBValue(%p)::CreateValueFromAddress => NULL", value_sp.get());
+ log->Printf ("SBValue(%p)::CreateValueFromAddress => NULL",
+ static_cast<void*>(value_sp.get()));
}
return sb_value;
}
@@ -825,7 +894,7 @@ SBValue::CreateValueFromData (const char* name, SBData data, SBType type)
if (value_sp)
{
ExecutionContext exe_ctx (value_sp->GetExecutionContextRef());
-
+
new_value_sp = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
type.m_opaque_sp->GetClangASTType(false),
ConstString(name),
@@ -838,9 +907,12 @@ SBValue::CreateValueFromData (const char* name, SBData data, SBType type)
if (log)
{
if (new_value_sp)
- log->Printf ("SBValue(%p)::CreateValueFromData => \"%s\"", value_sp.get(), new_value_sp->GetName().AsCString());
+ log->Printf ("SBValue(%p)::CreateValueFromData => \"%s\"",
+ static_cast<void*>(value_sp.get()),
+ new_value_sp->GetName().AsCString());
else
- log->Printf ("SBValue(%p)::CreateValueFromData => NULL", value_sp.get());
+ log->Printf ("SBValue(%p)::CreateValueFromData => NULL",
+ static_cast<void*>(value_sp.get()));
}
return sb_value;
}
@@ -865,7 +937,7 @@ SBValue::GetChildAtIndex (uint32_t idx, lldb::DynamicValueType use_dynamic, bool
{
lldb::ValueObjectSP child_sp;
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
@@ -884,12 +956,14 @@ SBValue::GetChildAtIndex (uint32_t idx, lldb::DynamicValueType use_dynamic, bool
}
}
}
-
+
SBValue sb_value;
sb_value.SetSP (child_sp, use_dynamic, GetPreferSyntheticValue());
if (log)
- log->Printf ("SBValue(%p)::GetChildAtIndex (%u) => SBValue(%p)", value_sp.get(), idx, value_sp.get());
-
+ log->Printf ("SBValue(%p)::GetChildAtIndex (%u) => SBValue(%p)",
+ static_cast<void*>(value_sp.get()), idx,
+ static_cast<void*>(value_sp.get()));
+
return sb_value;
}
@@ -907,9 +981,11 @@ SBValue::GetIndexOfChildWithName (const char *name)
if (log)
{
if (idx == UINT32_MAX)
- log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => NOT FOUND", value_sp.get(), name);
+ log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => NOT FOUND",
+ static_cast<void*>(value_sp.get()), name);
else
- log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => %u", value_sp.get(), name, idx);
+ log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => %u",
+ static_cast<void*>(value_sp.get()), name, idx);
}
return idx;
}
@@ -921,7 +997,7 @@ SBValue::GetChildMemberWithName (const char *name)
TargetSP target_sp;
if (m_opaque_sp)
target_sp = m_opaque_sp->GetTargetSP();
-
+
if (target_sp)
use_dynamic_value = target_sp->GetPreferDynamicValue();
return GetChildMemberWithName (name, use_dynamic_value);
@@ -932,22 +1008,24 @@ SBValue::GetChildMemberWithName (const char *name, lldb::DynamicValueType use_dy
{
lldb::ValueObjectSP child_sp;
const ConstString str_name (name);
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
-
+
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
{
child_sp = value_sp->GetChildMemberWithName (str_name, true);
}
-
+
SBValue sb_value;
sb_value.SetSP(child_sp, use_dynamic_value, GetPreferSyntheticValue());
-
+
if (log)
- log->Printf ("SBValue(%p)::GetChildMemberWithName (name=\"%s\") => SBValue(%p)", value_sp.get(), name, value_sp.get());
-
+ log->Printf ("SBValue(%p)::GetChildMemberWithName (name=\"%s\") => SBValue(%p)",
+ static_cast<void*>(value_sp.get()), name,
+ static_cast<void*>(value_sp.get()));
+
return sb_value;
}
@@ -1049,13 +1127,15 @@ SBValue::GetValueForExpressionPath(const char* expr_path)
// using default values for all the fancy options, just do it if you can
child_sp = value_sp->GetValueForExpressionPath(expr_path);
}
-
+
SBValue sb_value;
sb_value.SetSP(child_sp,GetPreferDynamicValue(),GetPreferSyntheticValue());
-
+
if (log)
- log->Printf ("SBValue(%p)::GetValueForExpressionPath (expr_path=\"%s\") => SBValue(%p)", value_sp.get(), expr_path, value_sp.get());
-
+ log->Printf ("SBValue(%p)::GetValueForExpressionPath (expr_path=\"%s\") => SBValue(%p)",
+ static_cast<void*>(value_sp.get()), expr_path,
+ static_cast<void*>(value_sp.get()));
+
return sb_value;
}
@@ -1134,9 +1214,10 @@ SBValue::MightHaveChildren ()
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
has_children = value_sp->MightHaveChildren();
-
+
if (log)
- log->Printf ("SBValue(%p)::MightHaveChildren() => %i", value_sp.get(), has_children);
+ log->Printf ("SBValue(%p)::MightHaveChildren() => %i",
+ static_cast<void*>(value_sp.get()), has_children);
return has_children;
}
@@ -1144,16 +1225,17 @@ uint32_t
SBValue::GetNumChildren ()
{
uint32_t num_children = 0;
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
num_children = value_sp->GetNumChildren();
-
+
if (log)
- log->Printf ("SBValue(%p)::GetNumChildren () => %u", value_sp.get(), num_children);
-
+ log->Printf ("SBValue(%p)::GetNumChildren () => %u",
+ static_cast<void*>(value_sp.get()), num_children);
+
return num_children;
}
@@ -1171,8 +1253,10 @@ SBValue::Dereference ()
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::Dereference () => SBValue(%p)", value_sp.get(), value_sp.get());
-
+ log->Printf ("SBValue(%p)::Dereference () => SBValue(%p)",
+ static_cast<void*>(value_sp.get()),
+ static_cast<void*>(value_sp.get()));
+
return sb_value;
}
@@ -1180,17 +1264,17 @@ bool
SBValue::TypeIsPointerType ()
{
bool is_ptr_type = false;
-
+
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
is_ptr_type = value_sp->IsPointerType();
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::TypeIsPointerType () => %i", value_sp.get(), is_ptr_type);
-
-
+ log->Printf ("SBValue(%p)::TypeIsPointerType () => %i",
+ static_cast<void*>(value_sp.get()), is_ptr_type);
+
return is_ptr_type;
}
@@ -1218,9 +1302,12 @@ SBValue::GetTarget()
if (log)
{
if (target_sp.get() == NULL)
- log->Printf ("SBValue(%p)::GetTarget () => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::GetTarget () => NULL",
+ static_cast<void*>(m_opaque_sp.get()));
else
- log->Printf ("SBValue(%p)::GetTarget () => %p", m_opaque_sp.get(), target_sp.get());
+ log->Printf ("SBValue(%p)::GetTarget () => %p",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(target_sp.get()));
}
return sb_target;
}
@@ -1239,9 +1326,12 @@ SBValue::GetProcess()
if (log)
{
if (process_sp.get() == NULL)
- log->Printf ("SBValue(%p)::GetProcess () => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::GetProcess () => NULL",
+ static_cast<void*>(m_opaque_sp.get()));
else
- log->Printf ("SBValue(%p)::GetProcess () => %p", m_opaque_sp.get(), process_sp.get());
+ log->Printf ("SBValue(%p)::GetProcess () => %p",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(process_sp.get()));
}
return sb_process;
}
@@ -1260,9 +1350,12 @@ SBValue::GetThread()
if (log)
{
if (thread_sp.get() == NULL)
- log->Printf ("SBValue(%p)::GetThread () => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::GetThread () => NULL",
+ static_cast<void*>(m_opaque_sp.get()));
else
- log->Printf ("SBValue(%p)::GetThread () => %p", m_opaque_sp.get(), thread_sp.get());
+ log->Printf ("SBValue(%p)::GetThread () => %p",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(thread_sp.get()));
}
return sb_thread;
}
@@ -1281,9 +1374,12 @@ SBValue::GetFrame()
if (log)
{
if (frame_sp.get() == NULL)
- log->Printf ("SBValue(%p)::GetFrame () => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::GetFrame () => NULL",
+ static_cast<void*>(m_opaque_sp.get()));
else
- log->Printf ("SBValue(%p)::GetFrame () => %p", m_opaque_sp.get(), frame_sp.get());
+ log->Printf ("SBValue(%p)::GetFrame () => %p",
+ static_cast<void*>(m_opaque_sp.get()),
+ static_cast<void*>(frame_sp.get()));
}
return sb_frame;
}
@@ -1450,8 +1546,10 @@ SBValue::AddressOf()
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::AddressOf () => SBValue(%p)", value_sp.get(), value_sp.get());
-
+ log->Printf ("SBValue(%p)::AddressOf () => SBValue(%p)",
+ static_cast<void*>(value_sp.get()),
+ static_cast<void*>(value_sp.get()));
+
return sb_value;
}
@@ -1487,8 +1585,9 @@ SBValue::GetLoadAddress()
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::GetLoadAddress () => (%" PRIu64 ")", value_sp.get(), value);
-
+ log->Printf ("SBValue(%p)::GetLoadAddress () => (%" PRIu64 ")",
+ static_cast<void*>(value_sp.get()), value);
+
return value;
}
@@ -1524,8 +1623,11 @@ SBValue::GetAddress()
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::GetAddress () => (%s,%" PRIu64 ")", value_sp.get(),
- (addr.GetSection() ? addr.GetSection()->GetName().GetCString() : "NULL"),
+ log->Printf ("SBValue(%p)::GetAddress () => (%s,%" PRIu64 ")",
+ static_cast<void*>(value_sp.get()),
+ (addr.GetSection()
+ ? addr.GetSection()->GetName().GetCString()
+ : "NULL"),
addr.GetOffset());
return SBAddress(new Address(addr));
}
@@ -1551,11 +1653,9 @@ SBValue::GetPointeeData (uint32_t item_idx,
}
if (log)
log->Printf ("SBValue(%p)::GetPointeeData (%d, %d) => SBData(%p)",
- value_sp.get(),
- item_idx,
- item_count,
- sb_data.get());
-
+ static_cast<void*>(value_sp.get()), item_idx, item_count,
+ static_cast<void*>(sb_data.get()));
+
return sb_data;
}
@@ -1569,15 +1669,16 @@ SBValue::GetData ()
if (value_sp)
{
DataExtractorSP data_sp(new DataExtractor());
- value_sp->GetData(*data_sp);
- if (data_sp->GetByteSize() > 0)
+ Error error;
+ value_sp->GetData(*data_sp, error);
+ if (error.Success())
*sb_data = data_sp;
}
if (log)
log->Printf ("SBValue(%p)::GetData () => SBData(%p)",
- value_sp.get(),
- sb_data.get());
-
+ static_cast<void*>(value_sp.get()),
+ static_cast<void*>(sb_data.get()));
+
return sb_data;
}
@@ -1588,25 +1689,26 @@ SBValue::SetData (lldb::SBData &data, SBError &error)
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
bool ret = true;
-
+
if (value_sp)
{
DataExtractor *data_extractor = data.get();
-
+
if (!data_extractor)
{
if (log)
- log->Printf ("SBValue(%p)::SetData() => error: no data to set", value_sp.get());
-
+ log->Printf ("SBValue(%p)::SetData() => error: no data to set",
+ static_cast<void*>(value_sp.get()));
+
error.SetErrorString("No data to set");
ret = false;
}
else
{
Error set_error;
-
+
value_sp->SetData(*data_extractor, set_error);
-
+
if (!set_error.Success())
{
error.SetErrorStringWithFormat("Couldn't set data: %s", set_error.AsCString());
@@ -1619,12 +1721,11 @@ SBValue::SetData (lldb::SBData &data, SBError &error)
error.SetErrorStringWithFormat ("Couldn't set data: could not get SBValue: %s", locker.GetError().AsCString());
ret = false;
}
-
+
if (log)
log->Printf ("SBValue(%p)::SetData (%p) => %s",
- value_sp.get(),
- data.get(),
- ret ? "true" : "false");
+ static_cast<void*>(value_sp.get()),
+ static_cast<void*>(data.get()), ret ? "true" : "false");
return ret;
}
@@ -1647,7 +1748,7 @@ lldb::SBWatchpoint
SBValue::Watch (bool resolve_location, bool read, bool write, SBError &error)
{
SBWatchpoint sb_watchpoint;
-
+
// If the SBValue is not valid, there's no point in even trying to watch it.
ValueLocker locker;
lldb::ValueObjectSP value_sp(GetSP(locker));
@@ -1657,29 +1758,29 @@ SBValue::Watch (bool resolve_location, bool read, bool write, SBError &error)
// Read and Write cannot both be false.
if (!read && !write)
return sb_watchpoint;
-
+
// If the value is not in scope, don't try and watch and invalid value
if (!IsInScope())
return sb_watchpoint;
-
+
addr_t addr = GetLoadAddress();
if (addr == LLDB_INVALID_ADDRESS)
return sb_watchpoint;
size_t byte_size = GetByteSize();
if (byte_size == 0)
return sb_watchpoint;
-
+
uint32_t watch_type = 0;
if (read)
watch_type |= LLDB_WATCH_TYPE_READ;
if (write)
watch_type |= LLDB_WATCH_TYPE_WRITE;
-
+
Error rc;
ClangASTType type (value_sp->GetClangType());
WatchpointSP watchpoint_sp = target_sp->CreateWatchpoint(addr, byte_size, &type, watch_type, rc);
error.SetError(rc);
-
+
if (watchpoint_sp)
{
sb_watchpoint.SetSP (watchpoint_sp);
@@ -1700,18 +1801,21 @@ SBValue::Watch (bool resolve_location, bool read, bool write, SBError &error)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::Watch() => error getting SBValue: %s", value_sp.get(), locker.GetError().AsCString());
-
+ log->Printf ("SBValue(%p)::Watch() => error getting SBValue: %s",
+ static_cast<void*>(value_sp.get()),
+ locker.GetError().AsCString());
+
error.SetErrorStringWithFormat("could not get SBValue: %s", locker.GetError().AsCString());
}
else
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::Watch() => error getting SBValue: no target", value_sp.get());
+ log->Printf ("SBValue(%p)::Watch() => error getting SBValue: no target",
+ static_cast<void*>(value_sp.get()));
error.SetErrorString("could not set watchpoint, a target is required");
}
-
+
return sb_watchpoint;
}
diff --git a/source/API/SBValueList.cpp b/source/API/SBValueList.cpp
index 46866eb37424..5069ed3f5624 100644
--- a/source/API/SBValueList.cpp
+++ b/source/API/SBValueList.cpp
@@ -99,8 +99,8 @@ SBValueList::SBValueList (const SBValueList &rhs) :
if (log)
{
log->Printf ("SBValueList::SBValueList (rhs.ap=%p) => this.ap = %p",
- (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL),
- m_opaque_ap.get());
+ static_cast<void*>(rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL),
+ static_cast<void*>(m_opaque_ap.get()));
}
}
@@ -114,9 +114,9 @@ SBValueList::SBValueList (const ValueListImpl *lldb_object_ptr) :
if (log)
{
- log->Printf ("SBValueList::SBValueList (lldb_object_ptr=%p) => this.ap = %p",
- lldb_object_ptr,
- m_opaque_ap.get());
+ log->Printf ("SBValueList::SBValueList (lldb_object_ptr=%p) => this.ap = %p",
+ static_cast<const void*>(lldb_object_ptr),
+ static_cast<void*>(m_opaque_ap.get()));
}
}
@@ -218,7 +218,8 @@ SBValueList::GetValueAtIndex (uint32_t idx) const
SBStream sstr;
sb_value.GetDescription (sstr);
log->Printf ("SBValueList::GetValueAtIndex (this.ap=%p, idx=%d) => SBValue (this.sp = %p, '%s')",
- m_opaque_ap.get(), idx, sb_value.GetSP().get(), sstr.GetData());
+ static_cast<void*>(m_opaque_ap.get()), idx,
+ static_cast<void*>(sb_value.GetSP().get()), sstr.GetData());
}
return sb_value;
@@ -237,7 +238,8 @@ SBValueList::GetSize () const
size = m_opaque_ap->GetSize();
if (log)
- log->Printf ("SBValueList::GetSize (this.ap=%p) => %d", m_opaque_ap.get(), size);
+ log->Printf ("SBValueList::GetSize (this.ap=%p) => %d",
+ static_cast<void*>(m_opaque_ap.get()), size);
return size;
}
diff --git a/source/API/SBWatchpoint.cpp b/source/API/SBWatchpoint.cpp
index 194695c31d5b..1a1a970aaa87 100644
--- a/source/API/SBWatchpoint.cpp
+++ b/source/API/SBWatchpoint.cpp
@@ -42,7 +42,9 @@ SBWatchpoint::SBWatchpoint (const lldb::WatchpointSP &wp_sp) :
SBStream sstr;
GetDescription (sstr, lldb::eDescriptionLevelBrief);
log->Printf ("SBWatchpoint::SBWatchpoint (const lldb::WatchpointSP &wp_sp"
- "=%p) => this.sp = %p (%s)", wp_sp.get(), m_opaque_sp.get(), sstr.GetData());
+ "=%p) => this.sp = %p (%s)",
+ static_cast<void*>(wp_sp.get()),
+ static_cast<void*>(m_opaque_sp.get()), sstr.GetData());
}
}
@@ -77,9 +79,11 @@ SBWatchpoint::GetID ()
if (log)
{
if (watch_id == LLDB_INVALID_WATCH_ID)
- log->Printf ("SBWatchpoint(%p)::GetID () => LLDB_INVALID_WATCH_ID", watchpoint_sp.get());
+ log->Printf ("SBWatchpoint(%p)::GetID () => LLDB_INVALID_WATCH_ID",
+ static_cast<void*>(watchpoint_sp.get()));
else
- log->Printf ("SBWatchpoint(%p)::GetID () => %u", watchpoint_sp.get(), watch_id);
+ log->Printf ("SBWatchpoint(%p)::GetID () => %u",
+ static_cast<void*>(watchpoint_sp.get()), watch_id);
}
return watch_id;
@@ -185,7 +189,8 @@ SBWatchpoint::GetHitCount ()
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBWatchpoint(%p)::GetHitCount () => %u", watchpoint_sp.get(), count);
+ log->Printf ("SBWatchpoint(%p)::GetHitCount () => %u",
+ static_cast<void*>(watchpoint_sp.get()), count);
return count;
}