Modified all logging calls to hand out shared pointers to make sure we

don't crash if we disable logging when some code already has a copy of the
logger. Prior to this fix, logs were handed out as pointers and if they were
held onto while a log got disabled, then it could cause a crash. Now all logs
are handed out as shared pointers so this problem shouldn't happen anymore.
We are also using our new shared pointers that put the shared pointer count
and the object into the same allocation for a tad better performance.

llvm-svn: 118319
This commit is contained in:
Greg Clayton 2010-11-06 01:53:30 +00:00
parent 8e3d95e7df
commit 2d4edfbc6a
98 changed files with 586 additions and 565 deletions

View File

@ -60,10 +60,10 @@ public:
// Callback definitions for abstracted plug-in log access.
//------------------------------------------------------------------
typedef void (*DisableCallback) (Args &args, Stream *feedback_strm);
typedef Log* (*EnableCallback) (lldb::StreamSP &log_stream_sp,
uint32_t log_options,
Args &args,
Stream *feedback_strm);
typedef lldb::LogSP (*EnableCallback) (lldb::StreamSP &log_stream_sp,
uint32_t log_options,
Args &args,
Stream *feedback_strm);
typedef void (*ListCategoriesCallback) (Stream *strm);
struct Callbacks

View File

@ -285,7 +285,7 @@ private:
std::map<uint8_t *, uintptr_t> m_globals; ///< A map from the base addresses of globals to their sizes.
std::map<uint8_t *, uint8_t *> m_exception_tables; ///< A map from the base addresses of exception tables to their end addresses.
lldb_private::Log *m_log; ///< The log to use when printing log messages. May be NULL.
lldb::LogSP m_log; ///< The log to use when printing log messages. May be NULL.
//----------------------------------------------------------------------
/// @class LocalToRemoteAddressRange RecordingMemoryManager.h "lldb/Expression/RecordingMemoryManager.h"

View File

@ -267,7 +267,7 @@ SharingPtr<T>::make_shared()
typedef imp::shared_ptr_emplace<T> CntrlBlk;
SharingPtr<T> r;
r.cntrl_ = new CntrlBlk();
r.ptr_ = r.cntrl_->get();
r.ptr_ = static_cast<CntrlBlk*>(r.cntrl_)->get();
return r;
}

View File

@ -56,10 +56,10 @@ LogIfAllCategoriesSet (uint32_t mask, const char *format, ...);
void
LogIfAnyCategoriesSet (uint32_t mask, const char *format, ...);
Log *
lldb::LogSP
GetLogIfAllCategoriesSet (uint32_t mask);
Log *
lldb::LogSP
GetLogIfAnyCategoriesSet (uint32_t mask);
uint32_t
@ -71,7 +71,7 @@ IsLogVerbose ();
void
DisableLog (Args &args, Stream *feedback_strm);
Log *
lldb::LogSP
EnableLog (lldb::StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm);
void

View File

@ -87,7 +87,7 @@ SBAddress::GetFileAddress () const
lldb::addr_t
SBAddress::GetLoadAddress (const SBTarget &target) const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (m_opaque_ap.get())
{

View File

@ -95,7 +95,7 @@ SBBreakpoint::operator = (const SBBreakpoint& rhs)
break_id_t
SBBreakpoint::GetID () const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (m_opaque_sp)
{
@ -195,7 +195,7 @@ SBBreakpoint::GetLocationAtIndex (uint32_t index)
void
SBBreakpoint::SetEnabled (bool enable)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBBreakpoint(%p)::SetEnabled (enabled=%i)", m_opaque_sp.get(), enable);
@ -216,7 +216,7 @@ SBBreakpoint::IsEnabled ()
void
SBBreakpoint::SetIgnoreCount (uint32_t count)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBBreakpoint(%p)::SetIgnoreCount (count=%u)", m_opaque_sp.get(), count);
@ -244,7 +244,7 @@ SBBreakpoint::GetHitCount () const
if (m_opaque_sp)
count = m_opaque_sp->GetHitCount();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBBreakpoint(%p)::GetHitCount () => %u", m_opaque_sp.get(), count);
@ -258,7 +258,7 @@ SBBreakpoint::GetIgnoreCount () const
if (m_opaque_sp)
count = m_opaque_sp->GetIgnoreCount();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBBreakpoint(%p)::GetIgnoreCount () => %u", m_opaque_sp.get(), count);
@ -270,7 +270,7 @@ SBBreakpoint::SetThreadID (tid_t tid)
{
if (m_opaque_sp)
m_opaque_sp->SetThreadID (tid);
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBBreakpoint(%p)::SetThreadID (tid=0x%4.4x)", m_opaque_sp.get(), tid);
@ -283,7 +283,7 @@ SBBreakpoint::GetThreadID ()
if (m_opaque_sp)
tid = m_opaque_sp->GetThreadID();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBBreakpoint(%p)::GetThreadID () => 0x%4.4x", m_opaque_sp.get(), tid);
return tid;
@ -292,7 +292,7 @@ SBBreakpoint::GetThreadID ()
void
SBBreakpoint::SetThreadIndex (uint32_t index)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBBreakpoint(%p)::SetThreadIndex (%u)", m_opaque_sp.get(), index);
if (m_opaque_sp)
@ -309,7 +309,7 @@ SBBreakpoint::GetThreadIndex() const
if (thread_spec == NULL)
thread_idx = thread_spec->GetIndex();
}
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBBreakpoint(%p)::GetThreadIndex () => %u", m_opaque_sp.get(), index);
@ -320,7 +320,7 @@ SBBreakpoint::GetThreadIndex() const
void
SBBreakpoint::SetThreadName (const char *thread_name)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBBreakpoint(%p)::SetThreadName (%s)", m_opaque_sp.get(), thread_name);
@ -338,7 +338,7 @@ SBBreakpoint::GetThreadName () const
if (thread_spec == NULL)
name = thread_spec->GetName();
}
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBBreakpoint(%p)::GetThreadName () => %s", m_opaque_sp.get(), name);
@ -348,7 +348,7 @@ SBBreakpoint::GetThreadName () const
void
SBBreakpoint::SetQueueName (const char *queue_name)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBBreakpoint(%p)::SetQueueName (%s)", m_opaque_sp.get(), queue_name);
if (m_opaque_sp)
@ -364,7 +364,7 @@ SBBreakpoint::GetQueueName () const
const ThreadSpec *thread_spec = m_opaque_sp->GetOptions()->GetThreadSpec();
name = thread_spec->GetQueueName();
}
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBBreakpoint(%p)::GetQueueName () => %s", m_opaque_sp.get(), name);
@ -377,7 +377,7 @@ SBBreakpoint::GetNumResolvedLocations() const
size_t num_resolved = 0;
if (m_opaque_sp)
num_resolved = m_opaque_sp->GetNumResolvedLocations();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBBreakpoint(%p)::GetNumResolvedLocations () => %zu", m_opaque_sp.get(), num_resolved);
return num_resolved;
@ -389,7 +389,7 @@ SBBreakpoint::GetNumLocations() const
size_t num_locs = 0;
if (m_opaque_sp)
num_locs = m_opaque_sp->GetNumLocations();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBBreakpoint(%p)::GetNumLocations () => %zu", m_opaque_sp.get(), num_locs);
return num_locs;
@ -450,7 +450,7 @@ SBBreakpoint::PrivateBreakpointHitCallback
void
SBBreakpoint::SetCallback (BreakpointHitCallback callback, void *baton)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBBreakpoint(%p)::SetCallback (callback=%p, baton=%p)", m_opaque_sp.get(), callback, baton);

View File

@ -33,7 +33,7 @@ SBBreakpointLocation::SBBreakpointLocation () :
SBBreakpointLocation::SBBreakpointLocation (const lldb::BreakpointLocationSP &break_loc_sp) :
m_opaque_sp (break_loc_sp)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
@ -244,7 +244,7 @@ SBBreakpointLocation::GetDescription (DescriptionLevel level, SBStream &descript
SBBreakpoint
SBBreakpointLocation::GetBreakpoint ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
//if (log)
// log->Printf ("SBBreakpointLocation::GetBreakpoint ()");

View File

@ -30,7 +30,7 @@ SBBroadcaster::SBBroadcaster (const char *name) :
m_opaque_ptr (NULL)
{
m_opaque_ptr = m_opaque_sp.get();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE));
if (log)
log->Printf ("SBBroadcaster::SBBroadcaster (name=\"%s\") => SBBroadcaster(%p)",
@ -41,7 +41,7 @@ SBBroadcaster::SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns)
m_opaque_sp (owns ? broadcaster : NULL),
m_opaque_ptr (broadcaster)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE));
if (log)
log->Printf ("SBBroadcaster::SBBroadcaster (broadcaster=%p, bool owns=%i) => SBBroadcaster(%p)",
@ -73,7 +73,7 @@ SBBroadcaster::~SBBroadcaster()
void
SBBroadcaster::BroadcastEventByType (uint32_t event_type, bool unique)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP 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);
@ -90,7 +90,7 @@ SBBroadcaster::BroadcastEventByType (uint32_t event_type, bool unique)
void
SBBroadcaster::BroadcastEvent (const SBEvent &event, bool unique)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBBroadcaster(%p)::BroadcastEventByType (SBEvent(%p), unique=%i)", m_opaque_ptr, event.get(), unique);
@ -108,7 +108,7 @@ SBBroadcaster::BroadcastEvent (const SBEvent &event, bool unique)
void
SBBroadcaster::AddInitialEventsToListener (const SBListener &listener, uint32_t requested_events)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP 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);
if (m_opaque_ptr)

View File

@ -33,7 +33,7 @@ using namespace lldb_private;
SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter *interpreter) :
m_opaque_ptr (interpreter)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBCommandInterpreter::SBCommandInterpreter (interpreter=%p)"
@ -82,7 +82,7 @@ SBCommandInterpreter::AliasExists (const char *cmd)
lldb::ReturnStatus
SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnObject &result, bool add_to_history)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBCommandInterpreter(%p)::HandleCommand (command=\"%s\", SBCommandReturnObject(%p), add_to_history=%i)",
@ -168,7 +168,7 @@ SBCommandInterpreter::GetProcess ()
if (target)
process.SetProcess(target->GetProcessSP());
}
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBCommandInterpreter(%p)::GetProcess () => SBProcess(%p)",
@ -187,7 +187,7 @@ SBCommandInterpreter::WriteToScriptInterpreter (const char *src)
ssize_t
SBCommandInterpreter::WriteToScriptInterpreter (const char *src, size_t src_len)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
ssize_t bytes_written = 0;
if (m_opaque_ptr && src && src[0])
@ -236,7 +236,7 @@ SBCommandInterpreter::SourceInitFileInHomeDirectory (SBCommandReturnObject &resu
result->AppendError ("SBCommandInterpreter is not valid");
result->SetStatus (eReturnStatusFailed);
}
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBCommandInterpreter(%p)::SourceInitFileInHomeDirectory (&SBCommandReturnObject(%p))",
@ -257,7 +257,7 @@ SBCommandInterpreter::SourceInitFileInCurrentWorkingDirectory (SBCommandReturnOb
result->AppendError ("SBCommandInterpreter is not valid");
result->SetStatus (eReturnStatusFailed);
}
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBCommandInterpreter(%p)::SourceInitFileInCurrentWorkingDirectory (&SBCommandReturnObject(%p))",
@ -267,7 +267,7 @@ SBCommandInterpreter::SourceInitFileInCurrentWorkingDirectory (SBCommandReturnOb
SBBroadcaster
SBCommandInterpreter::GetBroadcaster ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBBroadcaster broadcaster (m_opaque_ptr, false);

View File

@ -57,7 +57,7 @@ SBCommandReturnObject::IsValid() const
const char *
SBCommandReturnObject::GetOutput ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (m_opaque_ap.get())
{
@ -77,7 +77,7 @@ SBCommandReturnObject::GetOutput ()
const char *
SBCommandReturnObject::GetError ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (m_opaque_ap.get())
{

View File

@ -28,7 +28,7 @@ SBCommunication::SBCommunication(const char * broadcaster_name) :
m_opaque (new Communication (broadcaster_name)),
m_opaque_owned (true)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBCommunication::SBCommunication (broadcaster_name=\"%s\") => "
@ -82,7 +82,7 @@ SBCommunication::Connect (const char *url)
ConnectionStatus
SBCommunication::AdoptFileDesriptor (int fd, bool owns_fd)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
ConnectionStatus status = eConnectionStatusNoConnection;
if (m_opaque)
@ -110,7 +110,7 @@ SBCommunication::AdoptFileDesriptor (int fd, bool owns_fd)
ConnectionStatus
SBCommunication::Disconnect ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
ConnectionStatus status= eConnectionStatusNoConnection;
if (m_opaque)
@ -126,7 +126,7 @@ SBCommunication::Disconnect ()
bool
SBCommunication::IsConnected () const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
bool result = false;
if (m_opaque)
result = m_opaque->IsConnected ();
@ -140,7 +140,7 @@ SBCommunication::IsConnected () const
size_t
SBCommunication::Read (void *dst, size_t dst_len, uint32_t timeout_usec, ConnectionStatus &status)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBCommunication(%p)::Read (dst=%p, dst_len=%zu, timeout_usec=%u, &status)...",
m_opaque, dst, dst_len, timeout_usec);
@ -167,7 +167,7 @@ SBCommunication::Write (const void *src, size_t src_len, ConnectionStatus &statu
else
status = eConnectionStatusNoConnection;
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBCommunication(%p)::Write (src=%p, src_len=%zu, &status=%s) => %zu",
m_opaque, src, src_len, Communication::ConnectionStatusAsCString (status), bytes_written);
@ -178,7 +178,7 @@ SBCommunication::Write (const void *src, size_t src_len, ConnectionStatus &statu
bool
SBCommunication::ReadThreadStart ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
bool success = false;
if (m_opaque)
@ -195,7 +195,7 @@ SBCommunication::ReadThreadStart ()
bool
SBCommunication::ReadThreadStop ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBCommunication(%p)::ReadThreadStop ()...", m_opaque);
@ -215,7 +215,7 @@ SBCommunication::ReadThreadIsRunning ()
bool result = false;
if (m_opaque)
result = m_opaque->ReadThreadIsRunning ();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBCommunication(%p)::ReadThreadIsRunning () => %i", m_opaque, result);
return result;
@ -228,7 +228,7 @@ SBCommunication::SetReadThreadBytesReceivedCallback
void *callback_baton
)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
bool result = false;
if (m_opaque)
@ -249,7 +249,7 @@ SBCommunication::GetBroadcaster ()
{
SBBroadcaster broadcaster (m_opaque, false);
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBCommunication(%p)::GetBroadcaster () => SBBroadcaster (%p)",

View File

@ -71,7 +71,7 @@ SBCompileUnit::GetNumLineEntries () const
SBLineEntry
SBCompileUnit::GetLineEntryAtIndex (uint32_t idx) const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBLineEntry sb_line_entry;
if (m_opaque_ptr)
@ -99,7 +99,7 @@ SBCompileUnit::GetLineEntryAtIndex (uint32_t idx) const
uint32_t
SBCompileUnit::FindLineEntryIndex (uint32_t start_idx, uint32_t line, SBFileSpec *inline_file_spec) const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
uint32_t index = UINT32_MAX;
if (m_opaque_ptr)

View File

@ -37,7 +37,7 @@ using namespace lldb_private;
void
SBDebugger::Initialize ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBDebugger::Initialize ()");
@ -54,7 +54,7 @@ SBDebugger::Terminate ()
void
SBDebugger::Clear ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBDebugger(%p)::Clear ()", m_opaque_sp.get());
@ -65,7 +65,7 @@ SBDebugger::Clear ()
SBDebugger
SBDebugger::Create()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBDebugger debugger;
debugger.reset(Debugger::CreateInstance());
@ -130,7 +130,7 @@ SBDebugger::SkipLLDBInitFiles (bool b)
void
SBDebugger::SetInputFileHandle (FILE *fh, bool transfer_ownership)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBDebugger(%p)::SetInputFileHandle (fh=%p, transfer_ownership=%i)", m_opaque_sp.get(),
@ -143,7 +143,7 @@ SBDebugger::SetInputFileHandle (FILE *fh, bool transfer_ownership)
void
SBDebugger::SetOutputFileHandle (FILE *fh, bool transfer_ownership)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
@ -157,7 +157,7 @@ SBDebugger::SetOutputFileHandle (FILE *fh, bool transfer_ownership)
void
SBDebugger::SetErrorFileHandle (FILE *fh, bool transfer_ownership)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
@ -195,7 +195,7 @@ SBDebugger::GetErrorFileHandle ()
SBCommandInterpreter
SBDebugger::GetCommandInterpreter ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBCommandInterpreter sb_interpreter;
if (m_opaque_sp)
@ -243,7 +243,7 @@ SBDebugger::HandleCommand (const char *command)
SBListener
SBDebugger::GetListener ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBListener sb_listener;
if (m_opaque_sp)
@ -432,7 +432,7 @@ SBDebugger::StateAsCString (lldb::StateType state)
bool
SBDebugger::StateIsRunningState (lldb::StateType state)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
const bool result = lldb_private::StateIsRunningState (state);
if (log)
@ -445,7 +445,7 @@ SBDebugger::StateIsRunningState (lldb::StateType state)
bool
SBDebugger::StateIsStoppedState (lldb::StateType state)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
const bool result = lldb_private::StateIsStoppedState (state);
if (log)
@ -471,7 +471,7 @@ SBDebugger::CreateTargetWithFileAndTargetTriple (const char *filename,
target.reset (target_sp);
}
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
log->Printf ("SBDebugger(%p)::CreateTargetWithFileAndTargetTriple (filename=\"%s\", triple=%s) => SBTarget(%p)",
@ -484,7 +484,7 @@ SBDebugger::CreateTargetWithFileAndTargetTriple (const char *filename,
SBTarget
SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *archname)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBTarget target;
if (m_opaque_sp)
@ -565,7 +565,7 @@ SBDebugger::CreateTarget (const char *filename)
target.reset (target_sp);
}
}
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
log->Printf ("SBDebugger(%p)::CreateTarget (filename=\"%s\") => SBTarget(%p)",
@ -628,7 +628,7 @@ SBDebugger::GetNumTargets ()
SBTarget
SBDebugger::GetSelectedTarget ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBTarget sb_target;
if (m_opaque_sp)
@ -648,7 +648,7 @@ SBDebugger::GetSelectedTarget ()
void
SBDebugger::DispatchInput (void *baton, const void *data, size_t data_len)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBDebugger(%p)::DispatchInput (baton=%p, data=\"%.*s\", size_t=%zu)", m_opaque_sp.get(),
@ -661,7 +661,7 @@ SBDebugger::DispatchInput (void *baton, const void *data, size_t data_len)
void
SBDebugger::PushInputReader (SBInputReader &reader)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBDebugger(%p)::PushInputReader (SBInputReader(%p))", m_opaque_sp.get(), &reader);
@ -768,7 +768,7 @@ SBDebugger::SetTerminalWidth (uint32_t term_width)
const char *
SBDebugger::GetPrompt() const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBDebugger(%p)::GetPrompt () => \"%s\"", m_opaque_sp.get(),

View File

@ -70,7 +70,7 @@ SBError::Clear ()
bool
SBError::Fail () const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
bool ret_value = false;
if (m_opaque_ap.get())
@ -85,7 +85,7 @@ SBError::Fail () const
bool
SBError::Success () const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
bool ret_value = false;
if (m_opaque_ap.get())
ret_value = m_opaque_ap->Success();
@ -99,7 +99,7 @@ SBError::Success () const
uint32_t
SBError::GetError () const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
uint32_t err = 0;
if (m_opaque_ap.get())
@ -115,7 +115,7 @@ SBError::GetError () const
ErrorType
SBError::GetType () const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
ErrorType err_type = eErrorTypeInvalid;
if (m_opaque_ap.get())
err_type = m_opaque_ap->GetType();

View File

@ -75,7 +75,7 @@ SBEvent::GetDataFlavor ()
uint32_t
SBEvent::GetType () const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
const Event *lldb_event = get();
uint32_t event_type = 0;
@ -123,7 +123,7 @@ SBEvent::BroadcasterMatchesRef (const SBBroadcaster &broadcaster)
success = lldb_event->BroadcasterIs (broadcaster.get());
// 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);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE));
if (log)
log->Printf ("SBEvent(%p)::BroadcasterMatchesRef (SBBroadcaster(%p): %s) => %i",
get(),
@ -187,7 +187,7 @@ SBEvent::IsValid() const
const char *
SBEvent::GetCStringFromEvent (const SBEvent &event)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBEvent(%p)::GetCStringFromEvent () => \"%s\"",

View File

@ -25,7 +25,7 @@ SBFileSpec::SBFileSpec () :
SBFileSpec::SBFileSpec (const SBFileSpec &rhs) :
m_opaque_ap()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (rhs.m_opaque_ap.get())
m_opaque_ap.reset (new FileSpec (rhs.get()));
@ -48,7 +48,7 @@ SBFileSpec::SBFileSpec (const char *path) :
SBFileSpec::SBFileSpec (const char *path, bool resolve) :
m_opaque_ap(new FileSpec (path, resolve))
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFileSpec::SBFileSpec (path=\"%s\", resolve=%i) => SBFileSpec(%p)", path,
@ -79,7 +79,7 @@ SBFileSpec::IsValid() const
bool
SBFileSpec::Exists () const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
bool result = false;
if (m_opaque_ap.get())
@ -112,7 +112,7 @@ SBFileSpec::GetFilename() const
if (m_opaque_ap.get())
s = m_opaque_ap->GetFilename().AsCString();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (s)
@ -130,7 +130,7 @@ SBFileSpec::GetDirectory() const
const char *s = NULL;
if (m_opaque_ap.get())
s = m_opaque_ap->GetDirectory().AsCString();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (s)
@ -144,7 +144,7 @@ SBFileSpec::GetDirectory() const
uint32_t
SBFileSpec::GetPath (char *dst_path, size_t dst_len) const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
uint32_t result = 0;
if (m_opaque_ap.get())

View File

@ -51,7 +51,7 @@ SBFrame::SBFrame () :
SBFrame::SBFrame (const lldb::StackFrameSP &lldb_object_sp) :
m_opaque_sp (lldb_object_sp)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
@ -86,7 +86,7 @@ SBFrame::SetFrame (const lldb::StackFrameSP &lldb_object_sp)
{
void *old_ptr = m_opaque_sp.get();
m_opaque_sp = lldb_object_sp;
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
@ -111,7 +111,7 @@ SBFrame::GetSymbolContext (uint32_t resolve_scope) const
if (m_opaque_sp)
sb_sym_ctx.SetSymbolContext(&m_opaque_sp->GetSymbolContext (resolve_scope));
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetSymbolContext (resolve_scope=0x%8.8x) => SBSymbolContext(%p)",
m_opaque_sp.get(), resolve_scope, sb_sym_ctx.get());
@ -123,7 +123,7 @@ SBModule
SBFrame::GetModule () const
{
SBModule sb_module (m_opaque_sp->GetSymbolContext (eSymbolContextModule).module_sp);
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetModule () => SBModule(%p)",
m_opaque_sp.get(), sb_module.get());
@ -136,7 +136,7 @@ SBFrame::GetCompileUnit () const
{
SBCompileUnit sb_comp_unit(m_opaque_sp->GetSymbolContext (eSymbolContextCompUnit).comp_unit);
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetModule () => SBCompileUnit(%p)",
m_opaque_sp.get(), sb_comp_unit.get());
@ -149,7 +149,7 @@ SBFrame::GetFunction () const
{
SBFunction sb_function(m_opaque_sp->GetSymbolContext (eSymbolContextFunction).function);
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetFunction () => SBFunction(%p)",
m_opaque_sp.get(), sb_function.get());
@ -161,7 +161,7 @@ SBSymbol
SBFrame::GetSymbol () const
{
SBSymbol sb_symbol(m_opaque_sp->GetSymbolContext (eSymbolContextSymbol).symbol);
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetSymbol () => SBSymbol(%p)",
m_opaque_sp.get(), sb_symbol.get());
@ -172,7 +172,7 @@ SBBlock
SBFrame::GetBlock () const
{
SBBlock sb_block(m_opaque_sp->GetSymbolContext (eSymbolContextBlock).block);
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetBlock () => SBBlock(%p)",
m_opaque_sp.get(), sb_block.get());
@ -183,7 +183,7 @@ SBBlock
SBFrame::GetFrameBlock () const
{
SBBlock sb_block(m_opaque_sp->GetFrameBlock ());
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetFrameBlock () => SBBlock(%p)",
m_opaque_sp.get(), sb_block.get());
@ -194,7 +194,7 @@ SBLineEntry
SBFrame::GetLineEntry () const
{
SBLineEntry sb_line_entry(&m_opaque_sp->GetSymbolContext (eSymbolContextLineEntry).line_entry);
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetLineEntry () => SBLineEntry(%p)",
m_opaque_sp.get(), sb_line_entry.get());
@ -206,7 +206,7 @@ SBFrame::GetFrameID () const
{
uint32_t frame_idx = m_opaque_sp ? m_opaque_sp->GetFrameIndex () : UINT32_MAX;
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetFrameID () => %u",
m_opaque_sp.get(), frame_idx);
@ -221,7 +221,7 @@ SBFrame::GetPC () const
if (m_opaque_sp)
addr = m_opaque_sp->GetFrameCodeAddress().GetLoadAddress (&m_opaque_sp->GetThread().GetProcess().GetTarget());
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetPC () => 0x%llx", m_opaque_sp.get(), addr);
@ -236,7 +236,7 @@ SBFrame::SetPC (lldb::addr_t new_pc)
if (m_opaque_sp)
ret_val = m_opaque_sp->GetRegisterContext()->SetPC (new_pc);
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::SetPC (new_pc=0x%llx) => %i",
m_opaque_sp.get(), new_pc, ret_val);
@ -250,7 +250,7 @@ SBFrame::GetSP () const
addr_t addr = LLDB_INVALID_ADDRESS;
if (m_opaque_sp)
addr = m_opaque_sp->GetRegisterContext()->GetSP();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetSP () => 0x%llx", m_opaque_sp.get(), addr);
@ -265,7 +265,7 @@ SBFrame::GetFP () const
if (m_opaque_sp)
addr = m_opaque_sp->GetRegisterContext()->GetFP();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetFP () => 0x%llx", m_opaque_sp.get(), addr);
return addr;
@ -278,7 +278,7 @@ SBFrame::GetPCAddress () const
SBAddress sb_addr;
if (m_opaque_sp)
sb_addr.SetAddress (&m_opaque_sp->GetFrameCodeAddress());
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetPCAddress () => SBAddress(%p)", m_opaque_sp.get(), sb_addr.get());
return sb_addr;
@ -322,7 +322,7 @@ SBFrame::LookupVar (const char *var_name)
if (var_sp)
*sb_value = ValueObjectSP (new ValueObjectVariable (var_sp));
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::LookupVar (name=\"%s\") => SBValue(%p)",
m_opaque_sp.get(), var_name, sb_value.get());
@ -377,7 +377,7 @@ SBFrame::LookupVarInScope (const char *var_name, const char *scope)
if (var_sp)
*sb_value = ValueObjectSP (new ValueObjectVariable (var_sp));
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::LookupVarInScope (name=\"%s\", scope=%s) => SBValue(%p)",
m_opaque_sp.get(), var_name, scope, sb_value.get());
@ -414,7 +414,7 @@ SBFrame::get() const
SBThread
SBFrame::GetThread () const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
//if (log)
// log->Printf ("SBFrame::GetThread ()");
@ -438,7 +438,7 @@ SBFrame::Disassemble () const
const char *disassembly = NULL;
if (m_opaque_sp)
disassembly = m_opaque_sp->Disassemble();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::Disassemble () => %s", m_opaque_sp.get(), disassembly);
@ -453,7 +453,7 @@ SBFrame::GetVariables (bool arguments,
bool statics,
bool in_scope_only)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::GetVariables (arguments=%i, locals=%i, statics=%i, in_scope_only=%i)",
@ -522,7 +522,7 @@ SBFrame::GetVariables (bool arguments,
lldb::SBValueList
SBFrame::GetRegisters ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBValueList value_list;
if (m_opaque_sp)
@ -561,7 +561,7 @@ SBFrame::GetDescription (SBStream &description)
lldb::SBValue
SBFrame::EvaluateExpression (const char *expr)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
lldb::SBValue expr_result;
if (log)

View File

@ -62,7 +62,7 @@ SBFunction::GetName() const
if (m_opaque_ptr)
cstr = m_opaque_ptr->GetMangled().GetName().AsCString();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (cstr)
@ -79,7 +79,7 @@ SBFunction::GetMangledName () const
const char *cstr = NULL;
if (m_opaque_ptr)
cstr = m_opaque_ptr->GetMangled().GetMangledName().AsCString();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (cstr)

View File

@ -35,7 +35,7 @@ SBHostOS::ThreadCreate
SBError *error_ptr
)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP 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,

View File

@ -33,7 +33,7 @@ SBInputReader::SBInputReader () :
SBInputReader::SBInputReader (const lldb::InputReaderSP &reader_sp) :
m_opaque_sp (reader_sp)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBInputReader::SBInputReader (reader_sp=%p) => SBInputReader(%p)", reader_sp.get(),
@ -43,7 +43,7 @@ SBInputReader::SBInputReader (const lldb::InputReaderSP &reader_sp) :
SBInputReader::SBInputReader (const SBInputReader &rhs) :
m_opaque_sp (rhs.m_opaque_sp)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf("SBInputReader::SBInputReader (rhs.sp=%p) => SBInputReader(%p)",
@ -84,7 +84,7 @@ SBInputReader::Initialize
bool echo
)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf("SBInputReader(%p)::Initialize (SBDebugger(%p), callback_function=%p, callback_baton=%p, "
@ -194,7 +194,7 @@ SBInputReader::SetIsDone (bool value)
bool
SBInputReader::IsActive () const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
bool ret_value = false;
if (m_opaque_sp)

View File

@ -69,7 +69,7 @@ SBLineEntry::GetStartAddress () const
if (m_opaque_ap.get())
sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress());
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
StreamString sstr;
@ -91,7 +91,7 @@ SBLineEntry::GetEndAddress () const
sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress());
sb_address.OffsetAddress(m_opaque_ap->range.GetByteSize());
}
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
StreamString sstr;
@ -113,7 +113,7 @@ SBLineEntry::IsValid () const
SBFileSpec
SBLineEntry::GetFileSpec () const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBFileSpec sb_file_spec;
if (m_opaque_ap.get() && m_opaque_ap->file)
@ -133,7 +133,7 @@ SBLineEntry::GetFileSpec () const
uint32_t
SBLineEntry::GetLine () const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
uint32_t line = 0;
if (m_opaque_ap.get())

View File

@ -34,7 +34,7 @@ SBListener::SBListener (const char *name) :
{
m_opaque_ptr = m_opaque_sp.get();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBListener::SBListener (name=\"%s\") => SBListener(%p)",
@ -93,7 +93,7 @@ SBListener::Clear ()
uint32_t
SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t event_mask)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
uint32_t acquired_event_mask = 0;
if (m_opaque_ptr && broadcaster.IsValid())
@ -152,7 +152,7 @@ SBListener::StopListeningForEvents (const SBBroadcaster& broadcaster, uint32_t e
bool
SBListener::WaitForEvent (uint32_t timeout_secs, SBEvent &event)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (timeout_secs == UINT32_MAX)

View File

@ -56,7 +56,7 @@ SBModule::IsValid () const
SBFileSpec
SBModule::GetFileSpec () const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBFileSpec file_spec;
if (m_opaque_sp)
@ -74,7 +74,7 @@ SBModule::GetFileSpec () const
const uint8_t *
SBModule::GetUUIDBytes () const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
const uint8_t *uuid_bytes = NULL;
if (m_opaque_sp)

View File

@ -99,7 +99,7 @@ SBProcess::IsValid() const
uint32_t
SBProcess::GetNumThreads ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
uint32_t num_threads = 0;
if (m_opaque_sp)
@ -117,7 +117,7 @@ SBProcess::GetNumThreads ()
SBThread
SBProcess::GetSelectedThread () const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBThread sb_thread;
if (m_opaque_sp)
@ -134,7 +134,7 @@ SBProcess::GetSelectedThread () const
SBTarget
SBProcess::GetTarget() const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBTarget sb_target;
if (m_opaque_sp)
@ -150,7 +150,7 @@ SBProcess::GetTarget() const
size_t
SBProcess::PutSTDIN (const char *src, size_t src_len)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
size_t ret_val = 0;
if (m_opaque_sp != NULL)
@ -179,7 +179,7 @@ SBProcess::GetSTDOUT (char *dst, size_t dst_len) const
bytes_read = m_opaque_sp->GetSTDOUT (dst, dst_len, error);
}
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBProcess(%p)::GetSTDOUT (dst=\"%.*s\", dst_len=%zu) => %zu",
m_opaque_sp.get(), (int) bytes_read, dst, dst_len, bytes_read);
@ -197,7 +197,7 @@ SBProcess::GetSTDERR (char *dst, size_t dst_len) const
bytes_read = m_opaque_sp->GetSTDERR (dst, dst_len, error);
}
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBProcess(%p)::GetSTDERR (dst=\"%.*s\", dst_len=%zu) => %zu",
m_opaque_sp.get(), (int) bytes_read, dst, dst_len, bytes_read);
@ -254,7 +254,7 @@ SBProcess::SetSelectedThread (const SBThread &thread)
bool
SBProcess::SetSelectedThreadByID (uint32_t tid)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
bool ret_val = false;
if (m_opaque_sp != NULL)
@ -270,7 +270,7 @@ SBProcess::SetSelectedThreadByID (uint32_t tid)
SBThread
SBProcess::GetThreadAtIndex (size_t index)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBThread thread;
if (m_opaque_sp)
@ -293,7 +293,7 @@ SBProcess::GetState ()
if (m_opaque_sp != NULL)
ret_val = m_opaque_sp->GetState();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBProcess(%p)::GetState () => %s",
m_opaque_sp.get(),
@ -309,7 +309,7 @@ SBProcess::GetExitStatus ()
int exit_status = 0;
if (m_opaque_sp)
exit_status = m_opaque_sp->GetExitStatus ();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBProcess(%p)::GetExitStatus () => %i (0x%8.8x)",
m_opaque_sp.get(), exit_status, exit_status);
@ -323,7 +323,7 @@ SBProcess::GetExitDescription ()
const char *exit_desc = NULL;
if (m_opaque_sp != NULL)
exit_desc = m_opaque_sp->GetExitDescription ();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBProcess(%p)::GetExitDescription () => %s",
m_opaque_sp.get(), exit_desc);
@ -337,7 +337,7 @@ SBProcess::GetProcessID ()
if (m_opaque_sp)
ret_val = m_opaque_sp->GetID();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBProcess(%p)::GetProcessID () => %d", m_opaque_sp.get(), ret_val);
@ -351,7 +351,7 @@ SBProcess::GetAddressByteSize () const
if (m_opaque_sp)
size = m_opaque_sp->GetAddressByteSize();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBProcess(%p)::GetAddressByteSize () => %d", m_opaque_sp.get(), size);
@ -361,7 +361,7 @@ SBProcess::GetAddressByteSize () const
SBError
SBProcess::Continue ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBProcess(%p)::Continue ()...", m_opaque_sp.get());
@ -403,7 +403,7 @@ SBProcess::Destroy ()
else
sb_error.SetErrorString ("SBProcess is invalid");
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
SBStream sstr;
@ -425,7 +425,7 @@ SBProcess::Stop ()
else
sb_error.SetErrorString ("SBProcess is invalid");
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
SBStream sstr;
@ -449,7 +449,7 @@ SBProcess::Kill ()
else
sb_error.SetErrorString ("SBProcess is invalid");
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
SBStream sstr;
@ -514,7 +514,7 @@ SBProcess::Signal (int signo)
sb_error.SetError (m_opaque_sp->Signal (signo));
else
sb_error.SetErrorString ("SBProcess is invalid");
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
SBStream sstr;
@ -535,7 +535,7 @@ SBProcess::GetThreadByID (tid_t tid)
if (m_opaque_sp)
sb_thread.SetThread (m_opaque_sp->GetThreadList().FindThreadByID ((tid_t) tid));
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
log->Printf ("SBProcess(%p)::GetThreadByID (tid=0x%4.4x) => SBThread (%p)",
@ -550,7 +550,7 @@ SBProcess::GetThreadByID (tid_t tid)
StateType
SBProcess::GetStateFromEvent (const SBEvent &event)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
StateType ret_val = Process::ProcessEventData::GetStateFromEvent (event.get());
@ -578,7 +578,7 @@ SBProcess::GetProcessFromEvent (const SBEvent &event)
SBBroadcaster
SBProcess::GetBroadcaster () const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBBroadcaster broadcaster(m_opaque_sp.get(), false);
@ -598,7 +598,7 @@ SBProcess::operator->() const
size_t
SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
size_t bytes_read = 0;
@ -645,7 +645,7 @@ SBProcess::WriteMemory (addr_t addr, const void *src, size_t src_len, SBError &s
{
size_t bytes_written = 0;
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
log->Printf ("SBProcess(%p)::WriteMemory (addr=0x%llx, src=%p, dst_len=%zu, SBError (%p))...",

View File

@ -60,7 +60,7 @@ SBSymbol::GetName() const
if (m_opaque_ptr)
name = m_opaque_ptr->GetMangled().GetName().AsCString();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBSymbol(%p)::GetName () => \"%s\"", m_opaque_ptr, name ? name : "");
return name;
@ -72,7 +72,7 @@ SBSymbol::GetMangledName () const
const char *name = NULL;
if (m_opaque_ptr)
name = m_opaque_ptr->GetMangled().GetMangledName().AsCString();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBSymbol(%p)::GetMangledName () => \"%s\"", m_opaque_ptr, name ? name : "");

View File

@ -86,7 +86,7 @@ SBSymbolContext::IsValid () const
SBModule
SBSymbolContext::GetModule ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBModule sb_module;
if (m_opaque_ap.get())
@ -112,7 +112,7 @@ SBSymbolContext::GetCompileUnit ()
SBFunction
SBSymbolContext::GetFunction ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Function *function = NULL;
@ -137,7 +137,7 @@ SBSymbolContext::GetBlock ()
SBLineEntry
SBSymbolContext::GetLineEntry ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBLineEntry sb_line_entry;
if (m_opaque_ap.get())
@ -155,7 +155,7 @@ SBSymbolContext::GetLineEntry ()
SBSymbol
SBSymbolContext::GetSymbol ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
Symbol *symbol = NULL;

View File

@ -93,7 +93,7 @@ SBTarget::GetProcess ()
if (m_opaque_sp)
sb_process.SetProcess (m_opaque_sp->GetProcessSP());
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
log->Printf ("SBTarget(%p)::GetProcess () => SBProcess(%p)",
@ -123,7 +123,7 @@ SBTarget::CreateProcess ()
if (m_opaque_sp)
sb_process.SetProcess (m_opaque_sp->CreateProcess (m_opaque_sp->GetDebugger().GetListener()));
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
log->Printf ("SBTarget(%p)::CreateProcess () => SBProcess(%p)",
@ -144,7 +144,7 @@ SBTarget::LaunchProcess
bool stop_at_entry
)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBTarget(%p)::LaunchProcess (argv=%p, envp=%p, tty=\"%s\", launch_flags=%d, stop_at_entry=%i)",
@ -174,7 +174,7 @@ SBTarget::Launch
SBError &error
)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
@ -333,7 +333,7 @@ SBTarget::GetExecutable ()
exe_file_spec.SetFileSpec (exe_module_sp->GetFileSpec());
}
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
log->Printf ("SBTarget(%p)::GetExecutable () => SBFileSpec(%p)",
@ -392,7 +392,7 @@ SBTarget::BreakpointCreateByLocation (const char *file, uint32_t line)
SBBreakpoint
SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, uint32_t line)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBBreakpoint sb_bp;
if (m_opaque_sp.get() && line != 0)
@ -418,7 +418,7 @@ SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, uint32_t l
SBBreakpoint
SBTarget::BreakpointCreateByName (const char *symbol_name, const char *module_name)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBBreakpoint sb_bp;
if (m_opaque_sp.get() && symbol_name && symbol_name[0])
@ -446,7 +446,7 @@ SBTarget::BreakpointCreateByName (const char *symbol_name, const char *module_na
SBBreakpoint
SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBBreakpoint sb_bp;
if (m_opaque_sp.get() && symbol_name_regex && symbol_name_regex[0])
@ -479,7 +479,7 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *mo
SBBreakpoint
SBTarget::BreakpointCreateByAddress (addr_t address)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBBreakpoint sb_bp;
if (m_opaque_sp.get())
@ -496,7 +496,7 @@ SBTarget::BreakpointCreateByAddress (addr_t address)
SBBreakpoint
SBTarget::FindBreakpointByID (break_id_t bp_id)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBBreakpoint sb_breakpoint;
if (m_opaque_sp && bp_id != LLDB_INVALID_BREAK_ID)
@ -531,7 +531,7 @@ SBTarget::GetBreakpointAtIndex (uint32_t idx) const
bool
SBTarget::BreakpointDelete (break_id_t bp_id)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
bool result = false;
if (m_opaque_sp)
@ -582,7 +582,7 @@ SBTarget::DeleteAllBreakpoints ()
uint32_t
SBTarget::GetNumModules () const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
uint32_t num = 0;
if (m_opaque_sp)
@ -597,7 +597,7 @@ SBTarget::GetNumModules () const
void
SBTarget::Clear ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBTarget(%p)::Clear ()", m_opaque_sp.get());
@ -618,7 +618,7 @@ SBTarget::FindModule (const SBFileSpec &sb_file_spec)
SBModule
SBTarget::GetModuleAtIndex (uint32_t idx)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBModule sb_module;
if (m_opaque_sp)
@ -637,7 +637,7 @@ SBTarget::GetModuleAtIndex (uint32_t idx)
SBBroadcaster
SBTarget::GetBroadcaster () const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBBroadcaster broadcaster(m_opaque_sp.get(), false);

View File

@ -91,7 +91,7 @@ SBThread::Clear ()
StopReason
SBThread::GetStopReason()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
StopReason reason = eStopReasonInvalid;
if (m_opaque_sp)
@ -111,7 +111,7 @@ SBThread::GetStopReason()
size_t
SBThread::GetStopDescription (char *dst, size_t dst_len)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (m_opaque_sp)
{
@ -218,7 +218,7 @@ SBThread::SetThread (const ThreadSP& lldb_object_sp)
lldb::tid_t
SBThread::GetThreadID () const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
lldb::tid_t id = LLDB_INVALID_THREAD_ID;
if (m_opaque_sp)
@ -244,7 +244,7 @@ SBThread::GetName () const
if (m_opaque_sp)
name = m_opaque_sp->GetName();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBThread(%p)::GetName () => %s", m_opaque_sp.get(), name ? name : "NULL");
@ -258,7 +258,7 @@ SBThread::GetQueueName () const
if (m_opaque_sp)
name = m_opaque_sp->GetQueueName();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBThread(%p)::GetQueueName () => %s", m_opaque_sp.get(), name ? name : "NULL");
@ -269,7 +269,7 @@ SBThread::GetQueueName () const
void
SBThread::StepOver (lldb::RunMode stop_other_threads)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBThread(%p)::StepOver (stop_other_threads='%s')", m_opaque_sp.get(),
@ -318,7 +318,7 @@ SBThread::StepOver (lldb::RunMode stop_other_threads)
void
SBThread::StepInto (lldb::RunMode stop_other_threads)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBThread(%p)::StepInto (stop_other_threads='%s')", m_opaque_sp.get(),
@ -365,7 +365,7 @@ SBThread::StepInto (lldb::RunMode stop_other_threads)
void
SBThread::StepOut ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBThread(%p)::StepOut ()", m_opaque_sp.get());
@ -393,7 +393,7 @@ SBThread::StepOut ()
void
SBThread::StepInstruction (bool step_over)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBThread(%p)::StepInstruction (step_over=%i)", m_opaque_sp.get(), step_over);
@ -417,7 +417,7 @@ SBThread::StepInstruction (bool step_over)
void
SBThread::RunToAddress (lldb::addr_t addr)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBThread(%p)::RunToAddress (addr=0x%llx)", m_opaque_sp.get(), addr);
@ -455,7 +455,7 @@ SBThread::GetProcess ()
process.SetProcess(m_opaque_sp->GetProcess().GetTarget().GetProcessSP());
}
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
SBStream sstr;
@ -470,7 +470,7 @@ SBThread::GetProcess ()
uint32_t
SBThread::GetNumFrames ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
uint32_t num_frames = 0;
if (m_opaque_sp)
@ -485,7 +485,7 @@ SBThread::GetNumFrames ()
SBFrame
SBThread::GetFrameAtIndex (uint32_t idx)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBFrame sb_frame;
if (m_opaque_sp)

View File

@ -21,7 +21,7 @@ using namespace lldb_private;
bool
SBType::IsPointerType (void *opaque_type)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
//if (log)
// log->Printf ("SBType::IsPointerType (%p)", opaque_type);

View File

@ -89,7 +89,7 @@ SBValue::GetName()
if (m_opaque_sp)
name = m_opaque_sp->GetName().GetCString();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (name)
@ -107,7 +107,7 @@ SBValue::GetTypeName ()
const char *name = NULL;
if (m_opaque_sp)
name = m_opaque_sp->GetTypeName().GetCString();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (name)
@ -127,7 +127,7 @@ SBValue::GetByteSize ()
if (m_opaque_sp)
result = m_opaque_sp->GetByteSize();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::GetByteSize () => %zu", m_opaque_sp.get(), result);
@ -142,7 +142,7 @@ SBValue::IsInScope (const SBFrame &frame)
if (m_opaque_sp)
result = m_opaque_sp->IsInScope (frame.get());
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::IsInScope () => %i", m_opaque_sp.get(), result);
@ -155,7 +155,7 @@ SBValue::GetValue (const SBFrame &frame)
const char *cstr = NULL;
if ( m_opaque_sp)
cstr = m_opaque_sp->GetValueAsCString (frame.get());
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (cstr)
@ -173,7 +173,7 @@ SBValue::GetValueType ()
ValueType result = eValueTypeInvalid;
if (m_opaque_sp)
result = m_opaque_sp->GetValueType();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
switch (result)
@ -198,7 +198,7 @@ SBValue::GetObjectDescription (const SBFrame &frame)
const char *cstr = NULL;
if ( m_opaque_sp)
cstr = m_opaque_sp->GetObjectDescription (frame.get());
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (cstr)
@ -215,7 +215,7 @@ SBValue::GetValueDidChange (const SBFrame &frame)
bool result = false;
if (m_opaque_sp)
result = m_opaque_sp->GetValueDidChange (frame.get());
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::GetValueDidChange (SBFrame(%p)) => %i", m_opaque_sp.get(), frame.get(), result);
@ -228,7 +228,7 @@ SBValue::GetSummary (const SBFrame &frame)
const char *cstr = NULL;
if (m_opaque_sp)
cstr = m_opaque_sp->GetSummaryAsCString(frame.get());
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (cstr)
@ -245,7 +245,7 @@ SBValue::GetLocation (const SBFrame &frame)
const char *cstr = NULL;
if (m_opaque_sp)
cstr = m_opaque_sp->GetLocationAsCString(frame.get());
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (cstr)
@ -276,7 +276,7 @@ SBValue::GetChildAtIndex (uint32_t idx)
}
SBValue sb_value (child_sp);
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::GetChildAtIndex (%u) => SBValue(%p)", m_opaque_sp.get(), idx, sb_value.get());
@ -289,7 +289,7 @@ SBValue::GetIndexOfChildWithName (const char *name)
uint32_t idx = UINT32_MAX;
if (m_opaque_sp)
idx = m_opaque_sp->GetIndexOfChildWithName (ConstString(name));
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (idx == UINT32_MAX)
@ -313,7 +313,7 @@ SBValue::GetChildMemberWithName (const char *name)
SBValue sb_value (child_sp);
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::GetChildMemberWithName (name=\"%s\") => SBValue(%p)", m_opaque_sp.get(), name, sb_value.get());
@ -329,7 +329,7 @@ SBValue::GetNumChildren ()
if (m_opaque_sp)
num_children = m_opaque_sp->GetNumChildren();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::GetNumChildren () => %u", m_opaque_sp.get(), num_children);
@ -357,7 +357,7 @@ SBValue::Dereference ()
if (m_opaque_sp->IsPointerType())
sb_value = GetChildAtIndex(0);
}
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::Dereference () => SBValue(%p)", m_opaque_sp.get(), sb_value.get());
@ -372,7 +372,7 @@ SBValue::TypeIsPointerType ()
if (m_opaque_sp)
is_ptr_type = m_opaque_sp->IsPointerType();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::TypeIsPointerType () => %i", m_opaque_sp.get(), is_ptr_type);

View File

@ -27,7 +27,7 @@ SBValueList::SBValueList () :
SBValueList::SBValueList (const SBValueList &rhs) :
m_opaque_ap ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (rhs.IsValid())
m_opaque_ap.reset (new lldb_private::ValueObjectList (*rhs));
@ -51,7 +51,7 @@ SBValueList::SBValueList (const SBValueList &rhs) :
SBValueList::SBValueList (const lldb_private::ValueObjectList *lldb_object_ptr) :
m_opaque_ap ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (lldb_object_ptr)
m_opaque_ap.reset (new lldb_private::ValueObjectList (*lldb_object_ptr));
@ -144,7 +144,7 @@ SBValueList::Append (lldb::ValueObjectSP& val_obj_sp)
SBValue
SBValueList::GetValueAtIndex (uint32_t idx) const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
//if (log)
// log->Printf ("SBValueList::GetValueAtIndex (uint32_t idx) idx = %d", idx);
@ -167,7 +167,7 @@ SBValueList::GetValueAtIndex (uint32_t idx) const
uint32_t
SBValueList::GetSize () const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
//if (log)
// log->Printf ("SBValueList::GetSize ()");

View File

@ -304,7 +304,7 @@ Breakpoint::ModulesChanged (ModuleList &module_list, bool load)
if (!break_loc->ResolveBreakpointSite())
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
LogSP log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
if (log)
log->Printf ("Warning: could not set breakpoint site for breakpoint location %d of breakpoint %d.\n",
break_loc->GetID(), GetID());

View File

@ -209,7 +209,7 @@ bool
BreakpointLocation::ShouldStop (StoppointCallbackContext *context)
{
bool should_stop = true;
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
LogSP log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
m_hit_count++;
@ -287,7 +287,7 @@ BreakpointLocation::ResolveBreakpointSite ()
if (new_id == LLDB_INVALID_BREAK_ID)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
LogSP log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
if (log)
log->Warning ("Tried to add breakpoint site at 0x%llx but it was already present.\n",
m_address.GetLoadAddress(&m_owner.GetTarget()));

View File

@ -83,7 +83,7 @@ BreakpointResolverAddress::SearchCallback
{
StreamString s;
bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
if (log)
log->Printf ("Added location: %s\n", s.GetData());
}

View File

@ -56,7 +56,7 @@ BreakpointResolverFileLine::SearchCallback
CompileUnit *cu = context.comp_unit;
assert (m_breakpoint != NULL);
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
sc_list_size = cu->ResolveSymbolContext (m_file_spec, m_line_number, m_inlines, false, eSymbolContextEverything, sc_list);
for (uint32_t i = 0; i < sc_list_size; i++)

View File

@ -81,7 +81,7 @@ BreakpointResolverName::BreakpointResolverName
{
if (!m_regex.Compile (m_func_name.AsCString()))
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
if (log)
log->Warning ("function name regexp: \"%s\" did not compile.", m_func_name.AsCString());
@ -146,7 +146,7 @@ BreakpointResolverName::SearchCallback
Address break_addr;
assert (m_breakpoint != NULL);
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
if (m_class_name)
{

View File

@ -50,7 +50,7 @@ AddressResolverFileLine::SearchCallback
uint32_t sc_list_size;
CompileUnit *cu = context.comp_unit;
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
sc_list_size = cu->ResolveSymbolContext (m_file_spec, m_line_number, m_inlines, false, eSymbolContextEverything,
sc_list);

View File

@ -32,7 +32,7 @@ AddressResolverName::AddressResolverName
{
if (!m_regex.Compile (m_func_name.AsCString()))
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
if (log)
log->Warning ("function name regexp: \"%s\" did not compile.", m_func_name.AsCString());
@ -93,7 +93,7 @@ AddressResolverName::SearchCallback
SymbolContext sc;
Address func_addr;
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
if (m_class_name)
{

View File

@ -28,7 +28,7 @@ Broadcaster::Broadcaster (const char *name) :
m_hijacking_listener(NULL),
m_hijacking_mask(UINT32_MAX)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
log->Printf ("%p Broadcaster::Broadcaster(\"%s\")", this, m_broadcaster_name.AsCString());
@ -36,7 +36,7 @@ Broadcaster::Broadcaster (const char *name) :
Broadcaster::~Broadcaster()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
LogSP log (lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
log->Printf ("%p Broadcaster::~Broadcaster(\"%s\")", this, m_broadcaster_name.AsCString());
@ -210,7 +210,7 @@ Broadcaster::PrivateBroadcastEvent (EventSP &event_sp, bool unique)
const uint32_t event_type = event_sp->GetType();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS));
if (log)
{
StreamString event_description;

View File

@ -301,7 +301,7 @@ Communication::ReadThread (void *p)
{
Communication *comm = (Communication *)p;
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_COMMUNICATION);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_COMMUNICATION));
if (log)
log->Printf ("%p Communication::ReadThread () thread starting...", p);
@ -334,7 +334,8 @@ Communication::ReadThread (void *p)
default:
case eConnectionStatusError: // Check GetError() for details
case eConnectionStatusTimedOut: // Request timed out
error.LogIfError(log, "%p Communication::BytesAvailable () => status = %i", p, status);
if (log)
error.LogIfError(log.get(), "%p Communication::BytesAvailable () => status = %i", p, status);
break;
}
}

View File

@ -145,7 +145,7 @@ ConnectionFileDescriptor::Disconnect (Error *error_ptr)
size_t
ConnectionFileDescriptor::Read (void *dst, size_t dst_len, ConnectionStatus &status, Error *error_ptr)
{
Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION);
LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
if (log)
log->Printf ("%p ConnectionFileDescriptor::Read () ::read (fd = %i, dst = %p, dst_len = %zu)...",
this, m_fd, dst, dst_len);
@ -227,7 +227,7 @@ ConnectionFileDescriptor::Read (void *dst, size_t dst_len, ConnectionStatus &sta
size_t
ConnectionFileDescriptor::Write (const void *src, size_t src_len, ConnectionStatus &status, Error *error_ptr)
{
Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION);
LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
if (log)
log->Printf ("%p ConnectionFileDescriptor::Write (src = %p, src_len = %zu)", this, src, src_len);
@ -297,7 +297,7 @@ ConnectionFileDescriptor::Write (const void *src, size_t src_len, ConnectionStat
ConnectionStatus
ConnectionFileDescriptor::BytesAvailable (uint32_t timeout_usec, Error *error_ptr)
{
Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION);
LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_CONNECTION));
if (log)
log->Printf("%p ConnectionFileDescriptor::BytesAvailable (timeout_usec = %u)", this, timeout_usec);
struct timeval *tv_ptr;

View File

@ -32,14 +32,14 @@ Listener::Listener(const char *name) :
m_events_mutex (Mutex::eMutexTypeRecursive),
m_cond_wait()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
log->Printf ("%p Listener::Listener('%s')", this, m_name.c_str());
}
Listener::~Listener()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
log->Printf ("%p Listener::~Listener('%s')", this, m_name.c_str());
Clear();
@ -75,7 +75,7 @@ Listener::StartListeningForEvents (Broadcaster* broadcaster, uint32_t event_mask
{
}
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS));
if (log)
log->Printf ("%p Listener::StartListeningForEvents (broadcaster = %p, mask = 0x%8.8x) acquired_mask = 0x%8.8x for %s",
this,
@ -104,7 +104,7 @@ Listener::StartListeningForEvents (Broadcaster* broadcaster, uint32_t event_mask
uint32_t acquired_mask = broadcaster->AddListener (this, event_mask);
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS));
if (log)
log->Printf ("%p Listener::StartListeningForEvents (broadcaster = %p, mask = 0x%8.8x, callback = %p, user_data = %p) acquired_mask = 0x%8.8x for %s",
this, broadcaster, event_mask, callback, callback_user_data, acquired_mask, m_name.c_str());
@ -164,7 +164,7 @@ Listener::BroadcasterWillDestruct (Broadcaster *broadcaster)
void
Listener::AddEvent (EventSP &event_sp)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS));
if (log)
log->Printf ("%p Listener('%s')::AddEvent (event_sp = {%p})", this, m_name.c_str(), event_sp.get());
@ -251,7 +251,7 @@ Listener::FindNextEventInternal
EventSP &event_sp,
bool remove)
{
//Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS);
//LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS));
Mutex::Locker lock(m_events_mutex);
@ -365,7 +365,7 @@ Listener::WaitForEventsInternal
EventSP &event_sp
)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EVENTS));
bool timed_out = false;
if (log)

View File

@ -36,7 +36,7 @@ Module::Module(const FileSpec& file_spec, const ArchSpec& arch, const ConstStrin
{
if (object_name)
m_object_name = *object_name;
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
log->Printf ("%p Module::Module((%s) '%s/%s%s%s%s')",
this,
@ -50,7 +50,7 @@ Module::Module(const FileSpec& file_spec, const ArchSpec& arch, const ConstStrin
Module::~Module()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
log->Printf ("%p Module::~Module((%s) '%s/%s%s%s%s')",
this,

View File

@ -99,7 +99,7 @@ ASTResultSynthesizer::SynthesizeResult (FunctionDecl *FunDecl)
{
ASTContext &Ctx(*m_ast_context);
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
if (!m_sema)
return false;

View File

@ -151,7 +151,7 @@ ClangExpressionDeclMap::AddValueToStruct
off_t alignment
)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
m_struct_laid_out = false;
@ -510,7 +510,7 @@ ClangExpressionDeclMap::DoMaterialize
Error &err
)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
if (!m_struct_laid_out)
{
@ -675,7 +675,7 @@ ClangExpressionDeclMap::DoMaterializeOneVariable
Error &err
)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
if (!exe_ctx.frame || !exe_ctx.process)
return false;
@ -923,7 +923,7 @@ ClangExpressionDeclMap::FindVariableInScope
TypeFromUser *type
)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
VariableList *var_list = frame.GetVariableList(true);
@ -961,7 +961,7 @@ ClangExpressionDeclMap::GetDecls
const ConstString &name
)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
if (log)
log->Printf("Hunting for a definition for '%s'", name.GetCString());
@ -1109,7 +1109,7 @@ ClangExpressionDeclMap::GetVariableValue
TypeFromParser *parser_type
)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
Type *var_type = var->GetType();
@ -1216,7 +1216,7 @@ void
ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context,
Variable* var)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
TypeFromUser ut;
TypeFromParser pt;
@ -1255,7 +1255,7 @@ void
ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context,
ClangExpressionVariable *pvar)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
TypeFromUser user_type = pvar->m_user_type;
@ -1288,7 +1288,7 @@ ClangExpressionDeclMap::AddOneFunction(NameSearchContext &context,
Function* fun,
Symbol* symbol)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
NamedDecl *fun_decl;
std::auto_ptr<Value> fun_location(new Value);

View File

@ -408,7 +408,7 @@ ClangExpressionParser::MakeJIT (lldb::addr_t &func_addr,
lldb::addr_t &func_end,
ExecutionContext &exe_ctx)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
Error err;
@ -578,7 +578,7 @@ ClangExpressionParser::MakeJIT (lldb::addr_t &func_addr,
Error
ClangExpressionParser::DisassembleFunction (Stream &stream, ExecutionContext &exe_ctx)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
const char *name = m_expr.FunctionName();
@ -664,10 +664,10 @@ ClangExpressionParser::DisassembleFunction (Stream &stream, ExecutionContext &ex
exe_ctx.process->GetByteOrder(),
exe_ctx.target->GetArchitecture().GetAddressByteSize());
if(log)
if (log)
{
log->Printf("Function data has contents:");
extractor.PutToLog (log,
extractor.PutToLog (log.get(),
0,
extractor.GetByteSize(),
func_remote_addr,

View File

@ -207,7 +207,7 @@ ClangFunction::CompileFunction (Stream &errors)
m_wrapper_function_text.append (args_list_buffer);
m_wrapper_function_text.append (");\n}\n");
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
log->Printf ("Expression: \n\n%s\n\n", m_wrapper_function_text.c_str());
@ -357,7 +357,7 @@ ClangFunction::InsertFunction (ExecutionContext &exe_ctx, lldb::addr_t &args_add
if (!WriteFunctionArguments(exe_ctx, args_addr_ref, errors))
return false;
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
log->Printf ("Call Address: 0x%llx Struct Address: 0x%llx.\n", m_wrapper_function_addr, args_addr_ref);
@ -542,7 +542,7 @@ ClangFunction::ExecuteFunction (
return eExecutionSetupError;
}
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
while (1)
{

View File

@ -117,7 +117,7 @@ ApplyUnicharHack(std::string &expr)
bool
ClangUserExpression::Parse (Stream &error_stream, ExecutionContext &exe_ctx)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
ScanContext(exe_ctx);
@ -271,7 +271,7 @@ ClangUserExpression::PrepareToExecuteJITExpression (Stream &error_stream,
lldb::addr_t &struct_address,
lldb::addr_t &object_ptr)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
if (m_jit_addr != LLDB_INVALID_ADDRESS)
{

View File

@ -864,7 +864,7 @@ DWARFExpression::Evaluate
error_ptr->SetErrorString ("Invalid offset and/or length for opcodes buffer.");
return false;
}
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
while (opcodes.ValidOffset(offset) && offset < end_offset)

View File

@ -296,7 +296,7 @@ public:
private:
bool InstrumentInstruction(llvm::Instruction *inst)
{
lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
if(log)
log->Printf("Instrumenting load/store instruction: %s\n",
@ -396,7 +396,7 @@ private:
bool InspectInstruction(llvm::Instruction &i)
{
lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
CallInst *call_inst = dyn_cast<CallInst>(&i);
@ -460,7 +460,7 @@ IRDynamicChecks::~IRDynamicChecks()
bool
IRDynamicChecks::runOnModule(llvm::Module &M)
{
lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
llvm::Function* function = M.getFunction(StringRef(m_func_name.c_str()));

View File

@ -76,7 +76,7 @@ IRForTarget::~IRForTarget()
bool
IRForTarget::createResultVariable (llvm::Module &llvm_module, llvm::Function &llvm_function)
{
lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
if (!m_resolve_vars)
return true;
@ -270,7 +270,7 @@ bool
IRForTarget::RewriteObjCSelector(Instruction* selector_load,
Module &M)
{
lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
LoadInst *load = dyn_cast<LoadInst>(selector_load);
@ -382,7 +382,7 @@ bool
IRForTarget::rewriteObjCSelectors(Module &M,
BasicBlock &BB)
{
lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
BasicBlock::iterator ii;
@ -481,7 +481,7 @@ IRForTarget::rewritePersistentAllocs(llvm::Module &M,
if (!m_resolve_vars)
return true;
lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
BasicBlock::iterator ii;
@ -567,7 +567,7 @@ IRForTarget::MaybeHandleVariable
bool Store
)
{
lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
if (ConstantExpr *constant_expr = dyn_cast<ConstantExpr>(llvm_value_ptr))
{
@ -641,7 +641,7 @@ bool
IRForTarget::MaybeHandleCallArguments(Module &M,
CallInst *C)
{
// lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
// lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
for (unsigned op_index = 0, num_ops = C->getNumArgOperands();
op_index < num_ops;
@ -656,7 +656,7 @@ bool
IRForTarget::MaybeHandleCall(Module &llvm_module,
CallInst *llvm_call_inst)
{
lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
Function *fun = llvm_call_inst->getCalledFunction();
@ -924,7 +924,7 @@ IRForTarget::removeGuards(Module &M, BasicBlock &BB)
static bool
UnfoldConstant(Constant *C, Value *new_value, Instruction *first_entry_instruction)
{
lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
Value::use_iterator ui;
@ -1028,7 +1028,7 @@ IRForTarget::replaceVariables(Module &M, Function &F)
if (!m_resolve_vars)
return true;
lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
m_decl_map->DoStructLayout();
@ -1118,7 +1118,7 @@ IRForTarget::replaceVariables(Module &M, Function &F)
bool
IRForTarget::runOnModule(Module &M)
{
lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
Function* function = M.getFunction(StringRef(m_func_name.c_str()));

View File

@ -171,7 +171,7 @@ IRToDWARF::runOnBasicBlock(BasicBlock &BB, Relocator &R)
bool
IRToDWARF::runOnModule(Module &M)
{
lldb_private::Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
llvm::Function* function = M.getFunction(StringRef(m_func_name.c_str()));

View File

@ -17,9 +17,9 @@ using namespace lldb_private;
RecordingMemoryManager::RecordingMemoryManager () :
llvm::JITMemoryManager(),
m_default_mm_ap (llvm::JITMemoryManager::CreateDefaultMemManager())
m_default_mm_ap (llvm::JITMemoryManager::CreateDefaultMemManager()),
m_log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS))
{
m_log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
}
RecordingMemoryManager::~RecordingMemoryManager ()

View File

@ -104,7 +104,7 @@ private:
static void *
MonitorChildProcessThreadFunction (void *arg)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
const char *function = __FUNCTION__;
if (log)
log->Printf ("%s (arg = %p) thread starting...", function, arg);
@ -426,7 +426,7 @@ ThreadCreateTrampoline (thread_arg_t arg)
thread_func_t thread_fptr = info->thread_fptr;
thread_arg_t thread_arg = info->thread_arg;
Log * log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_THREAD));
if (log)
log->Printf("thread created");

View File

@ -538,7 +538,7 @@ Host::OpenFileInExternalEditor (const FileSpec &file_spec, uint32_t line_no)
uint32_t reserved2; // must be zero
} BabelAESelInfo;
Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_HOST);
LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_HOST));
char file_path[PATH_MAX];
file_spec.GetPath(file_path, PATH_MAX);
CFCString file_cfstr (file_path, kCFStringEncodingUTF8);

View File

@ -61,7 +61,7 @@ ABISysV_x86_64::PrepareTrivialCall (Thread &thread,
lldb::addr_t arg,
lldb::addr_t *this_arg) const
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
if (log)
log->Printf("ABISysV_x86_64::PrepareTrivialCall\n(\n thread = %p\n sp = 0x%llx\n functionAddress = 0x%llx\n returnAddress = 0x%llx\n arg = 0x%llx\n this_arg = %p(0x%llx)\n)",

View File

@ -500,7 +500,7 @@ DynamicLoaderMacOSXDYLD::ReadAllImageInfosStructure ()
uint32_t
DynamicLoaderMacOSXDYLD::UpdateAllImageInfos()
{
Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER);
LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER));
if (ReadAllImageInfosStructure ())
{
Mutex::Locker locker(m_mutex);
@ -587,7 +587,7 @@ DynamicLoaderMacOSXDYLD::UpdateAllImageInfos()
if (old_dyld_all_image_infos[old_idx].address != LLDB_INVALID_ADDRESS)
{
if (log)
old_dyld_all_image_infos[old_idx].PutToLog (log);
old_dyld_all_image_infos[old_idx].PutToLog (log.get());
ModuleSP unload_image_module_sp(m_process->GetTarget().GetImages().FindFirstModuleForFileSpec (old_dyld_all_image_infos[old_idx].file_spec));
if (unload_image_module_sp.get())
{
@ -603,7 +603,7 @@ DynamicLoaderMacOSXDYLD::UpdateAllImageInfos()
else
{
if (log)
PutToLog(log);
PutToLog(log.get());
}
}
else
@ -1094,7 +1094,7 @@ DynamicLoaderMacOSXDYLD::GetStepThroughTrampolinePlan (Thread &thread, bool stop
StackFrame *current_frame = thread.GetStackFrameAtIndex(0).get();
const SymbolContext &current_context = current_frame->GetSymbolContext(eSymbolContextSymbol);
Symbol *current_symbol = current_context.symbol;
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (current_symbol != NULL)
{

View File

@ -340,7 +340,7 @@ AppleObjCTrampolineHandler::AppleObjCVTables::ReadRegions (lldb::addr_t region_a
if (!m_process_sp)
return false;
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
// We aren't starting at the trampoline symbol.
InitializeVTableSymbols ();
@ -494,7 +494,7 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan (Thread &thread, bool sto
if (found_it)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
lldb::StackFrameSP thread_cur_frame = thread.GetStackFrameAtIndex(0);

View File

@ -114,7 +114,7 @@ AppleThreadPlanStepThroughObjCTrampoline::ShouldStop (Event *event_ptr)
m_impl_function->DeallocateFunctionResults(exc_context, m_args_addr);
lldb::addr_t target_addr = target_addr_value.GetScalar().ULongLong();
Address target_address(NULL, target_addr);
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (target_addr == 0)
{
if (log)

View File

@ -18,6 +18,7 @@
#include "MachException.h"
#include "ProcessMacOSXLog.h"
using namespace lldb;
using namespace lldb_private;
// Routine mach_exception_raise
@ -91,7 +92,7 @@ catch_mach_exception_raise_state
mach_msg_type_number_t * new_stateCnt
)
{
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS));
if (log)
{
log->Printf("::%s ( exc_port = 0x%4.4x, exc_type = %d ( %s ), exc_data = " MACH_EXCEPTION_DATA_FMT_HEX ", exc_data_count = %d)",
@ -122,7 +123,7 @@ catch_mach_exception_raise_state_identity
)
{
kern_return_t kret;
Log * log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS));
if (log)
{
log->Printf("::%s ( exc_port = 0x%4.4x, thd_port = 0x%4.4x, tsk_port = 0x%4.4x, exc_type = %d ( %s ), exc_data[%d] = { " MACH_EXCEPTION_DATA_FMT_HEX ", " MACH_EXCEPTION_DATA_FMT_HEX " })",
@ -152,7 +153,7 @@ catch_mach_exception_raise
mach_exception_data_t exc_data,
mach_msg_type_number_t exc_data_count)
{
Log * log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS));
if (log)
{
log->Printf("::%s ( exc_port = 0x%4.4x, thd_port = 0x%4.4x, tsk_port = 0x%4.4x, exc_type = %d ( %s ), exc_data[%d] = { " MACH_EXCEPTION_DATA_FMT_HEX ", " MACH_EXCEPTION_DATA_FMT_HEX " })",
@ -215,7 +216,7 @@ MachException::Data::GetStopInfo (lldb_private::Thread &thread) const
void
MachException::Data::DumpStopReason() const
{
Log * log = ProcessMacOSXLog::GetLogIfAllCategoriesSet();
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet());
if (log)
{
int signal = SoftSignal();
@ -236,7 +237,7 @@ kern_return_t
MachException::Message::Receive(mach_port_t port, mach_msg_option_t options, mach_msg_timeout_t timeout, mach_port_t notify_port)
{
Error err;
Log * log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS));
mach_msg_timeout_t mach_msg_timeout = options & MACH_RCV_TIMEOUT ? timeout : 0;
if (log && ((options & MACH_RCV_TIMEOUT) == 0))
{
@ -313,7 +314,7 @@ MachException::Message::CatchExceptionRaise()
}
else
{
Log * log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS));
if (log)
log->Printf ("mach_exc_server returned zero...");
}
@ -329,7 +330,7 @@ MachException::Message::Reply(task_t task, pid_t pid, int signal)
// Reply to the exception...
Error err;
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet();
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet());
if (log)
log->Printf("MachException::Message::Reply (task = 0x%4.4x, pid = %i, signal = %i)", task, pid, signal);
@ -369,7 +370,7 @@ MachException::Message::Reply(task_t task, pid_t pid, int signal)
err.Clear();
if (log && log->GetMask().Test(PD_LOG_EXCEPTIONS) || err.Fail())
err.PutToLog(log, "::ptrace (request = PT_THUPDATE, pid = %i, tid = 0x%4.4x, signal = %i)", state_pid, state.thread_port, signal);
err.PutToLog(log.get(), "::ptrace (request = PT_THUPDATE, pid = %i, tid = 0x%4.4x, signal = %i)", state_pid, state.thread_port, signal);
}
err = ::mach_msg ( &reply_msg.hdr,
@ -401,18 +402,18 @@ MachException::Message::Reply(task_t task, pid_t pid, int signal)
{
if (err.GetError() == MACH_SEND_INTERRUPTED)
{
err.PutToLog(log, "::mach_msg() - send interrupted");
err.PutToLog(log.get(), "::mach_msg() - send interrupted");
}
else
{
if (state.task_port == task)
{
err.PutToLog(log, "::mach_msg() - failed (task)");
err.PutToLog(log.get(), "::mach_msg() - failed (task)");
abort ();
}
else
{
err.PutToLog(log, "::mach_msg() - failed (child of task)");
err.PutToLog(log.get(), "::mach_msg() - failed (child of task)");
}
}
}
@ -465,7 +466,7 @@ kern_return_t
MachException::PortInfo::Save (task_t task)
{
count = EXC_TYPES_COUNT;
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS));
if (log)
log->Printf ("MachException::PortInfo::Save (task = 0x%4.4x)", task);
Error err;
@ -473,7 +474,7 @@ MachException::PortInfo::Save (task_t task)
log->Printf("::task_get_exception_ports (task=0x%4.4x, mask=0x%x, maskCnt<=>%u, ports, behaviors, flavors)...", task, EXC_MASK_ALL, count);
err = ::task_get_exception_ports (task, EXC_MASK_ALL, masks, &count, ports, behaviors, flavors);
if (log || err.Fail())
err.PutToLog(log, "::task_get_exception_ports (task=0x%4.4x, mask=0x%x, maskCnt<=>%u, ports, behaviors, flavors)", task, EXC_MASK_ALL, count);
err.PutToLog(log.get(), "::task_get_exception_ports (task=0x%4.4x, mask=0x%x, maskCnt<=>%u, ports, behaviors, flavors)", task, EXC_MASK_ALL, count);
if (log)
{
mach_msg_type_number_t i;
@ -490,7 +491,7 @@ MachException::PortInfo::Save (task_t task)
kern_return_t
MachException::PortInfo::Restore (task_t task)
{
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS));
if (log && log->GetMask().Test(PD_LOG_VERBOSE))
log->Printf("MachException::PortInfo::Restore (task = 0x%4.4x)", task);
uint32_t i = 0;
@ -501,7 +502,7 @@ MachException::PortInfo::Restore (task_t task)
{
err = ::task_set_exception_ports (task, masks[i], ports[i], behaviors[i], flavors[i]);
if (log || err.Fail())
err.PutToLog(log, "::task_set_exception_ports ( task = 0x%4.4x, exception_mask = 0x%8.8x, new_port = 0x%4.4x, behavior = 0x%8.8x, new_flavor = 0x%8.8x )", task, masks[i], ports[i], behaviors[i], flavors[i]);
err.PutToLog(log.get(), "::task_set_exception_ports ( task = 0x%4.4x, exception_mask = 0x%8.8x, new_port = 0x%4.4x, behavior = 0x%8.8x, new_flavor = 0x%8.8x )", task, masks[i], ports[i], behaviors[i], flavors[i]);
if (err.Fail())
break;

View File

@ -65,9 +65,9 @@ MachTask::Suspend()
Error err;
task_t task = GetTaskPort();
err = ::task_suspend (task);
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK));
if (log || err.Fail())
err.PutToLog(log, "::task_suspend ( target_task = 0x%4.4x )", task);
err.PutToLog(log.get(), "::task_suspend ( target_task = 0x%4.4x )", task);
return err.GetError();
}
@ -81,9 +81,9 @@ MachTask::Resume()
Error err;
task_t task = GetTaskPort();
err = ::task_resume (task);
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK));
if (log || err.Fail())
err.PutToLog(log, "::task_resume ( target_task = 0x%4.4x )", task);
err.PutToLog(log.get(), "::task_resume ( target_task = 0x%4.4x )", task);
return err.GetError();
}
@ -159,14 +159,14 @@ MachTask::ReadMemory (lldb::addr_t addr, void *buf, size_t size, Error& error)
if (task != TASK_NULL)
{
n = m_vm_memory.Read(task, addr, buf, size, error);
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY));
if (log)
{
log->Printf ("MachTask::ReadMemory ( addr = 0x%16.16llx, size = %zu, buf = %8.8p) => %u bytes read", (uint64_t)addr, size, buf, n);
if (log->GetMask().Test(PD_LOG_MEMORY_DATA_LONG) || (log->GetMask().Test(PD_LOG_MEMORY_DATA_SHORT) && size <= 8))
{
DataExtractor data((uint8_t*)buf, n, eByteOrderHost, 4);
data.PutToLog(log, 0, n, addr, 16, DataExtractor::TypeUInt8);
data.PutToLog(log.get(), 0, n, addr, 16, DataExtractor::TypeUInt8);
}
}
}
@ -185,14 +185,14 @@ MachTask::WriteMemory (lldb::addr_t addr, const void *buf, size_t size, Error& e
if (task != TASK_NULL)
{
n = m_vm_memory.Write(task, addr, buf, size, error);
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY));
if (log)
{
log->Printf ("MachTask::WriteMemory ( addr = 0x%16.16llx, size = %zu, buf = %8.8p) => %u bytes written", (uint64_t)addr, size, buf, n);
if (log->GetMask().Test(PD_LOG_MEMORY_DATA_LONG) || (log->GetMask().Test(PD_LOG_MEMORY_DATA_SHORT) && size <= 8))
{
DataExtractor data((uint8_t*)buf, n, eByteOrderHost, 4);
data.PutToLog(log, 0, n, addr, 16, DataExtractor::TypeUInt8);
data.PutToLog(log.get(), 0, n, addr, 16, DataExtractor::TypeUInt8);
}
}
}
@ -212,7 +212,7 @@ MachTask::AllocateMemory (size_t size, uint32_t permissions, Error& error)
kern_return_t kret;
mach_vm_address_t addr;
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY));
kret = ::mach_vm_allocate (GetTaskPort(), &addr, size, TRUE);
if (kret == KERN_SUCCESS)
@ -295,10 +295,10 @@ MachTask::GetTaskPortForProcessID (lldb::pid_t pid, Error &err)
{
mach_port_t task_self = mach_task_self ();
err = ::task_for_pid ( task_self, pid, &task);
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK));
if (log || err.Fail())
{
err.PutToLog(log, "::task_for_pid ( target_tport = 0x%4.4x, pid = %d, task => 0x%4.4x ) %u/%u %u/%u", task_self, pid, task, getuid(), geteuid(), getgid(), getegid());
err.PutToLog(log.get(), "::task_for_pid ( target_tport = 0x%4.4x, pid = %d, task => 0x%4.4x ) %u/%u %u/%u", task_self, pid, task, getuid(), geteuid(), getgid(), getegid());
}
}
return task;
@ -326,9 +326,9 @@ MachTask::BasicInfo(task_t task, struct task_basic_info *info)
Error err;
mach_msg_type_number_t count = TASK_BASIC_INFO_COUNT;
err = ::task_info (task, TASK_BASIC_INFO, (task_info_t)info, &count);
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_TASK));
if (log || err.Fail())
err.PutToLog(log, "::task_info ( target_task = 0x%4.4x, flavor = TASK_BASIC_INFO, task_info_out => %p, task_info_outCnt => %u )", task, info, count);
err.PutToLog(log.get(), "::task_info ( target_task = 0x%4.4x, flavor = TASK_BASIC_INFO, task_info_out => %p, task_info_outCnt => %u )", task, info, count);
if (log && log->GetMask().Test(PD_LOG_VERBOSE) && err.Success())
{
float user = (float)info->user_time.seconds + (float)info->user_time.microseconds / 1000000.0f;
@ -371,7 +371,7 @@ MachTask::IsValid (task_t task)
bool
MachTask::StartExceptionThread(Error &err)
{
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS));
if (log)
log->Printf ("MachTask::%s ( )", __FUNCTION__);
@ -384,7 +384,7 @@ MachTask::StartExceptionThread(Error &err)
// Allocate an exception port that we will use to track our child process
err = ::mach_port_allocate (task_self, MACH_PORT_RIGHT_RECEIVE, &m_exception_port);
if (log || err.Fail())
err.PutToLog(log, "::mach_port_allocate (task_self=0x%4.4x, MACH_PORT_RIGHT_RECEIVE, &m_exception_port => 0x%4.4x)",
err.PutToLog(log.get(), "::mach_port_allocate (task_self=0x%4.4x, MACH_PORT_RIGHT_RECEIVE, &m_exception_port => 0x%4.4x)",
task_self, m_exception_port);
if (err.Fail())
return false;
@ -392,7 +392,7 @@ MachTask::StartExceptionThread(Error &err)
// Add the ability to send messages on the new exception port
err = ::mach_port_insert_right (task_self, m_exception_port, m_exception_port, MACH_MSG_TYPE_MAKE_SEND);
if (log || err.Fail())
err.PutToLog(log, "::mach_port_insert_right (task_self=0x%4.4x, m_exception_port=0x%4.4x, m_exception_port=0x%4.4x, MACH_MSG_TYPE_MAKE_SEND)",
err.PutToLog(log.get(), "::mach_port_insert_right (task_self=0x%4.4x, m_exception_port=0x%4.4x, m_exception_port=0x%4.4x, MACH_MSG_TYPE_MAKE_SEND)",
task_self, m_exception_port, m_exception_port);
if (err.Fail())
return false;
@ -403,7 +403,7 @@ MachTask::StartExceptionThread(Error &err)
// Set the ability to get all exceptions on this port
err = ::task_set_exception_ports (task, EXC_MASK_ALL, m_exception_port, EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES, THREAD_STATE_NONE);
if (log || err.Fail())
err.PutToLog(log, "::task_set_exception_ports (task, EXC_MASK_ALL, m_exception_port, EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES, THREAD_STATE_NONE)");
err.PutToLog(log.get(), "::task_set_exception_ports (task, EXC_MASK_ALL, m_exception_port, EXCEPTION_DEFAULT | MACH_EXCEPTION_CODES, THREAD_STATE_NONE)");
if (err.Fail())
return false;
@ -427,7 +427,7 @@ MachTask::ShutDownExceptionThread()
err = RestoreExceptionPortInfo();
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS));
// NULL our our exception port and let our exception thread exit
mach_port_t exception_port = m_exception_port;
@ -435,17 +435,17 @@ MachTask::ShutDownExceptionThread()
Host::ThreadCancel (m_exception_thread, &err);
if (log || err.Fail())
err.PutToLog(log, "Host::ThreadCancel ( thread = %p )", m_exception_thread);
err.PutToLog(log.get(), "Host::ThreadCancel ( thread = %p )", m_exception_thread);
Host::ThreadJoin (m_exception_thread, NULL, &err);
if (log || err.Fail())
err.PutToLog(log, "Host::ThreadJoin ( thread = %p, result_ptr = NULL)", m_exception_thread);
err.PutToLog(log.get(), "Host::ThreadJoin ( thread = %p, result_ptr = NULL)", m_exception_thread);
// Deallocate our exception port that we used to track our child process
mach_port_t task_self = mach_task_self ();
err = ::mach_port_deallocate (task_self, exception_port);
if (log || err.Fail())
err.PutToLog(log, "::mach_port_deallocate ( task = 0x%4.4x, name = 0x%4.4x )", task_self, exception_port);
err.PutToLog(log.get(), "::mach_port_deallocate ( task = 0x%4.4x, name = 0x%4.4x )", task_self, exception_port);
exception_port = NULL;
Clear();
@ -461,7 +461,7 @@ MachTask::ExceptionThread (void *arg)
MachTask *mach_task = (MachTask*) arg;
ProcessMacOSX *mach_proc = mach_task->Process();
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_EXCEPTIONS));
if (log)
log->Printf ("MachTask::%s (arg = %p) thread starting...", __FUNCTION__, arg);

View File

@ -335,7 +335,7 @@ kern_return_t
MachThreadContext_arm::EnableHardwareSingleStep (bool enable)
{
Error err;
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_STEP);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_STEP));
if (log) log->Printf("%s( enable = %d )", __FUNCTION__, enable);

View File

@ -14,6 +14,7 @@
#include "MachVMRegion.h"
#include "ProcessMacOSXLog.h"
using namespace lldb;
using namespace lldb_private;
MachVMMemory::MachVMMemory() :
@ -73,17 +74,17 @@ MachVMMemory::Read(task_t task, lldb::addr_t address, void *data, size_t data_co
mach_msg_type_number_t curr_bytes_read = 0;
vm_offset_t vm_memory = NULL;
error = ::mach_vm_read (task, curr_addr, curr_size, &vm_memory, &curr_bytes_read);
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY|PD_LOG_VERBOSE);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY|PD_LOG_VERBOSE));
if (log || error.Fail())
error.PutToLog (log, "::mach_vm_read (task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, data => %8.8p, dataCnt => %i)", task, (uint64_t)curr_addr, (uint64_t)curr_size, vm_memory, curr_bytes_read);
error.PutToLog (log.get(), "::mach_vm_read (task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, data => %8.8p, dataCnt => %i)", task, (uint64_t)curr_addr, (uint64_t)curr_size, vm_memory, curr_bytes_read);
if (error.Success())
{
if (curr_bytes_read != curr_size)
{
if (log)
error.PutToLog (log, "::mach_vm_read (task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, data => %8.8p, dataCnt=>%i) only read %u of %llu bytes", task, (uint64_t)curr_addr, (uint64_t)curr_size, vm_memory, curr_bytes_read, curr_bytes_read, (uint64_t)curr_size);
error.PutToLog (log.get(), "::mach_vm_read (task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, data => %8.8p, dataCnt=>%i) only read %u of %llu bytes", task, (uint64_t)curr_addr, (uint64_t)curr_size, vm_memory, curr_bytes_read, curr_bytes_read, (uint64_t)curr_size);
}
::memcpy (curr_data, (void *)vm_memory, curr_bytes_read);
::vm_deallocate (mach_task_self (), vm_memory, curr_bytes_read);
@ -168,16 +169,16 @@ MachVMMemory::WriteRegion(task_t task, const lldb::addr_t address, const void *d
{
mach_msg_type_number_t curr_data_count = MaxBytesLeftInPage(curr_addr, data_count - total_bytes_written);
error = ::mach_vm_write (task, curr_addr, (pointer_t) curr_data, curr_data_count);
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY));
if (log || error.Fail())
error.PutToLog (log, "::mach_vm_write ( task = 0x%4.4x, addr = 0x%8.8llx, data = %8.8p, dataCnt = %u )", task, (uint64_t)curr_addr, curr_data, curr_data_count);
error.PutToLog (log.get(), "::mach_vm_write ( task = 0x%4.4x, addr = 0x%8.8llx, data = %8.8p, dataCnt = %u )", task, (uint64_t)curr_addr, curr_data, curr_data_count);
#if defined (__powerpc__) || defined (__ppc__)
vm_machine_attribute_val_t mattr_value = MATTR_VAL_CACHE_FLUSH;
error = ::vm_machine_attribute (task, curr_addr, curr_data_count, MATTR_CACHE, &mattr_value);
if (log || error.Fail())
error.Log(log, "::vm_machine_attribute ( task = 0x%4.4x, addr = 0x%8.8llx, size = %u, attr = MATTR_CACHE, mattr_value => MATTR_VAL_CACHE_FLUSH )", task, (uint64_t)curr_addr, curr_data_count);
error.Log(log.get(), "::vm_machine_attribute ( task = 0x%4.4x, addr = 0x%8.8llx, size = %u, attr = MATTR_CACHE, mattr_value => MATTR_VAL_CACHE_FLUSH )", task, (uint64_t)curr_addr, curr_data_count);
#endif
if (error.Success())

View File

@ -12,6 +12,7 @@
#include "MachVMRegion.h"
#include "ProcessMacOSXLog.h"
using namespace lldb;
using namespace lldb_private;
MachVMRegion::MachVMRegion(task_t task) :
@ -61,7 +62,7 @@ MachVMRegion::SetProtections(mach_vm_address_t addr, mach_vm_size_t size, vm_pro
prot_size = end_addr - addr;
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY_PROTECTIONS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY_PROTECTIONS));
if (prot_size > 0)
{
if (prot == (m_curr_protection & VM_PROT_ALL))
@ -75,13 +76,13 @@ MachVMRegion::SetProtections(mach_vm_address_t addr, mach_vm_size_t size, vm_pro
{
m_err = ::mach_vm_protect (m_task, addr, prot_size, 0, prot);
if (log || m_err.Fail())
m_err.PutToLog(log, "::mach_vm_protect ( task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, set_max = %i, prot = %u )", m_task, (uint64_t)addr, (uint64_t)prot_size, 0, prot);
m_err.PutToLog(log.get(), "::mach_vm_protect ( task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, set_max = %i, prot = %u )", m_task, (uint64_t)addr, (uint64_t)prot_size, 0, prot);
if (m_err.Fail())
{
// Try again with the ability to create a copy on write region
m_err = ::mach_vm_protect (m_task, addr, prot_size, 0, prot | VM_PROT_COPY);
if (log || m_err.Fail())
m_err.PutToLog(log, "::mach_vm_protect ( task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, set_max = %i, prot = %u )", m_task, (uint64_t)addr, (uint64_t)prot_size, 0, prot | VM_PROT_COPY);
m_err.PutToLog(log.get(), "::mach_vm_protect ( task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, set_max = %i, prot = %u )", m_task, (uint64_t)addr, (uint64_t)prot_size, 0, prot | VM_PROT_COPY);
}
if (m_err.Success())
{
@ -106,9 +107,9 @@ MachVMRegion::RestoreProtections()
if (m_curr_protection != m_data.protection && m_protection_size > 0)
{
m_err = ::mach_vm_protect (m_task, m_protection_addr, m_protection_size, 0, m_data.protection);
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY_PROTECTIONS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY_PROTECTIONS));
if (log || m_err.Fail())
m_err.PutToLog(log, "::mach_vm_protect ( task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, set_max = %i, prot = %u )", m_task, (uint64_t)m_protection_addr, (uint64_t)m_protection_size, 0, m_data.protection);
m_err.PutToLog(log.get(), "::mach_vm_protect ( task = 0x%4.4x, addr = 0x%8.8llx, size = %llu, set_max = %i, prot = %u )", m_task, (uint64_t)m_protection_addr, (uint64_t)m_protection_size, 0, m_data.protection);
if (m_err.Success())
{
m_protection_size = 0;
@ -137,9 +138,9 @@ MachVMRegion::GetRegionForAddress(lldb::addr_t addr)
mach_msg_type_number_t info_size = kRegionInfoSize;
assert(sizeof(info_size) == 4);
m_err = ::mach_vm_region_recurse (m_task, &m_start, &m_size, &m_depth, (vm_region_recurse_info_t)&m_data, &info_size);
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY_PROTECTIONS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_MEMORY_PROTECTIONS));
if (log || m_err.Fail())
m_err.PutToLog(log, "::mach_vm_region_recurse ( task = 0x%4.4x, address => 0x%8.8llx, size => %llu, nesting_depth => %d, info => %p, infoCnt => %d) addr = 0x%8.8llx ", m_task, (uint64_t)m_start, (uint64_t)m_size, m_depth, &m_data, info_size, (uint64_t)addr);
m_err.PutToLog(log.get(), "::mach_vm_region_recurse ( task = 0x%4.4x, address => 0x%8.8llx, size => %llu, nesting_depth => %d, info => %p, infoCnt => %d) addr = 0x%8.8llx ", m_task, (uint64_t)m_start, (uint64_t)m_size, m_depth, &m_data, info_size, (uint64_t)addr);
if (m_err.Fail())
{
return false;

View File

@ -108,7 +108,7 @@ using namespace lldb_private;
//{
// const lldb::pid_t pid = *((lldb::user_id_t *)pid_ptr);
//
// Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD);
// LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD));
//
// if (log)
// log->Printf ("ProcessMacOSX::%s (arg = %p) thread starting...", __FUNCTION__, pid_ptr);
@ -357,7 +357,7 @@ ProcessMacOSX::DoAttachToProcessWithID (lldb::pid_t attach_pid)
// figure out a good way to determine the arch of what we are attaching to
m_arch_spec = m_target.GetArchitecture();
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS));
if (attach_pid != LLDB_INVALID_PROCESS_ID)
{
SetID(attach_pid);
@ -583,7 +583,7 @@ uint32_t
ProcessMacOSX::UpdateThreadListIfNeeded ()
{
// locker will keep a mutex locked until it goes out of scope
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD));
if (log && log->GetMask().Test(PD_LOG_VERBOSE))
log->Printf ("ProcessMacOSX::%s (pid = %4.4x)", __FUNCTION__, GetID());
@ -597,7 +597,7 @@ ProcessMacOSX::UpdateThreadListIfNeeded ()
Error err(::task_threads (task, &thread_list, &thread_list_count), eErrorTypeMachKernel);
if (log || err.Fail())
err.PutToLog(log, "::task_threads ( task = 0x%4.4x, thread_list => %p, thread_list_count => %u )", task, thread_list, thread_list_count);
err.PutToLog(log.get(), "::task_threads ( task = 0x%4.4x, thread_list => %p, thread_list_count => %u )", task, thread_list, thread_list_count);
if (err.GetError() == KERN_SUCCESS && thread_list_count > 0)
{
@ -651,7 +651,7 @@ ProcessMacOSX::RefreshStateAfterStop ()
m_thread_list.RefreshStateAfterStop();
// Let each thread know of any exceptions
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS));
task_t task = Task().GetTaskPort();
size_t i;
for (i=0; i<m_exception_messages.size(); ++i)
@ -668,7 +668,7 @@ ProcessMacOSX::RefreshStateAfterStop ()
}
}
if (log)
m_exception_messages[i].PutToLog(log);
m_exception_messages[i].PutToLog(log.get());
}
}
@ -697,7 +697,7 @@ Error
ProcessMacOSX::DoSIGSTOP (bool clear_all_breakpoints)
{
Error error;
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS));
if (log)
log->Printf ("ProcessMacOSX::DoSIGSTOP()");
@ -730,7 +730,7 @@ ProcessMacOSX::DoSIGSTOP (bool clear_all_breakpoints)
error.SetErrorToErrno();
if (error.Fail())
error.PutToLog(log, "::kill (pid = %i, SIGSTOP)", pid);
error.PutToLog(log.get(), "::kill (pid = %i, SIGSTOP)", pid);
timeout_time = TimeValue::Now();
timeout_time.OffsetWithSeconds(2);
@ -781,7 +781,7 @@ ProcessMacOSX::DoSIGSTOP (bool clear_all_breakpoints)
log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS);
if (log || error.Fail())
error.PutToLog(log, "ProcessMacOSX::DoSIGSTOP() ::kill (pid = %i, SIGSTOP)", pid);
error.PutToLog(log.get(), "ProcessMacOSX::DoSIGSTOP() ::kill (pid = %i, SIGSTOP)", pid);
error = PrivateResume(LLDB_INVALID_THREAD_ID);
@ -823,7 +823,7 @@ Error
ProcessMacOSX::DoDestroy ()
{
Error error;
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS));
if (log)
log->Printf ("ProcessMacOSX::DoDestroy()");
@ -863,7 +863,7 @@ ProcessMacOSX::DoDestroy ()
error.SetErrorToErrno();
if (log || error.Fail())
error.PutToLog (log, "::ptrace (PT_KILL, %u, 0, 0)", pid);
error.PutToLog (log.get(), "::ptrace (PT_KILL, %u, 0, 0)", pid);
// Resume our task and let the SIGKILL do its thing. The thread named
// "ProcessMacOSX::WaitForChildProcessToExit(void*)" will catch the
@ -1003,7 +1003,7 @@ ProcessMacOSX::EnableBreakpoint (BreakpointSite *bp_site)
const lldb::addr_t addr = bp_site->GetLoadAddress();
const lldb::user_id_t site_id = bp_site->GetID();
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_BREAKPOINTS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_BREAKPOINTS));
if (log)
log->Printf ("ProcessMacOSX::EnableBreakpoint (site_id = %d) addr = 0x%8.8llx", site_id, (uint64_t)addr);
@ -1044,7 +1044,7 @@ ProcessMacOSX::DisableBreakpoint (BreakpointSite *bp_site)
const lldb::addr_t addr = bp_site->GetLoadAddress();
const lldb::user_id_t site_id = bp_site->GetID();
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_BREAKPOINTS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_BREAKPOINTS));
if (log)
log->Printf ("ProcessMacOSX::DisableBreakpoint (site_id = %d) addr = 0x%8.8llx", site_id, (uint64_t)addr);
@ -1066,7 +1066,7 @@ ProcessMacOSX::EnableWatchpoint (WatchpointLocation *wp)
{
lldb::user_id_t watchID = wp->GetID();
lldb::addr_t addr = wp->GetLoadAddress();
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_WATCHPOINTS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_WATCHPOINTS));
if (log)
log->Printf ("ProcessMacOSX::EnableWatchpoint(watchID = %d)", watchID);
if (wp->IsEnabled())
@ -1092,7 +1092,7 @@ ProcessMacOSX::DisableWatchpoint (WatchpointLocation *wp)
{
lldb::user_id_t watchID = wp->GetID();
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_WATCHPOINTS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_WATCHPOINTS));
lldb::addr_t addr = wp->GetLoadAddress();
if (log)
@ -1222,7 +1222,7 @@ ProcessMacOSX::STDIOThread(void *arg)
{
ProcessMacOSX *proc = (ProcessMacOSX*) arg;
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS));
if (log)
log->Printf ("ProcessMacOSX::%s (arg = %p) thread starting...", __FUNCTION__, arg);
@ -1270,7 +1270,7 @@ ProcessMacOSX::STDIOThread(void *arg)
if (log)
{
err.SetError (select_errno, eErrorTypePOSIX);
err.LogIfError(log, "select (nfds, &read_fds, NULL, NULL, NULL) => %d", num_set_fds);
err.LogIfError(log.get(), "select (nfds, &read_fds, NULL, NULL, NULL) => %d", num_set_fds);
}
switch (select_errno)
@ -1359,13 +1359,13 @@ Error
ProcessMacOSX::DoSignal (int signal)
{
Error error;
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS));
if (log)
log->Printf ("ProcessMacOSX::DoSignal (signal = %d)", signal);
if (::kill (GetID(), signal) != 0)
{
error.SetErrorToErrno();
error.LogIfError(log, "ProcessMacOSX::DoSignal (%d)", signal);
error.LogIfError(log.get(), "ProcessMacOSX::DoSignal (%d)", signal);
}
return error;
}
@ -1374,7 +1374,7 @@ ProcessMacOSX::DoSignal (int signal)
Error
ProcessMacOSX::DoDetach()
{
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_PROCESS));
if (log)
log->Printf ("ProcessMacOSX::DoDetach()");
@ -1404,7 +1404,7 @@ ProcessMacOSX::DoDetach()
error.SetErrorToErrno();
if (log || error.Fail())
error.PutToLog(log, "::ptrace (PT_DETACH, %u, (caddr_t)1, 0)", pid);
error.PutToLog(log.get(), "::ptrace (PT_DETACH, %u, (caddr_t)1, 0)", pid);
// Resume our task
Task().Resume();
@ -1429,7 +1429,7 @@ ProcessMacOSX::ReplyToAllExceptions()
Mutex::Locker locker(m_exception_messages_mutex);
if (m_exception_messages.empty() == false)
{
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_EXCEPTIONS));
MachException::Message::iterator pos;
MachException::Message::iterator begin = m_exception_messages.begin();
@ -1448,7 +1448,7 @@ ProcessMacOSX::ReplyToAllExceptions()
if (curr_error.Fail() && error.Success())
error = curr_error;
error.LogIfError(log, "Error replying to exception");
error.LogIfError(log.get(), "Error replying to exception");
}
// Erase all exception message as we should have used and replied
@ -1577,7 +1577,7 @@ ProcessMacOSX::LaunchForDebug
if (launch_type == eLaunchDefault)
launch_type = eLaunchPosixSpawn;
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS));
if (log)
log->Printf ("%s( path = '%s', argv = %p, envp = %p, launch_type = %u, flags = %x )", __FUNCTION__, path, argv, envp, launch_type, flags);
@ -1655,7 +1655,7 @@ ProcessMacOSX::LaunchForDebug
log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS);
if (launch_err.Fail() || log)
launch_err.PutToLog(log, "::ptrace (PT_ATTACHEXC, pid = %i, 0, 0 )", pid);
launch_err.PutToLog(log.get(), "::ptrace (PT_ATTACHEXC, pid = %i, 0, 0 )", pid);
if (launch_err.Success())
m_flags.Set (eFlagsAttached);
@ -1698,14 +1698,14 @@ ProcessMacOSX::PosixSpawnChildForPTraceDebugging
{
posix_spawnattr_t attr;
short flags;
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_PROCESS));
Error local_err; // Errors that don't affect the spawning.
if (log)
log->Printf ("%s ( path='%s', argv=%p, envp=%p, process )", __FUNCTION__, path, argv, envp);
err.SetError( ::posix_spawnattr_init (&attr), eErrorTypePOSIX);
if (err.Fail() || log)
err.PutToLog(log, "::posix_spawnattr_init ( &attr )");
err.PutToLog(log.get(), "::posix_spawnattr_init ( &attr )");
if (err.Fail())
return LLDB_INVALID_PROCESS_ID;
@ -1715,7 +1715,7 @@ ProcessMacOSX::PosixSpawnChildForPTraceDebugging
err.SetError( ::posix_spawnattr_setflags (&attr, flags), eErrorTypePOSIX);
if (err.Fail() || log)
err.PutToLog(log, "::posix_spawnattr_setflags ( &attr, POSIX_SPAWN_START_SUSPENDED%s )", disable_aslr ? " | _POSIX_SPAWN_DISABLE_ASLR" : "");
err.PutToLog(log.get(), "::posix_spawnattr_setflags ( &attr, POSIX_SPAWN_START_SUSPENDED%s )", disable_aslr ? " | _POSIX_SPAWN_DISABLE_ASLR" : "");
if (err.Fail())
return LLDB_INVALID_PROCESS_ID;
@ -1732,7 +1732,7 @@ ProcessMacOSX::PosixSpawnChildForPTraceDebugging
size_t ocount = 0;
err.SetError( ::posix_spawnattr_setbinpref_np (&attr, 1, &cpu, &ocount), eErrorTypePOSIX);
if (err.Fail() || log)
err.PutToLog(log, "::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %zu )", cpu, ocount);
err.PutToLog(log.get(), "::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %zu )", cpu, ocount);
if (err.Fail() != 0 || ocount != 1)
return LLDB_INVALID_PROCESS_ID;
@ -1747,7 +1747,7 @@ ProcessMacOSX::PosixSpawnChildForPTraceDebugging
err.SetError( ::posix_spawn_file_actions_init (&file_actions), eErrorTypePOSIX);
int file_actions_valid = err.Success();
if (!file_actions_valid || log)
err.PutToLog(log, "::posix_spawn_file_actions_init ( &file_actions )");
err.PutToLog(log.get(), "::posix_spawn_file_actions_init ( &file_actions )");
Error stdio_err;
lldb::pid_t pid = LLDB_INVALID_PROCESS_ID;
if (file_actions_valid)
@ -1760,21 +1760,21 @@ ProcessMacOSX::PosixSpawnChildForPTraceDebugging
{
stdio_err.SetError( ::posix_spawn_file_actions_addopen(&file_actions, STDERR_FILENO, stderr_path, O_RDWR, 0), eErrorTypePOSIX);
if (stdio_err.Fail() || log)
stdio_err.PutToLog(log, "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDERR_FILENO, path = '%s', oflag = O_RDWR, mode = 0 )", stderr_path);
stdio_err.PutToLog(log.get(), "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDERR_FILENO, path = '%s', oflag = O_RDWR, mode = 0 )", stderr_path);
}
if (stdin_path != NULL && stdin_path[0])
{
stdio_err.SetError( ::posix_spawn_file_actions_addopen(&file_actions, STDIN_FILENO, stdin_path, O_RDONLY, 0), eErrorTypePOSIX);
if (stdio_err.Fail() || log)
stdio_err.PutToLog(log, "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDIN_FILENO, path = '%s', oflag = O_RDONLY, mode = 0 )", stdin_path);
stdio_err.PutToLog(log.get(), "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDIN_FILENO, path = '%s', oflag = O_RDONLY, mode = 0 )", stdin_path);
}
if (stdout_path != NULL && stdout_path[0])
{
stdio_err.SetError( ::posix_spawn_file_actions_addopen(&file_actions, STDOUT_FILENO, stdout_path, O_WRONLY, 0), eErrorTypePOSIX);
if (stdio_err.Fail() || log)
stdio_err.PutToLog(log, "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDOUT_FILENO, path = '%s', oflag = O_WRONLY, mode = 0 )", stdout_path);
stdio_err.PutToLog(log.get(), "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDOUT_FILENO, path = '%s', oflag = O_WRONLY, mode = 0 )", stdout_path);
}
}
else
@ -1792,15 +1792,15 @@ ProcessMacOSX::PosixSpawnChildForPTraceDebugging
slave_name = "/dev/null";
stdio_err.SetError( ::posix_spawn_file_actions_addopen(&file_actions, STDERR_FILENO, slave_name, O_RDWR|O_NOCTTY, 0), eErrorTypePOSIX);
if (stdio_err.Fail() || log)
stdio_err.PutToLog(log, "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDERR_FILENO, path = '%s', oflag = O_RDWR|O_NOCTTY, mode = 0 )", slave_name);
stdio_err.PutToLog(log.get(), "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDERR_FILENO, path = '%s', oflag = O_RDWR|O_NOCTTY, mode = 0 )", slave_name);
stdio_err.SetError( ::posix_spawn_file_actions_addopen(&file_actions, STDIN_FILENO, slave_name, O_RDONLY|O_NOCTTY, 0), eErrorTypePOSIX);
if (stdio_err.Fail() || log)
stdio_err.PutToLog(log, "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDIN_FILENO, path = '%s', oflag = O_RDONLY|O_NOCTTY, mode = 0 )", slave_name);
stdio_err.PutToLog(log.get(), "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDIN_FILENO, path = '%s', oflag = O_RDONLY|O_NOCTTY, mode = 0 )", slave_name);
stdio_err.SetError( ::posix_spawn_file_actions_addopen(&file_actions, STDOUT_FILENO, slave_name, O_WRONLY|O_NOCTTY, 0), eErrorTypePOSIX);
if (stdio_err.Fail() || log)
stdio_err.PutToLog(log, "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDOUT_FILENO, path = '%s', oflag = O_WRONLY|O_NOCTTY, mode = 0 )", slave_name);
stdio_err.PutToLog(log.get(), "::posix_spawn_file_actions_addopen ( &file_actions, filedes = STDOUT_FILENO, path = '%s', oflag = O_WRONLY|O_NOCTTY, mode = 0 )", slave_name);
}
else
{
@ -1813,7 +1813,7 @@ ProcessMacOSX::PosixSpawnChildForPTraceDebugging
}
err.SetError( ::posix_spawnp (&pid, path, &file_actions, &attr, (char * const*)argv, (char * const*)envp), eErrorTypePOSIX);
if (err.Fail() || log)
err.PutToLog(log, "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", pid, path, &file_actions, &attr, argv, envp);
err.PutToLog(log.get(), "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", pid, path, &file_actions, &attr, argv, envp);
if (stdio_err.Success())
{
@ -1831,7 +1831,7 @@ ProcessMacOSX::PosixSpawnChildForPTraceDebugging
{
err.SetError( ::posix_spawnp (&pid, path, NULL, &attr, (char * const*)argv, (char * const*)envp), eErrorTypePOSIX);
if (err.Fail() || log)
err.PutToLog(log, "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", pid, path, NULL, &attr, argv, envp);
err.PutToLog(log.get(), "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", pid, path, NULL, &attr, argv, envp);
}
::posix_spawnattr_destroy (&attr);
@ -1845,7 +1845,7 @@ ProcessMacOSX::PosixSpawnChildForPTraceDebugging
{
local_err.SetError( ::posix_spawn_file_actions_destroy (&file_actions), eErrorTypePOSIX);
if (local_err.Fail() || log)
local_err.PutToLog(log, "::posix_spawn_file_actions_destroy ( &file_actions )");
local_err.PutToLog(log.get(), "::posix_spawn_file_actions_destroy ( &file_actions )");
}
return pid;

View File

@ -17,29 +17,38 @@
using namespace lldb;
using namespace lldb_private;
// We want to avoid global constructors where code needs to be run so here we
// control access to our static g_log_sp by hiding it in a singleton function
// that will construct the static g_lob_sp the first time this function is
// called.
static LogSP &
GetLog ()
{
static LogSP g_log_sp;
return g_log_sp;
}
static Log* g_log = NULL; // Leak for now as auto_ptr was being cleaned up
// by global constructors before other threads
// were done with it.
Log *
LogSP
ProcessMacOSXLog::GetLogIfAllCategoriesSet (uint32_t mask)
{
Log *log = g_log;
LogSP log(GetLog ());
if (log && mask)
{
uint32_t log_mask = log->GetMask().Get();
if ((log_mask & mask) != mask)
return NULL;
return LogSP();
}
return log;
}
void
ProcessMacOSXLog::DisableLog (Args &args, Stream *feedback_strm)
{
if (g_log)
LogSP log (GetLog ());
if (log)
{
uint32_t flag_bits = g_log->GetMask().Get();
uint32_t flag_bits = log->GetMask().Get();
const size_t argc = args.GetArgumentCount ();
for (size_t i = 0; i < argc; ++i)
{
@ -65,28 +74,32 @@ ProcessMacOSXLog::DisableLog (Args &args, Stream *feedback_strm)
}
}
if (flag_bits == 0)
DeleteLog ();
GetLog().reset();
else
g_log->GetMask().Reset (flag_bits);
log->GetMask().Reset (flag_bits);
}
}
void
ProcessMacOSXLog::DeleteLog ()
{
if (g_log)
{
delete g_log;
g_log = NULL;
}
}
Log *
LogSP
ProcessMacOSXLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm)
{
DeleteLog ();
g_log = new Log (log_stream_sp);
if (g_log)
// Try see if there already is a log - that way we can reuse its settings.
// We could reuse the log in toto, but we don't know that the stream is the same.
uint32_t flag_bits;
LogSP log(GetLog ());
if (log)
flag_bits = log->GetMask().Get();
else
flag_bits = 0;
// Now make a new log with this stream if one was provided
if (log_stream_sp)
{
log = make_shared<Log>(log_stream_sp);
GetLog () = log;
}
if (log)
{
uint32_t flag_bits = 0;
bool got_unknown_category = false;
@ -121,10 +134,10 @@ ProcessMacOSXLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args
}
if (flag_bits == 0)
flag_bits = PD_LOG_DEFAULT;
g_log->GetMask().Reset(flag_bits);
g_log->GetOptions().Reset(log_options);
log->GetMask().Reset(flag_bits);
log->GetOptions().Reset(log_options);
}
return g_log;
return log;
}
void
@ -150,7 +163,7 @@ ProcessMacOSXLog::ListLogCategories (Stream *strm)
void
ProcessMacOSXLog::LogIf (uint32_t mask, const char *format, ...)
{
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (mask);
LogSP log(ProcessMacOSXLog::GetLogIfAllCategoriesSet (mask));
if (log)
{
va_list args;

View File

@ -43,7 +43,7 @@
class ProcessMacOSXLog
{
public:
static lldb_private::Log *
static lldb::LogSP
GetLogIfAllCategoriesSet(uint32_t mask = 0);
static void
@ -52,7 +52,7 @@ public:
static void
DeleteLog ();
static lldb_private::Log *
static lldb::LogSP
EnableLog (lldb::StreamSP &log_stream_sp, uint32_t log_options, lldb_private::Args &args, lldb_private::Stream *feedback_strm);
static void

View File

@ -450,7 +450,7 @@ RegisterContextMach_i386::ReadGPR (bool force)
{
mach_msg_type_number_t count = GPRWordCount;
SetError(set, Read, ::thread_get_state(GetThreadID(), set, (thread_state_t)&gpr, &count));
LogGPR (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD), "RegisterContextMach_i386::ReadGPR()");
LogGPR (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD).get(), "RegisterContextMach_i386::ReadGPR()");
}
return GetError(set, Read);
}

View File

@ -494,9 +494,9 @@ RegisterContextMach_x86_64::ReadGPR (bool force)
{
mach_msg_type_number_t count = GPRWordCount;
SetError(GPRRegSet, Read, ::thread_get_state(GetThreadID(), set, (thread_state_t)&gpr, &count));
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD));
if (log)
LogGPR (log, "RegisterContextMach_x86_64::ReadGPR(thread = 0x%4.4x)", GetThreadID());
LogGPR (log.get(), "RegisterContextMach_x86_64::ReadGPR(thread = 0x%4.4x)", GetThreadID());
}
return GetError(GPRRegSet, Read);
}
@ -534,9 +534,9 @@ RegisterContextMach_x86_64::WriteGPR ()
SetError (set, Write, -1);
return KERN_INVALID_ARGUMENT;
}
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet (PD_LOG_THREAD));
if (log)
LogGPR (log, "RegisterContextMach_x86_64::WriteGPR (thread = 0x%4.4x)", GetThreadID());
LogGPR (log.get(), "RegisterContextMach_x86_64::WriteGPR (thread = 0x%4.4x)", GetThreadID());
SetError (set, Write, ::thread_set_state(GetThreadID(), set, (thread_state_t)&gpr, GPRWordCount));
SetError (set, Read, -1);
return GetError (set, Write);

View File

@ -248,7 +248,7 @@ ThreadMacOSX::ClearStackFrames ()
int32_t
ThreadMacOSX::Suspend()
{
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD));
if (log && log->GetMask().Test(PD_LOG_VERBOSE))
log->Printf ("ThreadMacOSX::%s ( )", __FUNCTION__);
lldb::tid_t tid = GetID ();
@ -259,7 +259,7 @@ ThreadMacOSX::Suspend()
m_suspend_count++;
log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD);
if (log || err.Fail())
err.PutToLog(log, "::thread_suspend (%4.4x)", tid);
err.PutToLog(log.get(), "::thread_suspend (%4.4x)", tid);
}
return GetSuspendCount();
}
@ -267,7 +267,7 @@ ThreadMacOSX::Suspend()
int32_t
ThreadMacOSX::Resume()
{
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD));
if (log && log->GetMask().Test(PD_LOG_VERBOSE))
log->Printf ("ThreadMacOSX::%s ()", __FUNCTION__);
lldb::tid_t tid = GetID ();
@ -280,7 +280,7 @@ ThreadMacOSX::Resume()
m_suspend_count--;
log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD);
if (log || err.Fail())
err.PutToLog(log, "::thread_resume (%4.4x)", tid);
err.PutToLog(log.get(), "::thread_resume (%4.4x)", tid);
}
}
return GetSuspendCount();
@ -289,7 +289,7 @@ ThreadMacOSX::Resume()
bool
ThreadMacOSX::RestoreSuspendCount()
{
Log *log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD);
LogSP log (ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD));
if (log && log->GetMask().Test(PD_LOG_VERBOSE))
log->Printf ("ThreadMacOSX::%s ( )", __FUNCTION__);
Error err;
@ -305,7 +305,7 @@ ThreadMacOSX::RestoreSuspendCount()
--m_suspend_count;
log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD);
if (log || err.Fail())
err.PutToLog(log, "::thread_resume (%4.4x)", tid);
err.PutToLog(log.get(), "::thread_resume (%4.4x)", tid);
}
}
else if (m_suspend_count < m_basic_info.suspend_count)
@ -317,7 +317,7 @@ ThreadMacOSX::RestoreSuspendCount()
--m_suspend_count;
log = ProcessMacOSXLog::GetLogIfAllCategoriesSet(PD_LOG_THREAD);
if (log || err.Fail())
err.PutToLog(log, "::thread_suspend (%4.4x)", tid);
err.PutToLog(log.get(), "::thread_suspend (%4.4x)", tid);
}
}
return m_suspend_count == m_basic_info.suspend_count;

View File

@ -147,7 +147,7 @@ RegisterContextLLDB::InitializeZerothFrame()
m_cfa = cfa_regval + cfa_offset;
Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND);
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
// A couple of sanity checks..
if (cfa_regval == LLDB_INVALID_ADDRESS || cfa_regval == 0 || cfa_regval == 1)
@ -176,7 +176,7 @@ RegisterContextLLDB::InitializeZerothFrame()
void
RegisterContextLLDB::InitializeNonZerothFrame()
{
Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND);
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
if (IsFrameZero ())
{
m_frame_type = eNotAValidFrame;
@ -416,7 +416,7 @@ RegisterContextLLDB::GetFastUnwindPlanForFrame ()
if (fu->GetUnwindPlanFastUnwind (m_thread)
&& fu->GetUnwindPlanFastUnwind (m_thread)->PlanValidAtAddress (m_current_pc))
{
Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND);
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
if (log && IsLogVerbose())
{
const char *has_fast = "";
@ -441,7 +441,7 @@ RegisterContextLLDB::GetFastUnwindPlanForFrame ()
UnwindPlan *
RegisterContextLLDB::GetFullUnwindPlanForFrame ()
{
Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND);
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
UnwindPlan *up;
UnwindPlan *arch_default_up = NULL;
ArchSpec arch = m_thread.GetProcess().GetTarget().GetArchitecture ();
@ -687,7 +687,7 @@ RegisterContextLLDB::IsValid () const
bool
RegisterContextLLDB::SavedLocationForRegister (uint32_t lldb_regnum, RegisterLocation &regloc)
{
Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND);
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
// Have we already found this register location?
std::map<uint32_t, RegisterLocation>::const_iterator iterator;
@ -976,7 +976,7 @@ RegisterContextLLDB::ReadGPRValue (int register_kind, uint32_t regnum, addr_t &v
bool
RegisterContextLLDB::ReadRegisterBytes (uint32_t lldb_reg, DataExtractor& data)
{
Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND);
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
if (!IsValid())
return false;

View File

@ -31,7 +31,7 @@ UnwindLLDB::UnwindLLDB (Thread &thread) :
uint32_t
UnwindLLDB::GetFrameCount()
{
Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND);
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
if (m_frames.empty())
{
// First, set up the 0th (initial) frame

View File

@ -193,8 +193,8 @@ GDBRemoteCommunication::SendContinuePacketAndWaitForResponse
StringExtractorGDBRemote &response
)
{
Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
Log *async_log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_ASYNC);
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
LogSP async_log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_ASYNC));
if (log)
log->Printf ("GDBRemoteCommunication::%s ()", __FUNCTION__);

View File

@ -633,7 +633,7 @@ ProcessGDBRemote::DoAttachToProcessWithID (lldb::pid_t attach_pid)
Clear();
ArchSpec arch_spec = GetTarget().GetArchitecture();
//Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
//LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
if (attach_pid != LLDB_INVALID_PROCESS_ID)
@ -735,7 +735,7 @@ ProcessGDBRemote::DoAttachToProcessWithName (const char *process_name, bool wait
// HACK: require arch be set correctly at the target level until we can
// figure out a good way to determine the arch of what we are attaching to
//Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
//LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
if (process_name && process_name[0])
{
char host_port[128];
@ -948,7 +948,7 @@ uint32_t
ProcessGDBRemote::UpdateThreadListIfNeeded ()
{
// locker will keep a mutex locked until it goes out of scope
Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_THREAD);
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_THREAD));
if (log && log->GetMask().Test(GDBR_LOG_VERBOSE))
log->Printf ("ProcessGDBRemote::%s (pid = %i)", __FUNCTION__, GetID());
@ -1166,7 +1166,7 @@ Error
ProcessGDBRemote::DoDetach()
{
Error error;
Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS);
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
if (log)
log->Printf ("ProcessGDBRemote::DoDetach()");
@ -1199,7 +1199,7 @@ Error
ProcessGDBRemote::DoDestroy ()
{
Error error;
Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS);
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
if (log)
log->Printf ("ProcessGDBRemote::DoDestroy()");
@ -1407,7 +1407,7 @@ ProcessGDBRemote::EnableBreakpoint (BreakpointSite *bp_site)
Error error;
assert (bp_site != NULL);
Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_BREAKPOINTS);
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_BREAKPOINTS));
user_id_t site_id = bp_site->GetID();
const addr_t addr = bp_site->GetLoadAddress();
if (log)
@ -1483,7 +1483,7 @@ ProcessGDBRemote::DisableBreakpoint (BreakpointSite *bp_site)
assert (bp_site != NULL);
addr_t addr = bp_site->GetLoadAddress();
user_id_t site_id = bp_site->GetID();
Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_BREAKPOINTS);
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_BREAKPOINTS));
if (log)
log->Printf ("ProcessGDBRemote::DisableBreakpoint (site_id = %d) addr = 0x%8.8llx", site_id, (uint64_t)addr);
@ -1550,7 +1550,7 @@ ProcessGDBRemote::EnableWatchpoint (WatchpointLocation *wp)
{
user_id_t watchID = wp->GetID();
addr_t addr = wp->GetLoadAddress();
Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_WATCHPOINTS);
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_WATCHPOINTS));
if (log)
log->Printf ("ProcessGDBRemote::EnableWatchpoint(watchID = %d)", watchID);
if (wp->IsEnabled())
@ -1582,7 +1582,7 @@ ProcessGDBRemote::DisableWatchpoint (WatchpointLocation *wp)
{
user_id_t watchID = wp->GetID();
Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_WATCHPOINTS);
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_WATCHPOINTS));
addr_t addr = wp->GetLoadAddress();
if (log)
@ -1620,7 +1620,7 @@ Error
ProcessGDBRemote::DoSignal (int signo)
{
Error error;
Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS);
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
if (log)
log->Printf ("ProcessGDBRemote::DoSignal (signal = %d)", signo);
@ -1706,14 +1706,14 @@ ProcessGDBRemote::StartDebugserverProcess
m_stdio_communication.Clear();
posix_spawnattr_t attr;
Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
Error local_err; // Errors that don't affect the spawning.
if (log)
log->Printf ("%s ( path='%s', argv=%p, envp=%p, arch=%s )", __FUNCTION__, debugserver_path, inferior_argv, inferior_envp, inferior_arch.AsCString());
error.SetError( ::posix_spawnattr_init (&attr), eErrorTypePOSIX);
if (error.Fail() || log)
error.PutToLog(log, "::posix_spawnattr_init ( &attr )");
error.PutToLog(log.get(), "::posix_spawnattr_init ( &attr )");
if (error.Fail())
return error;;
@ -1730,7 +1730,7 @@ ProcessGDBRemote::StartDebugserverProcess
size_t ocount = 0;
error.SetError( ::posix_spawnattr_setbinpref_np (&attr, 1, &cpu, &ocount), eErrorTypePOSIX);
if (error.Fail() || log)
error.PutToLog(log, "::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %zu )", cpu, ocount);
error.PutToLog(log.get(), "::posix_spawnattr_setbinpref_np ( &attr, 1, cpu_type = 0x%8.8x, count => %zu )", cpu, ocount);
if (error.Fail() != 0 || ocount != 1)
return error;
@ -1879,7 +1879,7 @@ ProcessGDBRemote::StartDebugserverProcess
m_debugserver_pid = LLDB_INVALID_PROCESS_ID;
if (error.Fail() || log)
error.PutToLog(log, "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", m_debugserver_pid, debugserver_path, NULL, &attr, inferior_argv, inferior_envp);
error.PutToLog(log.get(), "::posix_spawnp ( pid => %i, path = '%s', file_actions = %p, attr = %p, argv = %p, envp = %p )", m_debugserver_pid, debugserver_path, NULL, &attr, inferior_argv, inferior_envp);
if (m_debugserver_pid != LLDB_INVALID_PROCESS_ID)
{
@ -2055,7 +2055,7 @@ ProcessGDBRemote::StartAsyncThread ()
{
ResetGDBRemoteState ();
Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS);
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
if (log)
log->Printf ("ProcessGDBRemote::%s ()", __FUNCTION__);
@ -2069,7 +2069,7 @@ ProcessGDBRemote::StartAsyncThread ()
void
ProcessGDBRemote::StopAsyncThread ()
{
Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS);
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
if (log)
log->Printf ("ProcessGDBRemote::%s ()", __FUNCTION__);
@ -2089,7 +2089,7 @@ ProcessGDBRemote::AsyncThread (void *arg)
{
ProcessGDBRemote *process = (ProcessGDBRemote*) arg;
Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS);
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS));
if (log)
log->Printf ("ProcessGDBRemote::%s (arg = %p, pid = %i) thread starting...", __FUNCTION__, arg, process->GetID());

View File

@ -18,38 +18,37 @@ using namespace lldb;
using namespace lldb_private;
static Log* g_log = NULL; // Leak for now as auto_ptr was being cleaned up
// by global constructors before other threads
// were done with it.
Log *
// We want to avoid global constructors where code needs to be run so here we
// control access to our static g_log_sp by hiding it in a singleton function
// that will construct the static g_lob_sp the first time this function is
// called.
static LogSP &
GetLog ()
{
static LogSP g_log_sp;
return g_log_sp;
}
LogSP
ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (uint32_t mask)
{
Log *log = g_log;
LogSP log(GetLog ());
if (log && mask)
{
uint32_t log_mask = log->GetMask().Get();
if ((log_mask & mask) != mask)
return NULL;
return LogSP();
}
return log;
}
void
ProcessGDBRemoteLog::DeleteLog ()
{
if (g_log)
{
delete g_log;
g_log = NULL;
}
}
void
ProcessGDBRemoteLog::DisableLog (Args &args, Stream *feedback_strm)
{
if (g_log)
LogSP log (GetLog ());
if (log)
{
uint32_t flag_bits = g_log->GetMask().Get();
uint32_t flag_bits = log->GetMask().Get();
const size_t argc = args.GetArgumentCount ();
for (size_t i = 0; i < argc; ++i)
{
@ -79,20 +78,34 @@ ProcessGDBRemoteLog::DisableLog (Args &args, Stream *feedback_strm)
}
if (flag_bits == 0)
DeleteLog();
GetLog ().reset();
else
g_log->GetMask().Reset (flag_bits);
log->GetMask().Reset (flag_bits);
}
return;
}
Log *
LogSP
ProcessGDBRemoteLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm)
{
DeleteLog ();
g_log = new Log (log_stream_sp);
if (g_log)
// Try see if there already is a log - that way we can reuse its settings.
// We could reuse the log in toto, but we don't know that the stream is the same.
uint32_t flag_bits;
LogSP log(GetLog ());
if (log)
flag_bits = log->GetMask().Get();
else
flag_bits = 0;
// Now make a new log with this stream if one was provided
if (log_stream_sp)
{
log = make_shared<Log>(log_stream_sp);
GetLog () = log;
}
if (log)
{
uint32_t flag_bits = 0;
bool got_unknown_category = false;
@ -127,10 +140,10 @@ ProcessGDBRemoteLog::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, A
}
if (flag_bits == 0)
flag_bits = GDBR_LOG_DEFAULT;
g_log->GetMask().Reset(flag_bits);
g_log->GetOptions().Reset(log_options);
log->GetMask().Reset(flag_bits);
log->GetOptions().Reset(log_options);
}
return g_log;
return log;
}
void
@ -157,7 +170,7 @@ ProcessGDBRemoteLog::ListLogCategories (Stream *strm)
void
ProcessGDBRemoteLog::LogIf (uint32_t mask, const char *format, ...)
{
Log *log = ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (mask);
LogSP log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (mask));
if (log)
{
va_list args;

View File

@ -35,16 +35,13 @@
class ProcessGDBRemoteLog
{
public:
static lldb_private::Log *
static lldb::LogSP
GetLogIfAllCategoriesSet(uint32_t mask = 0);
static void
DisableLog (lldb_private::Args &args, lldb_private::Stream *feedback_strm);
static void
DeleteLog ();
static lldb_private::Log *
static lldb::LogSP
EnableLog (lldb::StreamSP &log_stream_sp, uint32_t log_options, lldb_private::Args &args, lldb_private::Stream *feedback_strm);
static void

View File

@ -718,7 +718,7 @@ public:
}
}
private:
Log *m_log;
LogSP m_log;
};
clang_type_t

View File

@ -290,7 +290,7 @@ DWARFCallFrameInfo::GetFDEIndex ()
dw_offset_t offset = 0;
if (m_cfi_data_initialized == false)
{
Log *log = GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND);
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
if (log)
{
log->Printf ("Reading eh_frame information for %s", m_objfile.GetFileSpec().GetFilename().GetCString());

View File

@ -33,7 +33,7 @@ ObjCLanguageRuntime::ObjCLanguageRuntime (Process *process) :
void
ObjCLanguageRuntime::AddToMethodCache (lldb::addr_t class_addr, lldb::addr_t selector, lldb::addr_t impl_addr)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
{
log->Printf ("Caching: class 0x%llx selector 0x%llx implementation 0x%llx.", class_addr, selector, impl_addr);

View File

@ -89,7 +89,7 @@ Process::Process(Target &target, Listener &listener) :
{
UpdateInstanceName();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
log->Printf ("%p Process::Process()", this);
@ -118,7 +118,7 @@ Process::Process(Target &target, Listener &listener) :
//----------------------------------------------------------------------
Process::~Process()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
log->Printf ("%p Process::~Process()", this);
StopPrivateStateThread();
@ -243,7 +243,7 @@ Process::RestoreProcessEvents ()
StateType
Process::WaitForStateChangedEvents (const TimeValue *timeout, EventSP &event_sp)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__, timeout);
@ -267,7 +267,7 @@ Process::WaitForStateChangedEvents (const TimeValue *timeout, EventSP &event_sp)
Event *
Process::PeekAtStateChangedEvents ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
log->Printf ("Process::%s...", __FUNCTION__);
@ -296,7 +296,7 @@ Process::PeekAtStateChangedEvents ()
StateType
Process::WaitForStateChangedEventsPrivate (const TimeValue *timeout, EventSP &event_sp)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__, timeout);
@ -320,7 +320,7 @@ Process::WaitForStateChangedEventsPrivate (const TimeValue *timeout, EventSP &ev
bool
Process::WaitForEventsPrivate (const TimeValue *timeout, EventSP &event_sp, bool control_only)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
log->Printf ("Process::%s (timeout = %p, event_sp)...", __FUNCTION__, timeout);
@ -415,7 +415,7 @@ Process::GetState()
void
Process::SetPublicState (StateType new_state)
{
Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE);
LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE));
if (log)
log->Printf("Process::SetPublicState (%s)", StateAsCString(new_state));
m_public_state.SetValue (new_state);
@ -430,7 +430,7 @@ Process::GetPrivateState ()
void
Process::SetPrivateState (StateType new_state)
{
Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE);
LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_STATE));
bool state_changed = false;
if (log)
@ -811,7 +811,7 @@ Process::EnableSoftwareBreakpoint (BreakpointSite *bp_site)
{
Error error;
assert (bp_site != NULL);
Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
const addr_t bp_addr = bp_site->GetLoadAddress();
if (log)
log->Printf ("Process::EnableSoftwareBreakpoint (site_id = %d) addr = 0x%llx", bp_site->GetID(), (uint64_t)bp_addr);
@ -888,7 +888,7 @@ Process::DisableSoftwareBreakpoint (BreakpointSite *bp_site)
{
Error error;
assert (bp_site != NULL);
Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
addr_t bp_addr = bp_site->GetLoadAddress();
lldb::user_id_t breakID = bp_site->GetID();
if (log)
@ -1389,7 +1389,7 @@ Process::Attach (const char *process_name, bool wait_for_launch)
Error
Process::Resume ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
log->Printf("Process::Resume() m_stop_id = %u", m_stop_id);
@ -1513,7 +1513,7 @@ Process::ShouldBroadcastEvent (Event *event_ptr)
{
const StateType state = Process::ProcessEventData::GetStateFromEvent (event_ptr);
bool return_value = true;
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS));
switch (state)
{
@ -1632,7 +1632,7 @@ Process::GetThreadList () const
bool
Process::StartPrivateStateThread ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS));
if (log)
log->Printf ("Process::%s ( )", __FUNCTION__);
@ -1664,7 +1664,7 @@ Process::StopPrivateStateThread ()
void
Process::ControlPrivateStateThread (uint32_t signal)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EVENTS));
assert (signal == eBroadcastInternalStateControlStop ||
signal == eBroadcastInternalStateControlPause ||
@ -1701,7 +1701,7 @@ Process::ControlPrivateStateThread (uint32_t signal)
void
Process::HandlePrivateEvent (EventSP &event_sp)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
const StateType internal_state = Process::ProcessEventData::GetStateFromEvent(event_sp.get());
// See if we should broadcast this state to external clients?
const bool should_broadcast = ShouldBroadcastEvent (event_sp.get());
@ -1740,7 +1740,7 @@ Process::RunPrivateStateThread ()
bool control_only = false;
m_private_state_control_wait.SetValue (false, eBroadcastNever);
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
log->Printf ("Process::%s (arg = %p, pid = %i) thread starting...", __FUNCTION__, this, GetID());

View File

@ -50,7 +50,7 @@ SectionLoadList::GetSectionLoadAddress (const Section *section) const
bool
SectionLoadList::SetSectionLoadAddress (const Section *section, addr_t load_addr)
{
Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE);
LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE));
if (log)
log->Printf ("SectionLoadList::%s (section = %p (%s.%s), load_addr = 0x%16.16llx)",
@ -76,7 +76,7 @@ SectionLoadList::SetSectionLoadAddress (const Section *section, addr_t load_addr
size_t
SectionLoadList::SetSectionUnloaded (const Section *section)
{
Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE);
LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE));
if (log)
log->Printf ("SectionLoadList::%s (section = %p (%s.%s))",
@ -99,7 +99,7 @@ SectionLoadList::SetSectionUnloaded (const Section *section)
bool
SectionLoadList::SetSectionUnloaded (const Section *section, addr_t load_addr)
{
Log *log = lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE);
LogSP log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE));
if (log)
log->Printf ("SectionLoadList::%s (section = %p (%s.%s), load_addr = 0x%16.16llx)",

View File

@ -93,7 +93,7 @@ public:
}
else
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
log->Printf ("Process::%s could not find breakpoint site id: %lld...", __FUNCTION__, m_value);
@ -127,7 +127,7 @@ public:
}
else
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_PROCESS));
if (log)
log->Printf ("Process::%s could not find breakpoint site id: %lld...", __FUNCTION__, m_value);

View File

@ -52,7 +52,7 @@ Target::Target(Debugger &debugger) :
SetEventName (eBroadcastBitModulesLoaded, "modules-loaded");
SetEventName (eBroadcastBitModulesUnloaded, "modules-unloaded");
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
log->Printf ("%p Target::Target()", this);
}
@ -62,7 +62,7 @@ Target::Target(Debugger &debugger) :
//----------------------------------------------------------------------
Target::~Target()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
log->Printf ("%p Target::~Target()", this);
DeleteCurrentProcess ();
@ -252,7 +252,7 @@ Target::CreateBreakpoint (SearchFilterSP &filter_sp, BreakpointResolverSP &resol
else
m_breakpoint_list.Add (bp_sp, true);
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
if (log)
{
StreamString s;
@ -274,7 +274,7 @@ Target::CreateBreakpoint (SearchFilterSP &filter_sp, BreakpointResolverSP &resol
void
Target::RemoveAllBreakpoints (bool internal_also)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
if (log)
log->Printf ("Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no");
@ -288,7 +288,7 @@ Target::RemoveAllBreakpoints (bool internal_also)
void
Target::DisableAllBreakpoints (bool internal_also)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
if (log)
log->Printf ("Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no");
@ -300,7 +300,7 @@ Target::DisableAllBreakpoints (bool internal_also)
void
Target::EnableAllBreakpoints (bool internal_also)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
if (log)
log->Printf ("Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no");
@ -312,7 +312,7 @@ Target::EnableAllBreakpoints (bool internal_also)
bool
Target::RemoveBreakpointByID (break_id_t break_id)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
if (log)
log->Printf ("Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__, break_id, LLDB_BREAK_ID_IS_INTERNAL (break_id) ? "yes" : "no");
@ -334,7 +334,7 @@ Target::RemoveBreakpointByID (break_id_t break_id)
bool
Target::DisableBreakpointByID (break_id_t break_id)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
if (log)
log->Printf ("Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__, break_id, LLDB_BREAK_ID_IS_INTERNAL (break_id) ? "yes" : "no");
@ -355,7 +355,7 @@ Target::DisableBreakpointByID (break_id_t break_id)
bool
Target::EnableBreakpointByID (break_id_t break_id)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
if (log)
log->Printf ("Target::%s (break_id = %i, internal = %s)\n",
__FUNCTION__,

View File

@ -57,7 +57,7 @@ Thread::Thread (Process &process, lldb::tid_t tid) :
m_unwinder_ap ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
log->Printf ("%p Thread::Thread(tid = 0x%4.4x)", this, GetID());
@ -68,7 +68,7 @@ Thread::Thread (Process &process, lldb::tid_t tid) :
Thread::~Thread()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
log->Printf ("%p Thread::~Thread(tid = 0x%4.4x)", this, GetID());
}
@ -220,7 +220,7 @@ Thread::ShouldStop (Event* event_ptr)
ThreadPlan *current_plan = GetCurrentPlan();
bool should_stop = true;
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
{
StreamString s;
@ -291,7 +291,7 @@ Vote
Thread::ShouldReportStop (Event* event_ptr)
{
StateType thread_state = GetResumeState ();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (thread_state == eStateSuspended || thread_state == eStateInvalid)
{
@ -350,7 +350,7 @@ Thread::PushPlan (ThreadPlanSP &thread_plan_sp)
thread_plan_sp->DidPush();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
{
StreamString s;
@ -365,7 +365,7 @@ Thread::PushPlan (ThreadPlanSP &thread_plan_sp)
void
Thread::PopPlan ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (m_plan_stack.empty())
return;
@ -492,7 +492,7 @@ Thread::QueueThreadPlan (ThreadPlanSP &thread_plan_sp, bool abort_other_plans)
void
Thread::DiscardThreadPlansUpToPlan (lldb::ThreadPlanSP &up_to_plan_sp)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
{
log->Printf("Discarding thread plans for thread tid = 0x%4.4x, up to %p", GetID(), up_to_plan_sp.get());
@ -533,7 +533,7 @@ Thread::DiscardThreadPlansUpToPlan (lldb::ThreadPlanSP &up_to_plan_sp)
void
Thread::DiscardThreadPlans(bool force)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
{
log->Printf("Discarding thread plans for thread (tid = 0x%4.4x, force %d)", GetID(), force);

View File

@ -179,7 +179,7 @@ ThreadList::ShouldStop (Event *event_ptr)
// Running events should never stop, obviously...
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
bool should_stop = false;
m_process->UpdateThreadListIfNeeded();
@ -251,7 +251,7 @@ ThreadList::ShouldReportStop (Event *event_ptr)
m_process->UpdateThreadListIfNeeded();
collection::iterator pos, end = m_threads.end();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
log->Printf ("%s %zu threads", __FUNCTION__, m_threads.size());

View File

@ -89,7 +89,7 @@ ThreadPlan::MischiefManaged ()
Vote
ThreadPlan::ShouldReportStop (Event *event_ptr)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (m_stop_vote == eVoteNoOpinion)
{
@ -135,7 +135,7 @@ ThreadPlan::WillResume (StateType resume_state, bool current_plan)
{
if (current_plan)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
{

View File

@ -245,7 +245,7 @@ ThreadPlanCallFunction::ShouldStop (Event *event_ptr)
{
if (PlanExplainsStop())
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
{
@ -320,7 +320,7 @@ ThreadPlanCallFunction::MischiefManaged ()
{
if (IsPlanComplete())
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
log->Printf("Completed call function plan.");

View File

@ -215,7 +215,7 @@ ThreadPlanRunToAddress::WillStop ()
bool
ThreadPlanRunToAddress::MischiefManaged ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (AtOurAddress())
{

View File

@ -69,7 +69,7 @@ ThreadPlanStepInRange::GetDescription (Stream *s, lldb::DescriptionLevel level)
bool
ThreadPlanStepInRange::ShouldStop (Event *event_ptr)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
m_no_more_plans = false;
if (log)
@ -245,7 +245,7 @@ ThreadPlanStepInRange::DefaultShouldStopHereCallback (ThreadPlan *current_plan,
{
bool should_step_out = false;
StackFrame *frame = current_plan->GetThread().GetStackFrameAtIndex(0).get();
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (flags.Test(eAvoidNoDebug))
{

View File

@ -101,7 +101,7 @@ ThreadPlanStepInstruction::ShouldStop (Event *event_ptr)
{
if (m_step_over)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (m_thread.GetStackFrameCount() <= m_stack_depth)
{
if (m_thread.GetRegisterContext()->GetPC(0) != m_instruction_addr)
@ -178,7 +178,7 @@ ThreadPlanStepInstruction::MischiefManaged ()
{
if (IsPlanComplete())
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
log->Printf("Completed single instruction step plan.");
ThreadPlan::MischiefManaged ();

View File

@ -207,7 +207,7 @@ ThreadPlanStepOut::MischiefManaged ()
// reason and we're now stopping for some other reason altogether, then we're done
// with this step out operation.
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
log->Printf("Completed step out plan.");
m_thread.GetProcess().GetTarget().RemoveBreakpointByID (m_return_bp_id);

View File

@ -118,7 +118,7 @@ ThreadPlanStepOverBreakpoint::MischiefManaged ()
}
else
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
log->Printf("Completed step over breakpoint plan.");
// Otherwise, re-enable the breakpoint we were stepping over, and we're done.

View File

@ -24,6 +24,7 @@
#include "lldb/Target/ThreadPlanStepThrough.h"
using namespace lldb_private;
using namespace lldb;
//----------------------------------------------------------------------
@ -63,7 +64,7 @@ ThreadPlanStepOverRange::GetDescription (Stream *s, lldb::DescriptionLevel level
bool
ThreadPlanStepOverRange::ShouldStop (Event *event_ptr)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
{

View File

@ -84,7 +84,7 @@ ThreadPlanStepRange::PlanExplainsStop ()
Vote
ThreadPlanStepRange::ShouldReportStop (Event *event_ptr)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
const Vote vote = IsPlanComplete() ? eVoteYes : eVoteNo;
if (log)
@ -95,7 +95,7 @@ ThreadPlanStepRange::ShouldReportStop (Event *event_ptr)
bool
ThreadPlanStepRange::InRange ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
bool ret_value = false;
lldb::addr_t pc_load_addr = m_thread.GetRegisterContext()->GetPC();
@ -158,7 +158,7 @@ ThreadPlanStepRange::InSymbol()
bool
ThreadPlanStepRange::FrameIsYounger ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
// FIXME: Might be better to do this by storing the FrameID we started in and seeing if that is still above
// us on the stack. Counting the whole stack could be expensive.
@ -187,7 +187,7 @@ ThreadPlanStepRange::FrameIsYounger ()
bool
ThreadPlanStepRange::FrameIsOlder ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
uint32_t current_depth = m_thread.GetStackFrameCount();
if (current_depth == m_stack_depth)
{
@ -254,7 +254,7 @@ ThreadPlanStepRange::MischiefManaged ()
if (done)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
log->Printf("Completed step through range plan.");
ThreadPlan::MischiefManaged ();

View File

@ -117,7 +117,7 @@ ThreadPlanStepThrough::WillStop ()
bool
ThreadPlanStepThrough::MischiefManaged ()
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
// Stop if we're happy with the place we've landed...

View File

@ -347,7 +347,7 @@ ThreadPlanStepUntil::MischiefManaged ()
bool done = false;
if (IsPlanComplete())
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (log)
log->Printf("Completed step until plan.");

View File

@ -70,7 +70,7 @@ ThreadPlanTestCondition::GetDescription (Stream *s, lldb::DescriptionLevel level
bool
ThreadPlanTestCondition::ShouldStop (Event *event_ptr)
{
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP));
if (m_thread.IsThreadPlanDone(m_expression_plan_sp.get()))
{
ClangExpressionVariable *expr_result = NULL;
@ -89,13 +89,11 @@ ThreadPlanTestCondition::ShouldStop (Event *event_ptr)
else
m_did_stop = true;
}
log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
if (log)
log->Printf("Condition successfully evaluated, result is %s.\n", m_did_stop ? "true" : "false");
}
else
{
log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
if (log)
log->Printf("Failed to get a result from the expression, error: \"%s\"\n", error_stream.GetData());
m_did_stop = true;
@ -103,7 +101,6 @@ ThreadPlanTestCondition::ShouldStop (Event *event_ptr)
}
else if (m_exe_ctx.thread->WasThreadPlanDiscarded (m_expression_plan_sp.get()))
{
log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP);
if (log)
log->Printf("ExecuteExpression thread plan was discarded.\n");
m_did_stop = true;

View File

@ -22,30 +22,21 @@ using namespace lldb;
using namespace lldb_private;
static Log *
LogAccessor (bool get, StreamSP *stream_sp_ptr)
// We want to avoid global constructors where code needs to be run so here we
// control access to our static g_log_sp by hiding it in a singleton function
// that will construct the static g_lob_sp the first time this function is
// called.
static LogSP &
GetLog ()
{
static Log* g_log = NULL; // Leak for now as auto_ptr was being cleaned up
// by global constructors before other threads
// were done with it.
if (!get)
{
if (g_log)
delete g_log;
if (stream_sp_ptr)
g_log = new Log (*stream_sp_ptr);
else
g_log = NULL;
}
return g_log;
static LogSP g_log_sp;
return g_log_sp;
}
uint32_t
lldb_private::GetLogMask ()
{
Log *log = LogAccessor (true, NULL);
LogSP log(GetLog ());
if (log)
return log->GetMask().Get();
return 0;
@ -58,15 +49,15 @@ lldb_private::IsLogVerbose ()
return (mask & LIBLLDB_LOG_VERBOSE);
}
Log *
LogSP
lldb_private::GetLogIfAllCategoriesSet (uint32_t mask)
{
Log *log = LogAccessor (true, NULL);
LogSP log(GetLog ());
if (log && mask)
{
uint32_t log_mask = log->GetMask().Get();
if ((log_mask & mask) != mask)
return NULL;
return LogSP();
}
return log;
}
@ -74,7 +65,7 @@ lldb_private::GetLogIfAllCategoriesSet (uint32_t mask)
void
lldb_private::LogIfAllCategoriesSet (uint32_t mask, const char *format, ...)
{
Log *log = GetLogIfAllCategoriesSet (mask);
LogSP log(GetLogIfAllCategoriesSet (mask));
if (log)
{
va_list args;
@ -87,7 +78,7 @@ lldb_private::LogIfAllCategoriesSet (uint32_t mask, const char *format, ...)
void
lldb_private::LogIfAnyCategoriesSet (uint32_t mask, const char *format, ...)
{
Log *log = GetLogIfAnyCategoriesSet (mask);
LogSP log(GetLogIfAnyCategoriesSet (mask));
if (log)
{
va_list args;
@ -97,19 +88,19 @@ lldb_private::LogIfAnyCategoriesSet (uint32_t mask, const char *format, ...)
}
}
Log *
LogSP
lldb_private::GetLogIfAnyCategoriesSet (uint32_t mask)
{
Log *log = LogAccessor (true, NULL);
LogSP log(GetLog ());
if (log && mask && (mask & log->GetMask().Get()))
return log;
return NULL;
return LogSP();
}
void
lldb_private::DisableLog (Args &args, Stream *feedback_strm)
{
Log *log = LogAccessor (true, NULL);
LogSP log(GetLog ());
uint32_t flag_bits;
if (log)
@ -148,7 +139,7 @@ lldb_private::DisableLog (Args &args, Stream *feedback_strm)
}
if (flag_bits == 0)
LogAccessor (false, NULL);
GetLog ().reset();
else
log->GetMask().Reset (flag_bits);
}
@ -156,20 +147,25 @@ lldb_private::DisableLog (Args &args, Stream *feedback_strm)
return;
}
Log *
LogSP
lldb_private::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &args, Stream *feedback_strm)
{
// Try see if there already is a log - that way we can reuse its settings.
// We could reuse the log in toto, but we don't know that the stream is the same.
uint32_t flag_bits;
Log* log = LogAccessor (true, NULL);
LogSP log(GetLog ());
if (log)
flag_bits = log->GetMask().Get();
else
flag_bits = 0;
// Now make a new log with this stream.
log = LogAccessor (false, &log_stream_sp);
// Now make a new log with this stream if one was provided
if (log_stream_sp)
{
log = make_shared<Log>(log_stream_sp);
GetLog () = log;
}
if (log)
{
bool got_unknown_category = false;