First pass at adding logging capabilities for the API functions. At the moment

it logs the function calls, their arguments and the return values.  This is not
complete or polished, but I am committing it now, at the request of someone who
really wants to use it, even though it's not really done.  It currently does not
attempt to log all the functions, just the most important ones.  I will be 
making further adjustments to the API logging code over the next few days/weeks.
(Suggestions for improvements are welcome).


Update the Python build scripts to re-build the swig C++ file whenever 
the python-extensions.swig file is modified.

Correct the help for 'log enable' command (give it the correct number & type of
arguments).

llvm-svn: 117349
This commit is contained in:
Caroline Tice 2010-10-26 03:11:13 +00:00
parent e96b8d7ab6
commit ceb6b1393d
50 changed files with 2069 additions and 107 deletions

View File

@ -75,7 +75,7 @@ public:
IsResolved (); IsResolved ();
bool bool
GetDescription (const char *description_level, lldb::SBStream &description); GetDescription (DescriptionLevel level, lldb::SBStream &description);
SBBreakpoint SBBreakpoint
GetBreakpoint (); GetBreakpoint ();

View File

@ -68,6 +68,9 @@ public:
bool bool
GetDescription (lldb::SBStream &description); GetDescription (lldb::SBStream &description);
bool
GetDescription (lldb::SBStream &description) const;
protected: protected:
friend class SBArguments; friend class SBArguments;
friend class SBDebugger; friend class SBDebugger;

View File

@ -57,6 +57,9 @@ public:
bool bool
GetDescription (lldb::SBStream &description); GetDescription (lldb::SBStream &description);
bool
GetDescription (lldb::SBStream &description) const;
protected: protected:
friend class SBListener; friend class SBListener;
friend class SBBroadcaster; friend class SBBroadcaster;

View File

@ -56,6 +56,9 @@ public:
bool bool
GetDescription (lldb::SBStream &description); GetDescription (lldb::SBStream &description);
bool
GetDescription (lldb::SBStream &description) const;
private: private:
friend class SBBlock; friend class SBBlock;
friend class SBCompileUnit; friend class SBCompileUnit;

View File

@ -162,7 +162,10 @@ public:
#endif #endif
bool bool
GetDescription (lldb::SBStream &description); GetDescription (lldb::SBStream &description, lldb::DescriptionLevel);
bool
GetDescription (lldb::SBStream &description, lldb::DescriptionLevel) const;
protected: protected:
friend class SBAddress; friend class SBAddress;

View File

@ -91,6 +91,9 @@ public:
bool bool
GetDescription (lldb::SBStream &description); GetDescription (lldb::SBStream &description);
bool
GetDescription (lldb::SBStream &description) const;
protected: protected:
friend class SBBreakpoint; friend class SBBreakpoint;
friend class SBBreakpointLocation; friend class SBBreakpointLocation;

View File

@ -331,6 +331,9 @@ public:
SetReadThreadBytesReceivedCallback (ReadThreadBytesReceived callback, SetReadThreadBytesReceivedCallback (ReadThreadBytesReceived callback,
void *callback_baton); void *callback_baton);
static const char *
ConnectionStatusAsCString (lldb::ConnectionStatus status);
private: private:
//------------------------------------------------------------------ //------------------------------------------------------------------
// For Communication only // For Communication only

View File

@ -95,6 +95,9 @@ public:
void void
WaitOnReaderIsDone (); WaitOnReaderIsDone ();
static const char *
GranularityAsCString (lldb::InputReaderGranularity granularity);
protected: protected:
friend class Debugger; friend class Debugger;

View File

@ -98,6 +98,9 @@ public:
virtual void virtual void
CalculateSymbolContext (SymbolContext* sc); CalculateSymbolContext (SymbolContext* sc);
void
GetDescription (Stream *s);
//------------------------------------------------------------------ //------------------------------------------------------------------
/// Dump a description of this object to a Stream. /// Dump a description of this object to a Stream.
/// ///

View File

@ -183,7 +183,7 @@ public:
/// The stream to which to dump the object descripton. /// The stream to which to dump the object descripton.
//------------------------------------------------------------------ //------------------------------------------------------------------
void void
Dump (Stream *s); Dump (Stream *s, lldb::DescriptionLevel description_level);
const lldb::ProcessSP & const lldb::ProcessSP &
CreateProcess (Listener &listener, const char *plugin_name = NULL); CreateProcess (Listener &listener, const char *plugin_name = NULL);

View File

@ -241,6 +241,12 @@ public:
bool bool
ThreadStoppedForAReason (); ThreadStoppedForAReason ();
static const char *
RunModeAsCString (lldb::RunMode mode);
static const char *
StopReasonAsCString (lldb::StopReason reason);
virtual const char * virtual const char *
GetInfo () = 0; GetInfo () = 0;

View File

@ -533,6 +533,7 @@ typedef enum CommandArgumentType
eArgTypeFunctionName, eArgTypeFunctionName,
eArgTypeIndex, eArgTypeIndex,
eArgTypeLineNum, eArgTypeLineNum,
eArgTypeLogCategory,
eArgTypeLogChannel, eArgTypeLogChannel,
eArgTypeMethod, eArgTypeMethod,
eArgTypeName, eArgTypeName,

View File

@ -35,6 +35,7 @@
#define LIBLLDB_LOG_CONNECTION (1u << 13) #define LIBLLDB_LOG_CONNECTION (1u << 13)
#define LIBLLDB_LOG_HOST (1u << 14) #define LIBLLDB_LOG_HOST (1u << 14)
#define LIBLLDB_LOG_UNWIND (1u << 15) #define LIBLLDB_LOG_UNWIND (1u << 15)
#define LIBLLDB_LOG_API (1u << 16)
#define LIBLLDB_LOG_ALL (UINT32_MAX) #define LIBLLDB_LOG_ALL (UINT32_MAX)
#define LIBLLDB_LOG_DEFAULT (LIBLLDB_LOG_PROCESS |\ #define LIBLLDB_LOG_DEFAULT (LIBLLDB_LOG_PROCESS |\
LIBLLDB_LOG_THREAD |\ LIBLLDB_LOG_THREAD |\

View File

@ -19,6 +19,7 @@ debug_flag=$5
swig_output_file=${SRC_ROOT}/source/LLDBWrapPython.cpp swig_output_file=${SRC_ROOT}/source/LLDBWrapPython.cpp
swig_input_file=${SRC_ROOT}/scripts/lldb.swig swig_input_file=${SRC_ROOT}/scripts/lldb.swig
swig_input_file2=${SRC_ROOT}/scripts/Python/python-extensions.swig
if [ -n "$debug_flag" -a "$debug_flag" == "-debug" ] if [ -n "$debug_flag" -a "$debug_flag" == "-debug" ]
@ -119,6 +120,19 @@ then
fi fi
fi fi
if [ $NeedToUpdate == 0 ]
then
if [ ${swig_input_file2} -nt ${swig_output_file} ]
then
NeedToUpdate=1
if [ $Debug == 1 ]
then
echo "${swig_input_file2} is newer than ${swig_output_file}"
echo "swig file will need to be re-built."
fi
fi
fi
os_name=`uname -s` os_name=`uname -s`
python_version=`/usr/bin/python --version 2>&1 | sed -e 's,Python ,,' -e 's,[.][0-9],,2' -e 's,[a-z][a-z][0-9],,'` python_version=`/usr/bin/python --version 2>&1 | sed -e 's,Python ,,' -e 's,[.][0-9],,2' -e 's,[a-z][a-z][0-9],,'`
@ -147,6 +161,10 @@ then
exit 0 exit 0
else else
echo "SWIG needs to be re-run." echo "SWIG needs to be re-run."
if [ -f ${swig_output_file} ]
then
rm ${swig_output_file}
fi
fi fi

View File

@ -23,7 +23,7 @@
%extend lldb::SBBreakpointLocation { %extend lldb::SBBreakpointLocation {
PyObject *lldb::SBBreakpointLocation::__repr__ (){ PyObject *lldb::SBBreakpointLocation::__repr__ (){
lldb::SBStream description; lldb::SBStream description;
$self->GetDescription ("full", description); $self->GetDescription (lldb::eDescriptionLevelFull, description);
return PyString_FromString (description.GetData()); return PyString_FromString (description.GetData());
} }
} }
@ -128,7 +128,7 @@
%extend lldb::SBTarget { %extend lldb::SBTarget {
PyObject *lldb::SBTarget::__repr__ (){ PyObject *lldb::SBTarget::__repr__ (){
lldb::SBStream description; lldb::SBStream description;
$self->GetDescription (description); $self->GetDescription (description, lldb::eDescriptionLevelBrief);
return PyString_FromString (description.GetData()); return PyString_FromString (description.GetData());
} }
} }

View File

@ -11,27 +11,49 @@
#include "lldb/API/SBProcess.h" #include "lldb/API/SBProcess.h"
#include "lldb/API/SBStream.h" #include "lldb/API/SBStream.h"
#include "lldb/Core/Address.h" #include "lldb/Core/Address.h"
#include "lldb/Core/Log.h"
using namespace lldb; using namespace lldb;
using namespace lldb_private;
SBAddress::SBAddress () : SBAddress::SBAddress () :
m_opaque_ap () m_opaque_ap ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBAddress::SBAddress () ==> this = %p (%s)", this);
} }
SBAddress::SBAddress (const lldb_private::Address *lldb_object_ptr) : SBAddress::SBAddress (const lldb_private::Address *lldb_object_ptr) :
m_opaque_ap () m_opaque_ap ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (lldb_object_ptr) if (lldb_object_ptr)
m_opaque_ap.reset (new lldb_private::Address(*lldb_object_ptr)); m_opaque_ap.reset (new lldb_private::Address(*lldb_object_ptr));
if (log)
{
SBStream sstr;
GetDescription (sstr);
log->Printf ("SBAddress::SBAddress (const lldb_private::Address *lldb_object_ptr) lldb_object_ptr = %p "
"==> this = %p (%s)", lldb_object_ptr, this, sstr.GetData());
}
} }
SBAddress::SBAddress (const SBAddress &rhs) : SBAddress::SBAddress (const SBAddress &rhs) :
m_opaque_ap () m_opaque_ap ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (rhs.IsValid()) if (rhs.IsValid())
m_opaque_ap.reset (new lldb_private::Address(*rhs.m_opaque_ap.get())); m_opaque_ap.reset (new lldb_private::Address(*rhs.m_opaque_ap.get()));
if (log)
log->Printf ("SBAddress::SBAddress (const SBAddress &rhs) rhs.m_opaque_ap.get() = %p ==> this = %p",
(rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), this);
} }
SBAddress::~SBAddress () SBAddress::~SBAddress ()
@ -41,11 +63,17 @@ SBAddress::~SBAddress ()
const SBAddress & const SBAddress &
SBAddress::operator = (const SBAddress &rhs) SBAddress::operator = (const SBAddress &rhs)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (this != &rhs) if (this != &rhs)
{ {
if (rhs.IsValid()) if (rhs.IsValid())
m_opaque_ap.reset (new lldb_private::Address(*rhs.m_opaque_ap.get())); m_opaque_ap.reset (new lldb_private::Address(*rhs.m_opaque_ap.get()));
} }
if (log)
log->Printf ("SBAddress::operator= (const SBAddress rhs) rhs = %p ==> this = %p",
(rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), this);
return *this; return *this;
} }
@ -88,10 +116,24 @@ SBAddress::GetFileAddress () const
lldb::addr_t lldb::addr_t
SBAddress::GetLoadAddress (const SBTarget &target) const SBAddress::GetLoadAddress (const SBTarget &target) const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBAddress::GetLoadAddress");
if (m_opaque_ap.get()) if (m_opaque_ap.get())
return m_opaque_ap->GetLoadAddress(target.get()); {
lldb::addr_t addr = m_opaque_ap->GetLoadAddress (target.get());
if (log)
log->Printf ("SBAddress::GetLoadAddress ==> %p", addr);
return addr;
}
else else
{
if (log)
log->Printf ("SBAddress::GetLoadAddress ==> LLDB_INVALID_ADDRESS");
return LLDB_INVALID_ADDRESS; return LLDB_INVALID_ADDRESS;
}
} }
bool bool

View File

@ -19,6 +19,7 @@
#include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Breakpoint/StoppointCallbackContext.h" #include "lldb/Breakpoint/StoppointCallbackContext.h"
#include "lldb/Core/Address.h" #include "lldb/Core/Address.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Stream.h" #include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h" #include "lldb/Core/StreamFile.h"
#include "lldb/Target/Process.h" #include "lldb/Target/Process.h"
@ -66,17 +67,39 @@ public:
SBBreakpoint::SBBreakpoint () : SBBreakpoint::SBBreakpoint () :
m_opaque_sp () m_opaque_sp ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBBreakpoint::SBBreakpoint () ==> this = %p", this);
} }
SBBreakpoint::SBBreakpoint (const SBBreakpoint& rhs) : SBBreakpoint::SBBreakpoint (const SBBreakpoint& rhs) :
m_opaque_sp (rhs.m_opaque_sp) m_opaque_sp (rhs.m_opaque_sp)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
{
SBStream sstr;
GetDescription (sstr);
log->Printf ("SBBreakpoint::SBBreakpoint (const SBBreakpoint &rhs) rhs.m_opaque_ap.get() = %p ==> this = %p (%s)",
rhs.m_opaque_sp.get(), this, sstr.GetData());
}
} }
SBBreakpoint::SBBreakpoint (const lldb::BreakpointSP &bp_sp) : SBBreakpoint::SBBreakpoint (const lldb::BreakpointSP &bp_sp) :
m_opaque_sp (bp_sp) m_opaque_sp (bp_sp)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
{
SBStream sstr;
GetDescription (sstr);
log->Printf("SBBreakpoint::SBBreakpoint (const lldb::BreakpointSP &bp_sp) bp_sp.get() = %p ==> this = %p (%s)",
bp_sp.get(), this, sstr.GetData());
}
} }
SBBreakpoint::~SBBreakpoint() SBBreakpoint::~SBBreakpoint()
@ -86,18 +109,42 @@ SBBreakpoint::~SBBreakpoint()
const SBBreakpoint & const SBBreakpoint &
SBBreakpoint::operator = (const SBBreakpoint& rhs) SBBreakpoint::operator = (const SBBreakpoint& rhs)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBBreakpoint::operator=");
if (this != &rhs) if (this != &rhs)
{ {
m_opaque_sp = rhs.m_opaque_sp; m_opaque_sp = rhs.m_opaque_sp;
} }
if (log)
log->Printf ("SBBreakpoint::operator= (const SBBreakpoint &rhs) rhs.m_opaque_sp.get() = %p ==> this = %p",
rhs.m_opaque_sp.get(), this);
return *this; return *this;
} }
break_id_t break_id_t
SBBreakpoint::GetID () const SBBreakpoint::GetID () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBBreakpoint::GetID");
if (m_opaque_sp) if (m_opaque_sp)
return m_opaque_sp->GetID(); {
break_id_t id = m_opaque_sp->GetID();
if (log)
log->Printf ("SBBreakpoint::GetID ==> %d", id);
return id;
}
if (log)
log->Printf ("SBBreakpoint::GetID ==> LLDB_INVALID_BREAK_ID");
return LLDB_INVALID_BREAK_ID; return LLDB_INVALID_BREAK_ID;
} }
@ -185,6 +232,11 @@ SBBreakpoint::GetLocationAtIndex (uint32_t index)
void void
SBBreakpoint::SetEnabled (bool enable) SBBreakpoint::SetEnabled (bool enable)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBBreakpoint::SetEnabled (%s)", (enable ? "true" : "false"));
if (m_opaque_sp) if (m_opaque_sp)
m_opaque_sp->SetEnabled (enable); m_opaque_sp->SetEnabled (enable);
} }
@ -201,6 +253,11 @@ SBBreakpoint::IsEnabled ()
void void
SBBreakpoint::SetIgnoreCount (uint32_t count) SBBreakpoint::SetIgnoreCount (uint32_t count)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBBreakpoint::SetIgnoreCount (%d)", count);
if (m_opaque_sp) if (m_opaque_sp)
m_opaque_sp->SetIgnoreCount (count); m_opaque_sp->SetIgnoreCount (count);
} }
@ -220,10 +277,24 @@ SBBreakpoint::GetCondition ()
uint32_t uint32_t
SBBreakpoint::GetHitCount () const SBBreakpoint::GetHitCount () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBBreakpoint::GetHitCount");
if (m_opaque_sp) if (m_opaque_sp)
{
uint32_t hit_count = m_opaque_sp->GetHitCount();
if (log)
log->Printf ("SBBreakpoint::GetHitCount ==> %d", hit_count);
return m_opaque_sp->GetHitCount(); return m_opaque_sp->GetHitCount();
}
else else
{
if (log)
log->Printf ("SBBreakpoint::GetHitCount ==> 0");
return 0; return 0;
}
} }
uint32_t uint32_t
@ -389,9 +460,21 @@ SBBreakpoint::PrivateBreakpointHitCallback
void void
SBBreakpoint::SetCallback (BreakpointHitCallback callback, void *baton) SBBreakpoint::SetCallback (BreakpointHitCallback callback, void *baton)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBBreakpoint::SetCallback :");
if (m_opaque_sp.get()) if (m_opaque_sp.get())
{ {
BatonSP baton_sp(new SBBreakpointCallbackBaton (callback, baton)); BatonSP baton_sp(new SBBreakpointCallbackBaton (callback, baton));
if (log)
{
// CAROLINE: FIXME!!
//StreamString sstr;
//baton_sp->GetDescription (sstr, lldb::eDescriptionLevelFull);
//log->Printf ("%s", sstr.GetData());
}
m_opaque_sp->SetCallback (SBBreakpoint::PrivateBreakpointHitCallback, baton_sp, false); m_opaque_sp->SetCallback (SBBreakpoint::PrivateBreakpointHitCallback, baton_sp, false);
} }
} }

View File

@ -21,6 +21,7 @@
#include "lldb/lldb-defines.h" #include "lldb/lldb-defines.h"
#include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Target/ThreadSpec.h" #include "lldb/Target/ThreadSpec.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Stream.h" #include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h" #include "lldb/Core/StreamFile.h"
#include "lldb/Target/ThreadSpec.h" #include "lldb/Target/ThreadSpec.h"
@ -29,16 +30,26 @@ using namespace lldb;
using namespace lldb_private; using namespace lldb_private;
//class SBBreakpointLocation
SBBreakpointLocation::SBBreakpointLocation () SBBreakpointLocation::SBBreakpointLocation ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBBreakpointLocation::SBBreakpointLocation () ==> this = %p", this);
} }
SBBreakpointLocation::SBBreakpointLocation (const lldb::BreakpointLocationSP &break_loc_sp) : SBBreakpointLocation::SBBreakpointLocation (const lldb::BreakpointLocationSP &break_loc_sp) :
m_opaque_sp (break_loc_sp) m_opaque_sp (break_loc_sp)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
{
SBStream sstr;
GetDescription (lldb::eDescriptionLevelBrief, sstr);
log->Printf ("SBBreakpointLocation::SBBreakpointLocaiton (const lldb::BreakpointLocationsSP &break_loc_sp) "
"break_loc_sp.get() = %p ==> this = %p (%s)", break_loc_sp.get(), this, sstr.GetData());
}
} }
SBBreakpointLocation::~SBBreakpointLocation () SBBreakpointLocation::~SBBreakpointLocation ()
@ -210,20 +221,10 @@ SBBreakpointLocation::SetLocation (const lldb::BreakpointLocationSP &break_loc_s
} }
bool bool
SBBreakpointLocation::GetDescription (const char *description_level, SBStream &description) SBBreakpointLocation::GetDescription (DescriptionLevel level, SBStream &description)
{ {
if (m_opaque_sp) if (m_opaque_sp)
{ {
DescriptionLevel level;
if (strcmp (description_level, "brief") == 0)
level = eDescriptionLevelBrief;
else if (strcmp (description_level, "full") == 0)
level = eDescriptionLevelFull;
else if (strcmp (description_level, "verbose") == 0)
level = eDescriptionLevelVerbose;
else
level = eDescriptionLevelBrief;
description.ref(); description.ref();
m_opaque_sp->GetDescription (description.get(), level); m_opaque_sp->GetDescription (description.get(), level);
description.get()->EOL(); description.get()->EOL();
@ -237,9 +238,21 @@ SBBreakpointLocation::GetDescription (const char *description_level, SBStream &d
SBBreakpoint SBBreakpoint
SBBreakpointLocation::GetBreakpoint () SBBreakpointLocation::GetBreakpoint ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBBreakpointLocation::GetBreakpoint ()");
SBBreakpoint sb_bp; SBBreakpoint sb_bp;
if (m_opaque_sp) if (m_opaque_sp)
*sb_bp = m_opaque_sp->GetBreakpoint ().GetSP(); *sb_bp = m_opaque_sp->GetBreakpoint ().GetSP();
if (log)
{
SBStream sstr;
sb_bp.GetDescription (sstr);
log->Printf ("SBBreakpointLocation::GetBreakpoint ==> %s", sstr.GetData());
}
return sb_bp; return sb_bp;
} }

View File

@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "lldb/Core/Broadcaster.h" #include "lldb/Core/Broadcaster.h"
#include "lldb/Core/Log.h"
#include "lldb/lldb-forward-rtti.h" #include "lldb/lldb-forward-rtti.h"
#include "lldb/API/SBBroadcaster.h" #include "lldb/API/SBBroadcaster.h"
@ -22,6 +23,10 @@ SBBroadcaster::SBBroadcaster () :
m_opaque (NULL), m_opaque (NULL),
m_opaque_owned (false) m_opaque_owned (false)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBBroadcastetr::SBBroadcaster () ==> this = %p", this);
} }
@ -29,12 +34,22 @@ SBBroadcaster::SBBroadcaster (const char *name) :
m_opaque (new Broadcaster (name)), m_opaque (new Broadcaster (name)),
m_opaque_owned (true) m_opaque_owned (true)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBBroadcaster::SBBroadcaster (const char *name) name = '%s' ==> this = %p (m_opaque = %p)",
name, this, m_opaque);
} }
SBBroadcaster::SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns) : SBBroadcaster::SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns) :
m_opaque (broadcaster), m_opaque (broadcaster),
m_opaque_owned (owns) m_opaque_owned (owns)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBBroadcaster::SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns) "
" broadcaster = %p, owns = %s ==> this = %p", broadcaster, (owns ? "true" : "false"), this);
} }
SBBroadcaster::~SBBroadcaster() SBBroadcaster::~SBBroadcaster()
@ -45,6 +60,11 @@ SBBroadcaster::~SBBroadcaster()
void void
SBBroadcaster::BroadcastEventByType (uint32_t event_type, bool unique) SBBroadcaster::BroadcastEventByType (uint32_t event_type, bool unique)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBBroadcaster::BroadcastEventByType (%d, %s)", event_type, (unique ? "true" : "false"));
if (m_opaque == NULL) if (m_opaque == NULL)
return; return;

View File

@ -23,6 +23,7 @@
#include "lldb/API/SBProcess.h" #include "lldb/API/SBProcess.h"
#include "lldb/API/SBTarget.h" #include "lldb/API/SBTarget.h"
#include "lldb/API/SBListener.h" #include "lldb/API/SBListener.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBStringList.h" #include "lldb/API/SBStringList.h"
using namespace lldb; using namespace lldb;
@ -32,6 +33,11 @@ using namespace lldb_private;
SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter *interpreter) : SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter *interpreter) :
m_opaque_ptr (interpreter) m_opaque_ptr (interpreter)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter *interpreter) interpreter = %p"
" ==> this = %p", interpreter, this);
} }
SBCommandInterpreter::~SBCommandInterpreter () SBCommandInterpreter::~SBCommandInterpreter ()
@ -64,6 +70,12 @@ SBCommandInterpreter::AliasExists (const char *cmd)
lldb::ReturnStatus lldb::ReturnStatus
SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnObject &result, bool add_to_history) SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnObject &result, bool add_to_history)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBCommandInterpreter::HandleCommand ('%s', result, %s)", command_line,
(add_to_history ? "true" : "false"));
result.Clear(); result.Clear();
if (m_opaque_ptr) if (m_opaque_ptr)
{ {
@ -74,6 +86,14 @@ SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnOb
result->AppendError ("SBCommandInterpreter is not valid"); result->AppendError ("SBCommandInterpreter is not valid");
result->SetStatus (eReturnStatusFailed); result->SetStatus (eReturnStatusFailed);
} }
if (log)
{
SBStream sstr;
result.GetDescription (sstr);
log->Printf ("SBCommandInterpreter::HandleCommand ==> %s", sstr.GetData());
}
return result.GetStatus(); return result.GetStatus();
} }
@ -209,7 +229,16 @@ SBCommandInterpreter::SourceInitFileInCurrentWorkingDirectory (SBCommandReturnOb
SBBroadcaster SBBroadcaster
SBCommandInterpreter::GetBroadcaster () SBCommandInterpreter::GetBroadcaster ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBCommandInterpreter::GetBroadcaster ()");
SBBroadcaster broadcaster (m_opaque_ptr, false); SBBroadcaster broadcaster (m_opaque_ptr, false);
if (log)
log->Printf ("SBCommandInterpreter::GetBroadcaster ==> %p", m_opaque_ptr);
return broadcaster; return broadcaster;
} }

View File

@ -10,6 +10,7 @@
#include "lldb/API/SBCommandReturnObject.h" #include "lldb/API/SBCommandReturnObject.h"
#include "lldb/API/SBStream.h" #include "lldb/API/SBStream.h"
#include "lldb/Core/Log.h"
#include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/CommandReturnObject.h"
using namespace lldb; using namespace lldb;
@ -18,6 +19,10 @@ using namespace lldb_private;
SBCommandReturnObject::SBCommandReturnObject () : SBCommandReturnObject::SBCommandReturnObject () :
m_opaque_ap (new CommandReturnObject ()) m_opaque_ap (new CommandReturnObject ())
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBCommandReturnObject::SBCommandReturnObject () ==> this = %p", this);
} }
SBCommandReturnObject::~SBCommandReturnObject () SBCommandReturnObject::~SBCommandReturnObject ()
@ -35,16 +40,42 @@ SBCommandReturnObject::IsValid() const
const char * const char *
SBCommandReturnObject::GetOutput () SBCommandReturnObject::GetOutput ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBCommandReturnObject::GetOutput ()");
if (m_opaque_ap.get()) if (m_opaque_ap.get())
{
if (log)
log->Printf ("SBCommandReturnObject::GetOutput ==> %s", m_opaque_ap->GetOutputStream().GetData());
return m_opaque_ap->GetOutputStream().GetData(); return m_opaque_ap->GetOutputStream().GetData();
}
if (log)
log->Printf ("SBCommandReturnObject::GetOutput ==> NULL");
return NULL; return NULL;
} }
const char * const char *
SBCommandReturnObject::GetError () SBCommandReturnObject::GetError ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBCommandReturnObject::GetError ()");
if (m_opaque_ap.get()) if (m_opaque_ap.get())
{
if (log)
log->Printf ("SBCommandReturnObject::GetError ==> %s", m_opaque_ap->GetErrorStream().GetData());
return m_opaque_ap->GetErrorStream().GetData(); return m_opaque_ap->GetErrorStream().GetData();
}
if (log)
log->Printf ("SBCommandReturnObject::GetError ==> NULL");
return NULL; return NULL;
} }

View File

@ -11,6 +11,7 @@
#include "lldb/API/SBBroadcaster.h" #include "lldb/API/SBBroadcaster.h"
#include "lldb/Core/Communication.h" #include "lldb/Core/Communication.h"
#include "lldb/Core/ConnectionFileDescriptor.h" #include "lldb/Core/ConnectionFileDescriptor.h"
#include "lldb/Core/Log.h"
using namespace lldb; using namespace lldb;
using namespace lldb_private; using namespace lldb_private;
@ -21,12 +22,21 @@ SBCommunication::SBCommunication() :
m_opaque (NULL), m_opaque (NULL),
m_opaque_owned (false) m_opaque_owned (false)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBCommunication::SBCommunication () ==> this = %p", this);
} }
SBCommunication::SBCommunication(const char * broadcaster_name) : SBCommunication::SBCommunication(const char * broadcaster_name) :
m_opaque (new Communication (broadcaster_name)), m_opaque (new Communication (broadcaster_name)),
m_opaque_owned (true) m_opaque_owned (true)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBCommunication::SBCommunication (const char *broadcaster_name) broadcaster_name = '%s' ==> "
"this = %p (m_opaque = %p)", broadcaster_name, this, m_opaque);
} }
SBCommunication::~SBCommunication() SBCommunication::~SBCommunication()
@ -76,19 +86,36 @@ SBCommunication::Connect (const char *url)
ConnectionStatus ConnectionStatus
SBCommunication::AdoptFileDesriptor (int fd, bool owns_fd) SBCommunication::AdoptFileDesriptor (int fd, bool owns_fd)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBCommunication::AdoptFileDescriptor (%d, %s)", fd, (owns_fd ? "true" : "false"));
if (m_opaque) if (m_opaque)
{ {
if (m_opaque->HasConnection ()) if (m_opaque->HasConnection ())
{ {
if (m_opaque->IsConnected()) if (m_opaque->IsConnected())
m_opaque->Disconnect (); m_opaque->Disconnect();
} }
m_opaque->SetConnection (new ConnectionFileDescriptor (fd, owns_fd)); m_opaque->SetConnection (new ConnectionFileDescriptor (fd, owns_fd));
if (m_opaque->IsConnected()) if (m_opaque->IsConnected())
{
if (log)
log->Printf ("SBCommunication::AdoptFileDescriptor ==> eConnectionStatusSuccess");
return eConnectionStatusSuccess; return eConnectionStatusSuccess;
}
else else
{
if (log)
log->Printf ("SBCommunication::AdoptFileDescriptor ==> eConnectionStatusLostConnection");
return eConnectionStatusLostConnection; return eConnectionStatusLostConnection;
}
} }
if (log)
log->Printf ("SBCommunication::AdoptFileDescriptor ==> eConnectionStatusNoConnection");
return eConnectionStatusNoConnection; return eConnectionStatusNoConnection;
} }
@ -96,9 +123,19 @@ SBCommunication::AdoptFileDesriptor (int fd, bool owns_fd)
ConnectionStatus ConnectionStatus
SBCommunication::Disconnect () SBCommunication::Disconnect ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBCommunication::Disconnect ()");
ConnectionStatus status= eConnectionStatusNoConnection;
if (m_opaque) if (m_opaque)
return m_opaque->Disconnect (); status = m_opaque->Disconnect ();
return eConnectionStatusNoConnection;
if (log)
log->Printf ("SBCommunication::Disconnect ==> %s", Communication::ConnectionStatusAsCString (status));
return status;
} }
bool bool
@ -131,18 +168,38 @@ SBCommunication::Write (const void *src, size_t src_len, ConnectionStatus &statu
bool bool
SBCommunication::ReadThreadStart () SBCommunication::ReadThreadStart ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBCommunication::ReadThreadStart ()");
bool success = false;
if (m_opaque) if (m_opaque)
return m_opaque->StartReadThread (); success = m_opaque->StartReadThread ();
return false;
if (log)
log->Printf ("SBCommunication::ReadThreadStart ==> %s", (success ? "true" : "false"));
return success;
} }
bool bool
SBCommunication::ReadThreadStop () SBCommunication::ReadThreadStop ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBCommunication::ReadThreadStop ()");
bool success = false;
if (m_opaque) if (m_opaque)
return m_opaque->StopReadThread (); success = m_opaque->StopReadThread ();
return false;
if (log)
log->Printf ("SBCommunication::ReadThreadStop ==> %s", (success ? "true" : "false"));
return success;
} }
bool bool
@ -160,11 +217,23 @@ SBCommunication::SetReadThreadBytesReceivedCallback
void *callback_baton void *callback_baton
) )
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBCommunication::SetReadThreadBytesReceivedCallback (callback, baton)");
// CAROLINE: Fixme: Fix the arguments printed out in the log message above
if (m_opaque) if (m_opaque)
{ {
m_opaque->SetReadThreadBytesReceivedCallback (callback, callback_baton); m_opaque->SetReadThreadBytesReceivedCallback (callback, callback_baton);
if (log)
log->Printf ("SBCommunication::SetReaDThreadBytesReceivedCallback ==> true");
return true; return true;
} }
if (log)
log->Printf ("SBCommunication::SetReaDThreadBytesReceivedCallback ==> false");
return false; return false;
} }

View File

@ -13,6 +13,7 @@
#include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/LineEntry.h" #include "lldb/Symbol/LineEntry.h"
#include "lldb/Symbol/LineTable.h" #include "lldb/Symbol/LineTable.h"
#include "lldb/Core/Log.h"
using namespace lldb; using namespace lldb;
using namespace lldb_private; using namespace lldb_private;
@ -21,11 +22,24 @@ using namespace lldb_private;
SBCompileUnit::SBCompileUnit () : SBCompileUnit::SBCompileUnit () :
m_opaque_ptr (NULL) m_opaque_ptr (NULL)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBCompileUnit::SBCompileUnit () ==> this = %p", this);
} }
SBCompileUnit::SBCompileUnit (lldb_private::CompileUnit *lldb_object_ptr) : SBCompileUnit::SBCompileUnit (lldb_private::CompileUnit *lldb_object_ptr) :
m_opaque_ptr (lldb_object_ptr) m_opaque_ptr (lldb_object_ptr)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
{
SBStream sstr;
GetDescription (sstr);
log->Printf ("SBCompileUnit::SBCompileUnit (lldb_private::CompileUnit *lldb_object_ptr) lldb_object_ptr = %p"
" this = %p (%s)", lldb_object_ptr, this, sstr.GetData());
}
} }
SBCompileUnit::~SBCompileUnit () SBCompileUnit::~SBCompileUnit ()
@ -57,6 +71,11 @@ SBCompileUnit::GetNumLineEntries () const
SBLineEntry SBLineEntry
SBCompileUnit::GetLineEntryAtIndex (uint32_t idx) const SBCompileUnit::GetLineEntryAtIndex (uint32_t idx) const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBCompileUnit::GetLineEntryAtIndex (%d)", idx);
SBLineEntry sb_line_entry; SBLineEntry sb_line_entry;
if (m_opaque_ptr) if (m_opaque_ptr)
{ {
@ -68,12 +87,29 @@ SBCompileUnit::GetLineEntryAtIndex (uint32_t idx) const
sb_line_entry.SetLineEntry(line_entry); sb_line_entry.SetLineEntry(line_entry);
} }
} }
if (log)
{
SBStream sstr;
sb_line_entry.GetDescription (sstr);
log->Printf ("SBCompileUnit::GetLineEntryAtIndex ==> %s", sstr.GetData());
}
return sb_line_entry; return sb_line_entry;
} }
uint32_t uint32_t
SBCompileUnit::FindLineEntryIndex (uint32_t start_idx, uint32_t line, SBFileSpec *inline_file_spec) const SBCompileUnit::FindLineEntryIndex (uint32_t start_idx, uint32_t line, SBFileSpec *inline_file_spec) const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
SBStream sstr;
inline_file_spec->GetDescription (sstr);
log->Printf ("SBCompileUnit::FindLineEntryIndex (%d, %d, %s)", start_idx, line, sstr.GetData());
}
if (m_opaque_ptr) if (m_opaque_ptr)
{ {
FileSpec file_spec; FileSpec file_spec;
@ -82,11 +118,20 @@ SBCompileUnit::FindLineEntryIndex (uint32_t start_idx, uint32_t line, SBFileSpec
else else
file_spec = *m_opaque_ptr; file_spec = *m_opaque_ptr;
return m_opaque_ptr->FindLineEntry (start_idx,
line, uint32_t ret_value = m_opaque_ptr->FindLineEntry (start_idx,
inline_file_spec ? inline_file_spec->get() : NULL, line,
NULL); inline_file_spec ? inline_file_spec->get() : NULL,
NULL);
if (log)
log->Printf ("SBCompileUnit::FindLineEntryIndex ==> %d", ret_value);
return ret_value;
} }
if (log)
log->Printf ("SBCompileUnit::FindLineEntryIndex ==> %d", UINT32_MAX);
return UINT32_MAX; return UINT32_MAX;
} }

View File

@ -37,6 +37,11 @@ using namespace lldb_private;
void void
SBDebugger::Initialize () SBDebugger::Initialize ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBDebugger::Initialize ()");
Debugger::Initialize(); Debugger::Initialize();
} }
@ -49,14 +54,32 @@ SBDebugger::Terminate ()
void void
SBDebugger::Clear () SBDebugger::Clear ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBDebugger::Clear ()");
m_opaque_sp.reset(); m_opaque_sp.reset();
} }
SBDebugger SBDebugger
SBDebugger::Create() SBDebugger::Create()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBDebugger::Create ()");
SBDebugger debugger; SBDebugger debugger;
debugger.reset(Debugger::CreateInstance()); debugger.reset(Debugger::CreateInstance());
if (log)
{
SBStream sstr;
debugger.GetDescription (sstr);
log->Printf ("SBDebugger::Create ==> %s", sstr.GetData());
}
return debugger; return debugger;
} }
@ -95,6 +118,11 @@ SBDebugger::SkipLLDBInitFiles (bool b)
void void
SBDebugger::SetInputFileHandle (FILE *fh, bool transfer_ownership) SBDebugger::SetInputFileHandle (FILE *fh, bool transfer_ownership)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBDebugger::SetInputFileHandle (%p, %s)", fh, (transfer_ownership ? "true" : "false"));
if (m_opaque_sp) if (m_opaque_sp)
m_opaque_sp->SetInputFileHandle (fh, transfer_ownership); m_opaque_sp->SetInputFileHandle (fh, transfer_ownership);
} }
@ -102,6 +130,12 @@ SBDebugger::SetInputFileHandle (FILE *fh, bool transfer_ownership)
void void
SBDebugger::SetOutputFileHandle (FILE *fh, bool transfer_ownership) SBDebugger::SetOutputFileHandle (FILE *fh, bool transfer_ownership)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBDebugger::SetOutputFileHandle (%p, %s)", fh, (transfer_ownership ? "true" : "false"));
if (m_opaque_sp) if (m_opaque_sp)
m_opaque_sp->SetOutputFileHandle (fh, transfer_ownership); m_opaque_sp->SetOutputFileHandle (fh, transfer_ownership);
} }
@ -109,6 +143,12 @@ SBDebugger::SetOutputFileHandle (FILE *fh, bool transfer_ownership)
void void
SBDebugger::SetErrorFileHandle (FILE *fh, bool transfer_ownership) SBDebugger::SetErrorFileHandle (FILE *fh, bool transfer_ownership)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBDebugger::SetErrorFileHandle (%p, %s)", fh, (transfer_ownership ? "true" : "false"));
if (m_opaque_sp) if (m_opaque_sp)
m_opaque_sp->SetErrorFileHandle (fh, transfer_ownership); m_opaque_sp->SetErrorFileHandle (fh, transfer_ownership);
} }
@ -140,9 +180,15 @@ SBDebugger::GetErrorFileHandle ()
SBCommandInterpreter SBCommandInterpreter
SBDebugger::GetCommandInterpreter () SBDebugger::GetCommandInterpreter ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBDebugger::GetCommandInterpreter ()");
SBCommandInterpreter sb_interpreter; SBCommandInterpreter sb_interpreter;
if (m_opaque_sp) if (m_opaque_sp)
sb_interpreter.reset (&m_opaque_sp->GetCommandInterpreter()); sb_interpreter.reset (&m_opaque_sp->GetCommandInterpreter());
return sb_interpreter; return sb_interpreter;
} }
@ -181,9 +227,15 @@ SBDebugger::HandleCommand (const char *command)
SBListener SBListener
SBDebugger::GetListener () SBDebugger::GetListener ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBDebugger::GetListener ()");
SBListener sb_listener; SBListener sb_listener;
if (m_opaque_sp) if (m_opaque_sp)
sb_listener.reset(&m_opaque_sp->GetListener(), false); sb_listener.reset(&m_opaque_sp->GetListener(), false);
return sb_listener; return sb_listener;
} }
@ -357,6 +409,11 @@ SBDebugger::GetVersionString ()
const char * const char *
SBDebugger::StateAsCString (lldb::StateType state) SBDebugger::StateAsCString (lldb::StateType state)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBDebugger::StateAsCString ==> %s", lldb_private::StateAsCString (state));
return lldb_private::StateAsCString (state); return lldb_private::StateAsCString (state);
} }
@ -369,6 +426,12 @@ SBDebugger::StateIsRunningState (lldb::StateType state)
bool bool
SBDebugger::StateIsStoppedState (lldb::StateType state) SBDebugger::StateIsStoppedState (lldb::StateType state)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBDebugger::StateIsStoppedState ==> %s",
(lldb_private::StateIsStoppedState (state) ? "true" : "false"));
return lldb_private::StateIsStoppedState (state); return lldb_private::StateIsStoppedState (state);
} }
@ -393,6 +456,11 @@ SBDebugger::CreateTargetWithFileAndTargetTriple (const char *filename,
SBTarget SBTarget
SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *archname) SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *archname)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBDebugger::CreateTargetWithFileAndArch (%s, %s)", filename, archname);
SBTarget target; SBTarget target;
if (m_opaque_sp) if (m_opaque_sp)
{ {
@ -430,6 +498,14 @@ SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *archn
target.reset(target_sp); target.reset(target_sp);
} }
} }
if (log)
{
SBStream sstr;
target.GetDescription (sstr, lldb::eDescriptionLevelFull);
log->Printf ("SBDebugger::CreateTargetWithFileAndArch ==> %s", sstr.GetData());
}
return target; return target;
} }
@ -522,15 +598,33 @@ SBDebugger::GetNumTargets ()
SBTarget SBTarget
SBDebugger::GetSelectedTarget () SBDebugger::GetSelectedTarget ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBDebugger::GetSelectedTarget ()");
SBTarget sb_target; SBTarget sb_target;
if (m_opaque_sp) if (m_opaque_sp)
sb_target.reset(m_opaque_sp->GetTargetList().GetSelectedTarget ()); sb_target.reset(m_opaque_sp->GetTargetList().GetSelectedTarget ());
if (log)
{
SBStream sstr;
sb_target.GetDescription (sstr, lldb::eDescriptionLevelBrief);
log->Printf ("SBDebugger::GetSelectedTarget ==> %s", sstr.GetData());
}
return sb_target; return sb_target;
} }
void void
SBDebugger::DispatchInput (void *baton, const void *data, size_t data_len) SBDebugger::DispatchInput (void *baton, const void *data, size_t data_len)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBDebugger::DispatchInput (%p, %s, %d)", baton, (const char *) data, (uint32_t) data_len);
if (m_opaque_sp) if (m_opaque_sp)
m_opaque_sp->DispatchInput ((const char *) data, data_len); m_opaque_sp->DispatchInput ((const char *) data, data_len);
} }
@ -538,6 +632,11 @@ SBDebugger::DispatchInput (void *baton, const void *data, size_t data_len)
void void
SBDebugger::PushInputReader (SBInputReader &reader) SBDebugger::PushInputReader (SBInputReader &reader)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBDebugger::PushInputReader (%p)", &reader);
if (m_opaque_sp && reader.IsValid()) if (m_opaque_sp && reader.IsValid())
{ {
InputReaderSP reader_sp(*reader); InputReaderSP reader_sp(*reader);
@ -640,6 +739,11 @@ SBDebugger::SetTerminalWidth (uint32_t term_width)
const char * const char *
SBDebugger::GetPrompt() const SBDebugger::GetPrompt() const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBDebugger::GetPrompt ==> '%s'", (m_opaque_sp ? m_opaque_sp->GetPrompt() : ""));
if (m_opaque_sp) if (m_opaque_sp)
return m_opaque_sp->GetPrompt (); return m_opaque_sp->GetPrompt ();
return 0; return 0;

View File

@ -10,6 +10,7 @@
#include "lldb/API/SBError.h" #include "lldb/API/SBError.h"
#include "lldb/API/SBStream.h" #include "lldb/API/SBStream.h"
#include "lldb/Core/Error.h" #include "lldb/Core/Error.h"
#include "lldb/Core/Log.h"
#include <stdarg.h> #include <stdarg.h>
@ -20,13 +21,27 @@ using namespace lldb_private;
SBError::SBError () : SBError::SBError () :
m_opaque_ap () m_opaque_ap ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBError::SBError () ==> this = %p", this);
} }
SBError::SBError (const SBError &rhs) : SBError::SBError (const SBError &rhs) :
m_opaque_ap () m_opaque_ap ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (rhs.IsValid()) if (rhs.IsValid())
m_opaque_ap.reset (new Error(*rhs)); m_opaque_ap.reset (new Error(*rhs));
if (log)
{
SBStream sstr;
GetDescription (sstr);
log->Printf ("SBError::SBError (const SBError &rhs) rhs.m_opaque_ap.get() = %p ==> this = %p (%s)",
(rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), this, sstr.GetData());
}
} }
@ -37,6 +52,16 @@ SBError::~SBError()
const SBError & const SBError &
SBError::operator = (const SBError &rhs) SBError::operator = (const SBError &rhs)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
SBStream sstr;
rhs.GetDescription (sstr);
log->Printf ("SBError::operator= (const SBError &rhs) rhs.m_opaque_ap.get() = %p (%s)",
(rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), sstr.GetData());
}
if (rhs.IsValid()) if (rhs.IsValid())
{ {
if (m_opaque_ap.get()) if (m_opaque_ap.get())
@ -48,6 +73,10 @@ SBError::operator = (const SBError &rhs)
{ {
m_opaque_ap.reset(); m_opaque_ap.reset();
} }
if (log)
log->Printf ("SBError::operator= ==> this = %p", this);
return *this; return *this;
} }
@ -70,9 +99,19 @@ SBError::Clear ()
bool bool
SBError::Fail () const SBError::Fail () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBError::Fail ()");
bool ret_value = false;
if (m_opaque_ap.get()) if (m_opaque_ap.get())
return m_opaque_ap->Fail(); ret_value = m_opaque_ap->Fail();
return false;
if (log)
log->Printf ("SBError::Fail ==> %s", (ret_value ? "true" : "false"));
return ret_value;
} }
bool bool
@ -198,3 +237,22 @@ SBError::GetDescription (SBStream &description)
return true; return true;
} }
bool
SBError::GetDescription (SBStream &description) const
{
if (m_opaque_ap.get())
{
if (Success())
description.Printf ("Status: Success");
else
{
const char * err_string = GetCString();
description.Printf ("Status: Error: %s", (err_string != NULL ? err_string : ""));
}
}
else
description.Printf ("No value");
return true;
}

View File

@ -27,18 +27,34 @@ SBEvent::SBEvent () :
m_event_sp (), m_event_sp (),
m_opaque (NULL) m_opaque (NULL)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBEvent::SBEvent () ==> this = %p", this);
} }
SBEvent::SBEvent (uint32_t event_type, const char *cstr, uint32_t cstr_len) : SBEvent::SBEvent (uint32_t event_type, const char *cstr, uint32_t cstr_len) :
m_event_sp (new Event (event_type, new EventDataBytes (cstr, cstr_len))), m_event_sp (new Event (event_type, new EventDataBytes (cstr, cstr_len))),
m_opaque (m_event_sp.get()) m_opaque (m_event_sp.get())
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
{
log->Printf ("SBEvent::SBEvent (uint32_t event_type, const char *cstr, uint32_t cstr_len)");
log->Printf (" event_type = %d, cstr = '%s', cstr_len = %d ==> this = %p (m_opaque = %p)", event_type,
cstr, cstr_len, this, m_opaque);
}
} }
SBEvent::SBEvent (EventSP &event_sp) : SBEvent::SBEvent (EventSP &event_sp) :
m_event_sp (event_sp), m_event_sp (event_sp),
m_opaque (event_sp.get()) m_opaque (event_sp.get())
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBEvent::SBEvent (EventSP &event_sp) event_sp.get() = %p ==> this = %p", event_sp.get(), this);
} }
SBEvent::~SBEvent() SBEvent::~SBEvent()
@ -57,10 +73,20 @@ SBEvent::GetDataFlavor ()
uint32_t uint32_t
SBEvent::GetType () const SBEvent::GetType () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBEvent::GetType ()");
const Event *lldb_event = get(); const Event *lldb_event = get();
uint32_t event_type = 0;
if (lldb_event) if (lldb_event)
return lldb_event->GetType(); event_type = lldb_event->GetType();
return 0;
if (log)
log->Printf ("SBEvent::GetType ==> %d", event_type);
return event_type;
} }
SBBroadcaster SBBroadcaster
@ -88,10 +114,20 @@ SBEvent::BroadcasterMatchesPtr (const SBBroadcaster *broadcaster)
bool bool
SBEvent::BroadcasterMatchesRef (const SBBroadcaster &broadcaster) SBEvent::BroadcasterMatchesRef (const SBBroadcaster &broadcaster)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBEvent::BroadcasterMatchesRef (broacaster) broadcaster = %p", &broadcaster);
Event *lldb_event = get(); Event *lldb_event = get();
bool success = false;
if (lldb_event) if (lldb_event)
return lldb_event->BroadcasterIs (broadcaster.get()); success = lldb_event->BroadcasterIs (broadcaster.get());
return false;
if (log)
log->Printf ("SBEvent::BroadcasterMathesRef ==> %s", (success ? "true" : "false"));
return success;
} }
void void
@ -147,6 +183,12 @@ SBEvent::IsValid() const
const char * const char *
SBEvent::GetCStringFromEvent (const SBEvent &event) SBEvent::GetCStringFromEvent (const SBEvent &event)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("GetCStringFromEvent ==> %s",
reinterpret_cast<const char *>(EventDataBytes::GetBytesFromEvent (event.get())));
return reinterpret_cast<const char *>(EventDataBytes::GetBytesFromEvent (event.get())); return reinterpret_cast<const char *>(EventDataBytes::GetBytesFromEvent (event.get()));
} }
@ -164,3 +206,17 @@ SBEvent::GetDescription (SBStream &description)
return true; return true;
} }
bool
SBEvent::GetDescription (SBStream &description) const
{
if (m_opaque)
{
description.ref();
m_opaque->Dump (description.get());
}
else
description.Printf ("No value");
return true;
}

View File

@ -10,6 +10,7 @@
#include "lldb/API/SBFileSpec.h" #include "lldb/API/SBFileSpec.h"
#include "lldb/API/SBStream.h" #include "lldb/API/SBStream.h"
#include "lldb/Core/FileSpec.h" #include "lldb/Core/FileSpec.h"
#include "lldb/Core/Log.h"
using namespace lldb; using namespace lldb;
using namespace lldb_private; using namespace lldb_private;
@ -19,11 +20,25 @@ using namespace lldb_private;
SBFileSpec::SBFileSpec () : SBFileSpec::SBFileSpec () :
m_opaque_ap() m_opaque_ap()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBFileSpec::SBFileSpec () ==> this = %p", this);
} }
SBFileSpec::SBFileSpec (const SBFileSpec &rhs) : SBFileSpec::SBFileSpec (const SBFileSpec &rhs) :
m_opaque_ap() m_opaque_ap()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
{
SBStream sstr;
rhs.GetDescription (sstr);
log->Printf ("SBFileSpec::SBFileSpec (const SBFileSpec &rhs) rhs.m_opaque_ap.get() = %p (%s) ==> this = %p",
rhs.m_opaque_ap.get(), sstr.GetData(), this);
}
if (rhs.m_opaque_ap.get()) if (rhs.m_opaque_ap.get())
m_opaque_ap.reset (new FileSpec (rhs.get())); m_opaque_ap.reset (new FileSpec (rhs.get()));
} }
@ -37,6 +52,12 @@ SBFileSpec::SBFileSpec (const char *path) :
SBFileSpec::SBFileSpec (const char *path, bool resolve) : SBFileSpec::SBFileSpec (const char *path, bool resolve) :
m_opaque_ap(new FileSpec (path, resolve)) m_opaque_ap(new FileSpec (path, resolve))
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBFileSpec::SBFileSpec (const char *path, bool resolve) path = '%s', resolve = %s ==> "
"this = %p (m_opaque_ap.get() = %p)", path, (resolve ? "true" : "false"), this,
m_opaque_ap.get());
} }
SBFileSpec::~SBFileSpec () SBFileSpec::~SBFileSpec ()
@ -63,9 +84,19 @@ SBFileSpec::IsValid() const
bool bool
SBFileSpec::Exists () const SBFileSpec::Exists () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBFileSpec::Exists ()");
bool result = false;
if (m_opaque_ap.get()) if (m_opaque_ap.get())
return m_opaque_ap->Exists(); result = m_opaque_ap->Exists();
return false;
if (log)
log->Printf ("SBFileSpec::Exists ==> %s", (result ? "true" : "false"));
return result;
} }
bool bool
@ -85,8 +116,21 @@ SBFileSpec::ResolvePath (const char *src_path, char *dst_path, size_t dst_len)
const char * const char *
SBFileSpec::GetFilename() const SBFileSpec::GetFilename() const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBFileSpec::GetFilename ()");
if (m_opaque_ap.get()) if (m_opaque_ap.get())
{
if (log)
log->Printf ("SBFileSpec::GetFilename ==> %s", m_opaque_ap->GetFilename().AsCString());
return m_opaque_ap->GetFilename().AsCString(); return m_opaque_ap->GetFilename().AsCString();
}
if (log)
log->Printf ("SBFileSpec::GetFilename ==> NULL");
return NULL; return NULL;
} }
@ -101,8 +145,22 @@ SBFileSpec::GetDirectory() const
uint32_t uint32_t
SBFileSpec::GetPath (char *dst_path, size_t dst_len) const SBFileSpec::GetPath (char *dst_path, size_t dst_len) const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBFileSpec::GetPath (dst_path, dst_len)");
uint32_t result;
if (m_opaque_ap.get()) if (m_opaque_ap.get())
return m_opaque_ap->GetPath (dst_path, dst_len); {
result = m_opaque_ap->GetPath (dst_path, dst_len);
if (log)
log->Printf ("SBFileSpec::GetPath ==> %s (%d)", dst_path, result);
return result;
}
if (log)
log->Printf ("SBFileSpec::GetPath ==> NULL (0)");
if (dst_path && dst_len) if (dst_path && dst_len)
*dst_path = '\0'; *dst_path = '\0';
@ -164,3 +222,23 @@ SBFileSpec::GetDescription (SBStream &description)
return true; return true;
} }
bool
SBFileSpec::GetDescription (SBStream &description) const
{
if (m_opaque_ap.get())
{
const char *filename = GetFilename();
const char *dir_name = GetDirectory();
if (!filename && !dir_name)
description.Printf ("No value");
else if (!dir_name)
description.Printf ("%s", filename);
else
description.Printf ("%s/%s", dir_name, filename);
}
else
description.Printf ("No value");
return true;
}

View File

@ -16,6 +16,7 @@
#include "lldb/Core/Address.h" #include "lldb/Core/Address.h"
#include "lldb/Core/ConstString.h" #include "lldb/Core/ConstString.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Stream.h" #include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h" #include "lldb/Core/StreamFile.h"
#include "lldb/Core/ValueObjectRegister.h" #include "lldb/Core/ValueObjectRegister.h"
@ -45,11 +46,24 @@ using namespace lldb_private;
SBFrame::SBFrame () : SBFrame::SBFrame () :
m_opaque_sp () m_opaque_sp ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBFrame::SBFrame () ==> this = %p", this);
} }
SBFrame::SBFrame (const lldb::StackFrameSP &lldb_object_sp) : SBFrame::SBFrame (const lldb::StackFrameSP &lldb_object_sp) :
m_opaque_sp (lldb_object_sp) m_opaque_sp (lldb_object_sp)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
{
SBStream sstr;
GetDescription (sstr);
log->Printf ("SBFrame::SBFrame (const lldb::StackFrameSP &lldb_object_sp) lldb_object_sp.get() = %p "
" ==> this = %p (%s)", lldb_object_sp.get(), this, sstr.GetData());
}
} }
SBFrame::~SBFrame() SBFrame::~SBFrame()
@ -73,9 +87,18 @@ SBFrame::IsValid() const
SBSymbolContext SBSymbolContext
SBFrame::GetSymbolContext (uint32_t resolve_scope) const SBFrame::GetSymbolContext (uint32_t resolve_scope) const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBFrame::GetSymbolContext (%d)", resolve_scope);
SBSymbolContext sb_sym_ctx; SBSymbolContext sb_sym_ctx;
if (m_opaque_sp) if (m_opaque_sp)
sb_sym_ctx.SetSymbolContext(&m_opaque_sp->GetSymbolContext (resolve_scope)); sb_sym_ctx.SetSymbolContext(&m_opaque_sp->GetSymbolContext (resolve_scope));
if (log)
log->Printf ("SBFrame::GetSymbolContext ==> SBSymbolContext (this = %p)", &sb_sym_ctx);
return sb_sym_ctx; return sb_sym_ctx;
} }
@ -89,7 +112,16 @@ SBFrame::GetModule () const
SBCompileUnit SBCompileUnit
SBFrame::GetCompileUnit () const SBFrame::GetCompileUnit () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBFrame::GetCompileUnit()");
SBCompileUnit sb_comp_unit(m_opaque_sp->GetSymbolContext (eSymbolContextCompUnit).comp_unit); SBCompileUnit sb_comp_unit(m_opaque_sp->GetSymbolContext (eSymbolContextCompUnit).comp_unit);
if (log)
log->Printf ("SBFrame::GetCompileUnit ==> SBCompileUnit (this = %p", &sb_comp_unit);
return sb_comp_unit; return sb_comp_unit;
} }
@ -140,17 +172,37 @@ SBFrame::GetFrameID () const
lldb::addr_t lldb::addr_t
SBFrame::GetPC () const SBFrame::GetPC () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBFrame::GetPC ()");
lldb::addr_t addr = LLDB_INVALID_ADDRESS;
if (m_opaque_sp) if (m_opaque_sp)
return m_opaque_sp->GetFrameCodeAddress().GetLoadAddress (&m_opaque_sp->GetThread().GetProcess().GetTarget()); addr = m_opaque_sp->GetFrameCodeAddress().GetLoadAddress (&m_opaque_sp->GetThread().GetProcess().GetTarget());
return LLDB_INVALID_ADDRESS;
if (log)
log->Printf ("SBFrame::GetPC ==> %p", addr);
return addr;
} }
bool bool
SBFrame::SetPC (lldb::addr_t new_pc) SBFrame::SetPC (lldb::addr_t new_pc)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBFrame::SetPC (%p)", new_pc);
bool ret_val = false;
if (m_opaque_sp) if (m_opaque_sp)
return m_opaque_sp->GetRegisterContext()->SetPC (new_pc); ret_val = m_opaque_sp->GetRegisterContext()->SetPC (new_pc);
return false;
if (log)
log->Printf ("SBFrame::SetPC ==> %s", (ret_val ? "true" : "false"));
return ret_val;
} }
lldb::addr_t lldb::addr_t
@ -165,9 +217,19 @@ SBFrame::GetSP () const
lldb::addr_t lldb::addr_t
SBFrame::GetFP () const SBFrame::GetFP () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBFrame::GetFP ()");
lldb::addr_t addr = LLDB_INVALID_ADDRESS;
if (m_opaque_sp) if (m_opaque_sp)
return m_opaque_sp->GetRegisterContext()->GetFP(); addr = m_opaque_sp->GetRegisterContext()->GetFP();
return LLDB_INVALID_ADDRESS;
if (log)
log->Printf ("SBFrame::GetFP ==> %p", addr);
return addr;
} }
@ -303,13 +365,30 @@ SBFrame::get() const
SBThread SBThread
SBFrame::GetThread () const SBFrame::GetThread () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBFrame::GetThread ()");
SBThread sb_thread (m_opaque_sp->GetThread().GetSP()); SBThread sb_thread (m_opaque_sp->GetThread().GetSP());
if (log)
log->Printf ("SBFrame::GetThread ==> SBThread (this = %p)", &sb_thread);
return sb_thread; return sb_thread;
} }
const char * const char *
SBFrame::Disassemble () const SBFrame::Disassemble () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
Log *verbose_log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (verbose_log)
verbose_log->Printf ("SBFrame::Disassemble () ==> %s", m_opaque_sp->Disassemble());
else if (log)
log->Printf ("SBFrame::Disassemble ()");
if (m_opaque_sp) if (m_opaque_sp)
return m_opaque_sp->Disassemble(); return m_opaque_sp->Disassemble();
return NULL; return NULL;
@ -329,6 +408,18 @@ SBFrame::GetVariables (bool arguments,
bool statics, bool statics,
bool in_scope_only) bool in_scope_only)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
log->Printf ("SBFrame::GetVariables (bool arguments, bool locals, bool statics, bool in_scope_only)");
log->Printf (" arguments = %s, locals = %s, statics = %s, in_scope_only = %s",
(arguments ? "true" : "false"),
(locals ? "true" : "false"),
(statics ? "true" : "false"),
(in_scope_only ? "true" : "false"));
}
SBValueList value_list; SBValueList value_list;
if (m_opaque_sp) if (m_opaque_sp)
{ {
@ -375,12 +466,29 @@ SBFrame::GetVariables (bool arguments,
} }
} }
} }
if (log)
{
log->Printf ("SBFrame::GetVariables ==> SBValueList (this = %p)", &value_list);
//uint32_t num_vars = value_list.GetSize();
//for (uint32_t i = 0; i < num_vars; ++i)
//{
// SBValue value = value_list.GetValueAtIndex (i);
// log->Printf (" %s : %s", value.GetName(), value.GetObjectDescription (*this));
//}
}
return value_list; return value_list;
} }
lldb::SBValueList lldb::SBValueList
SBFrame::GetRegisters () SBFrame::GetRegisters ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBFrame::GetRegisters ()");
SBValueList value_list; SBValueList value_list;
if (m_opaque_sp) if (m_opaque_sp)
{ {
@ -394,6 +502,18 @@ SBFrame::GetRegisters ()
} }
} }
} }
if (log)
{
log->Printf ("SBFrame::Registers ==> SBValueList (this = %p)", &value_list );
//uint32_t num_vars = value_list.GetSize();
//for (uint32_t i = 0; i < num_vars; ++i)
//{
// SBValue value = value_list.GetValueAtIndex (i);
// log->Printf (" %s : %s", value.GetName(), value.GetObjectDescription (*this));
//}
}
return value_list; return value_list;
} }

View File

@ -11,6 +11,7 @@
#include "lldb/API/SBProcess.h" #include "lldb/API/SBProcess.h"
#include "lldb/API/SBStream.h" #include "lldb/API/SBStream.h"
#include "lldb/Core/Disassembler.h" #include "lldb/Core/Disassembler.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h" #include "lldb/Core/Module.h"
#include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/Function.h" #include "lldb/Symbol/Function.h"
@ -24,11 +25,24 @@ using namespace lldb_private;
SBFunction::SBFunction () : SBFunction::SBFunction () :
m_opaque_ptr (NULL) m_opaque_ptr (NULL)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBFunction::SBFunction () ==> this = %p", this);
} }
SBFunction::SBFunction (lldb_private::Function *lldb_object_ptr) : SBFunction::SBFunction (lldb_private::Function *lldb_object_ptr) :
m_opaque_ptr (lldb_object_ptr) m_opaque_ptr (lldb_object_ptr)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
{
SBStream sstr;
GetDescription (sstr);
log->Printf ("SBFunction::SBFunction (lldb_Private::Function *lldb_object_ptr) lldb_object_ptr = %p "
" ==> this = %p (%s)", lldb_object_ptr, this, sstr.GetData());
}
} }
SBFunction::~SBFunction () SBFunction::~SBFunction ()
@ -45,8 +59,20 @@ SBFunction::IsValid () const
const char * const char *
SBFunction::GetName() const SBFunction::GetName() const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBFunction::GetName ()");
if (m_opaque_ptr) if (m_opaque_ptr)
{
if (log)
log->Printf ("SBFunction::GetName ==> %s", m_opaque_ptr->GetMangled().GetName().AsCString());
return m_opaque_ptr->GetMangled().GetName().AsCString(); return m_opaque_ptr->GetMangled().GetName().AsCString();
}
if (log)
log->Printf ("SBFunction::GetName ==> NULL");
return NULL; return NULL;
} }

View File

@ -10,6 +10,7 @@
#include "lldb/API/SBHostOS.h" #include "lldb/API/SBHostOS.h"
#include "lldb/API/SBError.h" #include "lldb/API/SBError.h"
#include "lldb/Core/FileSpec.h" #include "lldb/Core/FileSpec.h"
#include "lldb/Core/Log.h"
#include "lldb/Host/Host.h" #include "lldb/Host/Host.h"
using namespace lldb; using namespace lldb;
@ -34,6 +35,13 @@ SBHostOS::ThreadCreate
SBError *error_ptr SBError *error_ptr
) )
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBHostOS::ThreadCreate (%s, %p, %p, error_ptr)", name, thread_function, thread_arg);
// CAROLINE: FIXME: You need to log a return value?
return Host::ThreadCreate (name, thread_function, thread_arg, error_ptr ? error_ptr->get() : NULL); return Host::ThreadCreate (name, thread_function, thread_arg, error_ptr ? error_ptr->get() : NULL);
} }

View File

@ -13,8 +13,10 @@
#include "lldb/API/SBDebugger.h" #include "lldb/API/SBDebugger.h"
#include "lldb/API/SBError.h" #include "lldb/API/SBError.h"
#include "lldb/API/SBInputReader.h" #include "lldb/API/SBInputReader.h"
#include "lldb/API/SBStream.h"
#include "lldb/API/SBStringList.h" #include "lldb/API/SBStringList.h"
#include "lldb/Core/InputReader.h" #include "lldb/Core/InputReader.h"
#include "lldb/Core/Log.h"
using namespace lldb; using namespace lldb;
@ -26,16 +28,30 @@ SBInputReader::SBInputReader () :
m_callback_baton (NULL) m_callback_baton (NULL)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBInputReader::SBInputReader () ==> this = %p", this);
} }
SBInputReader::SBInputReader (const lldb::InputReaderSP &reader_sp) : SBInputReader::SBInputReader (const lldb::InputReaderSP &reader_sp) :
m_opaque_sp (reader_sp) m_opaque_sp (reader_sp)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBInputReader::SBInputReader (const lldb::InputReaderSP &reader_sp) reader_sp.get = %p"
" ==> this = %p", this);
} }
SBInputReader::SBInputReader (const SBInputReader &rhs) : SBInputReader::SBInputReader (const SBInputReader &rhs) :
m_opaque_sp (rhs.m_opaque_sp) m_opaque_sp (rhs.m_opaque_sp)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf("SBInputReader::SBInputReader (const SBInputReader &rhs) rhs.m_opaque_sp.get() = %p ==> this = %p",
rhs.m_opaque_sp.get(), this);
} }
SBInputReader::~SBInputReader () SBInputReader::~SBInputReader ()
@ -72,6 +88,17 @@ SBInputReader::Initialize
bool echo bool echo
) )
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
log->Printf("SBInputReader::Initialize (SBDebugger &debugger, Callback callback_function, void *baton, "
"lldb::InputReaderGranularity granularity, const char *end_token, const char *prompt, bool echo)");
log->Printf(" debugger (this = %p), callback_function, callback_baton = %p, granularity = %s, "
"end_token = '%s', prompt = '%s', echo = %s", &debugger, callback_baton,
InputReader::GranularityAsCString (granularity), end_token, prompt, (echo ? "true" : "false"));
}
SBError sb_error; SBError sb_error;
m_opaque_sp.reset (new InputReader (debugger.ref())); m_opaque_sp.reset (new InputReader (debugger.ref()));
@ -95,6 +122,13 @@ SBInputReader::Initialize
m_callback_baton = NULL; m_callback_baton = NULL;
} }
if (log)
{
SBStream sstr;
sb_error.GetDescription (sstr);
log->Printf ("SBInputReader::Initialize ==> SBError (this = %p, '%s')", &sb_error, sstr.GetData());
}
return sb_error; return sb_error;
} }
@ -162,10 +196,19 @@ SBInputReader::SetIsDone (bool value)
bool bool
SBInputReader::IsActive () const SBInputReader::IsActive () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBInputReader::IsActive ()");
bool ret_value = false;
if (m_opaque_sp) if (m_opaque_sp)
return m_opaque_sp->IsActive(); ret_value = m_opaque_sp->IsActive();
else
return false; if (log)
log->Printf ("SBInputReader::IsActive ==> %s", (ret_value ? "true" : "false"));
return ret_value;
} }
InputReaderGranularity InputReaderGranularity

View File

@ -10,22 +10,35 @@
#include "lldb/API/SBLineEntry.h" #include "lldb/API/SBLineEntry.h"
#include "lldb/API/SBStream.h" #include "lldb/API/SBStream.h"
#include "lldb/Symbol/LineEntry.h" #include "lldb/Symbol/LineEntry.h"
#include "lldb/Core/Log.h"
using namespace lldb; using namespace lldb;
using namespace lldb_private;
SBLineEntry::SBLineEntry () : SBLineEntry::SBLineEntry () :
m_opaque_ap () m_opaque_ap ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBLineEntry::SBLineEntry () ==> this = %p", this);
} }
SBLineEntry::SBLineEntry (const SBLineEntry &rhs) : SBLineEntry::SBLineEntry (const SBLineEntry &rhs) :
m_opaque_ap () m_opaque_ap ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (rhs.IsValid()) if (rhs.IsValid())
{ {
m_opaque_ap.reset (new lldb_private::LineEntry (*rhs)); m_opaque_ap.reset (new lldb_private::LineEntry (*rhs));
} }
if (log)
log->Printf ("SBLineEntry::SBLineEntry (const SBLineEntry &rhs) rhs.m_opaque_ap.get() = %p ==> this = %p ",
(rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), this);
} }
@ -33,8 +46,14 @@ SBLineEntry::SBLineEntry (const SBLineEntry &rhs) :
SBLineEntry::SBLineEntry (const lldb_private::LineEntry *lldb_object_ptr) : SBLineEntry::SBLineEntry (const lldb_private::LineEntry *lldb_object_ptr) :
m_opaque_ap () m_opaque_ap ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (lldb_object_ptr) if (lldb_object_ptr)
m_opaque_ap.reset (new lldb_private::LineEntry(*lldb_object_ptr)); m_opaque_ap.reset (new lldb_private::LineEntry(*lldb_object_ptr));
if (log)
log->Printf ("SBLineEntry::SBLineEntry (const lldb_private::LineEntry *lldb_object_ptr) lldb_object_ptr = %p"
" ==> this = %p (m_opaque_ap.get() = %p)", lldb_object_ptr, this, m_opaque_ap.get());
} }
const SBLineEntry & const SBLineEntry &
@ -66,9 +85,22 @@ SBLineEntry::~SBLineEntry ()
SBAddress SBAddress
SBLineEntry::GetStartAddress () const SBLineEntry::GetStartAddress () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBLineEntry::GetStartAddress ()");
SBAddress sb_address; SBAddress sb_address;
if (m_opaque_ap.get()) if (m_opaque_ap.get())
sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress()); sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress());
if (log)
{
SBStream sstr;
sb_address.GetDescription (sstr);
log->Printf ("SBLineEntry::GetStartAddress ==> SBAddress (this = %p, (%s)", &sb_address, sstr.GetData());
}
return sb_address; return sb_address;
} }
@ -94,18 +126,41 @@ SBLineEntry::IsValid () const
SBFileSpec SBFileSpec
SBLineEntry::GetFileSpec () const SBLineEntry::GetFileSpec () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBLineEntry::GetFileSpec ()");
SBFileSpec sb_file_spec; SBFileSpec sb_file_spec;
if (m_opaque_ap.get() && m_opaque_ap->file) if (m_opaque_ap.get() && m_opaque_ap->file)
sb_file_spec.SetFileSpec(m_opaque_ap->file); sb_file_spec.SetFileSpec(m_opaque_ap->file);
if (log)
{
SBStream sstr;
sb_file_spec.GetDescription (sstr);
log->Printf ("SBLineEntry::GetFileSpec ==> SBFileSpec (this = %p, '%s'", &sb_file_spec, sstr.GetData());
}
return sb_file_spec; return sb_file_spec;
} }
uint32_t uint32_t
SBLineEntry::GetLine () const SBLineEntry::GetLine () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBLineEntry::GetLine ()");
uint32_t line = 0;
if (m_opaque_ap.get()) if (m_opaque_ap.get())
return m_opaque_ap->line; line = m_opaque_ap->line;
return 0;
if (log)
log->Printf ("SBLineEntry::GetLine ==> %d", line);
return line;
} }

View File

@ -8,12 +8,14 @@
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
#include "lldb/Core/Listener.h" #include "lldb/Core/Listener.h"
#include "lldb/Core/Log.h"
#include "lldb/lldb-forward-rtti.h" #include "lldb/lldb-forward-rtti.h"
#include "lldb/Host/TimeValue.h" #include "lldb/Host/TimeValue.h"
#include "lldb/API/SBListener.h" #include "lldb/API/SBListener.h"
#include "lldb/API/SBEvent.h" #include "lldb/API/SBEvent.h"
#include "lldb/API/SBBroadcaster.h" #include "lldb/API/SBBroadcaster.h"
#include "lldb/API/SBStream.h"
using namespace lldb; using namespace lldb;
using namespace lldb_private; using namespace lldb_private;
@ -23,18 +25,32 @@ SBListener::SBListener () :
m_opaque_ptr (NULL), m_opaque_ptr (NULL),
m_opaque_ptr_owned (false) m_opaque_ptr_owned (false)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBListener::SBListener () ==> this = %p", this);
} }
SBListener::SBListener (const char *name) : SBListener::SBListener (const char *name) :
m_opaque_ptr (new Listener (name)), m_opaque_ptr (new Listener (name)),
m_opaque_ptr_owned (true) m_opaque_ptr_owned (true)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBListener::SBListener (const char *name) name = %s ==> this = %p (m_opaque_ptr = %p)",
name, this, m_opaque_ptr);
} }
SBListener::SBListener (Listener &listener) : SBListener::SBListener (Listener &listener) :
m_opaque_ptr (&listener), m_opaque_ptr (&listener),
m_opaque_ptr_owned (false) m_opaque_ptr_owned (false)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBListener::SBListener (Listener &listener) *listener = %p ==> this = %p (m_opaque_ptr = %p)",
&listener, this, m_opaque_ptr);
} }
SBListener::~SBListener () SBListener::~SBListener ()
@ -73,11 +89,24 @@ SBListener::Clear ()
uint32_t uint32_t
SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t event_mask) SBListener::StartListeningForEvents (const SBBroadcaster& broadcaster, uint32_t event_mask)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
log->Printf ("SBListener::StartListeningForEvents (const SBBroadcaster &broadcaster, uint32_t event_mask)"
" &broadcaster = %p, event_mask = %d", &broadcaster, event_mask);
}
uint32_t ret_value = 0;
if (m_opaque_ptr && broadcaster.IsValid()) if (m_opaque_ptr && broadcaster.IsValid())
{ {
return m_opaque_ptr->StartListeningForEvents (broadcaster.get(), event_mask); ret_value = m_opaque_ptr->StartListeningForEvents (broadcaster.get(), event_mask);
} }
return false;
if (log)
log->Printf ("SBListener::StartListeneingForEvents ==> %d", ret_value);
return ret_value;
} }
bool bool
@ -93,6 +122,15 @@ SBListener::StopListeningForEvents (const SBBroadcaster& broadcaster, uint32_t e
bool bool
SBListener::WaitForEvent (uint32_t num_seconds, SBEvent &event) SBListener::WaitForEvent (uint32_t num_seconds, SBEvent &event)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
SBStream sstr;
event.GetDescription (sstr);
log->Printf ("SBListener::WaitForEvent (%d, %s)", num_seconds, sstr.GetData());
}
if (m_opaque_ptr) if (m_opaque_ptr)
{ {
TimeValue time_value; TimeValue time_value;
@ -106,9 +144,15 @@ SBListener::WaitForEvent (uint32_t num_seconds, SBEvent &event)
if (m_opaque_ptr->WaitForEvent (time_value.IsValid() ? &time_value : NULL, event_sp)) if (m_opaque_ptr->WaitForEvent (time_value.IsValid() ? &time_value : NULL, event_sp))
{ {
event.reset (event_sp); event.reset (event_sp);
if (log)
log->Printf ("SBListener::WaitForEvent ==> true");
return true; return true;
} }
} }
if (log)
log->Printf ("SBListener::WaitForEvent ==> false");
event.reset (NULL); event.reset (NULL);
return false; return false;
} }

View File

@ -13,18 +13,30 @@
#include "lldb/API/SBFileSpec.h" #include "lldb/API/SBFileSpec.h"
#include "lldb/API/SBStream.h" #include "lldb/API/SBStream.h"
#include "lldb/Core/Module.h" #include "lldb/Core/Module.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/STreamString.h"
using namespace lldb; using namespace lldb;
using namespace lldb_private;
SBModule::SBModule () : SBModule::SBModule () :
m_opaque_sp () m_opaque_sp ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBModule::SBModule () ==> this = %p", this);
} }
SBModule::SBModule (const lldb::ModuleSP& module_sp) : SBModule::SBModule (const lldb::ModuleSP& module_sp) :
m_opaque_sp (module_sp) m_opaque_sp (module_sp)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBModule::SBModule (const lldb::ModuleSP &module_sp) module_sp.get() = %p ==> this = %p",
module_sp.get(), this);
} }
SBModule::~SBModule () SBModule::~SBModule ()
@ -40,17 +52,46 @@ SBModule::IsValid () const
SBFileSpec SBFileSpec
SBModule::GetFileSpec () const SBModule::GetFileSpec () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBModule::GetFileSpec ()");
SBFileSpec file_spec; SBFileSpec file_spec;
if (m_opaque_sp) if (m_opaque_sp)
file_spec.SetFileSpec(m_opaque_sp->GetFileSpec()); file_spec.SetFileSpec(m_opaque_sp->GetFileSpec());
if (log)
{
SBStream sstr;
file_spec.GetDescription (sstr);
log->Printf ("SBModule::GetFileSpec ==> SBFileSpec (this = %p, 's')", &file_spec, sstr.GetData());
}
return file_spec; return file_spec;
} }
const uint8_t * const uint8_t *
SBModule::GetUUIDBytes () const SBModule::GetUUIDBytes () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBModule::GetUUIDBytes ()");
if (m_opaque_sp) if (m_opaque_sp)
{
if (log)
{
StreamString sstr;
m_opaque_sp->GetUUID().Dump (&sstr);
log->Printf ("SBModule::GetUUIDBytes ==> '%s'", sstr.GetData());
}
return (const uint8_t *)m_opaque_sp->GetUUID().GetBytes(); return (const uint8_t *)m_opaque_sp->GetUUID().GetBytes();
}
if (log)
log->Printf ("SBModule::GetUUIDBytes ==> NULL");
return NULL; return NULL;
} }
@ -134,7 +175,7 @@ SBModule::GetDescription (SBStream &description)
if (m_opaque_sp) if (m_opaque_sp)
{ {
description.ref(); description.ref();
m_opaque_sp->Dump (description.get()); m_opaque_sp->GetDescription (description.get());
} }
else else
description.Printf ("No value"); description.Printf ("No value");

View File

@ -16,6 +16,7 @@
#include "lldb/Core/DataBufferHeap.h" #include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/DataExtractor.h" #include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Debugger.h" #include "lldb/Core/Debugger.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/State.h" #include "lldb/Core/State.h"
#include "lldb/Core/Stream.h" #include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h" #include "lldb/Core/StreamFile.h"
@ -42,6 +43,10 @@ using namespace lldb_private;
SBProcess::SBProcess () : SBProcess::SBProcess () :
m_opaque_sp() m_opaque_sp()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBProcess::SBProcess () ==> this = %p", this);
} }
@ -52,12 +57,22 @@ SBProcess::SBProcess () :
SBProcess::SBProcess (const SBProcess& rhs) : SBProcess::SBProcess (const SBProcess& rhs) :
m_opaque_sp (rhs.m_opaque_sp) m_opaque_sp (rhs.m_opaque_sp)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBProcess::SBProcess (const SBProcess &rhs) rhs.m_opaque_sp.get() = %p ==> this = %p",
rhs.m_opaque_sp.get(), this);
} }
SBProcess::SBProcess (const lldb::ProcessSP &process_sp) : SBProcess::SBProcess (const lldb::ProcessSP &process_sp) :
m_opaque_sp (process_sp) m_opaque_sp (process_sp)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBProcess::SBProcess (const lldb::ProcessSP &process_sp) process_sp.get() = %p ==> this = %p",
process_sp.get(), this);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -90,29 +105,62 @@ SBProcess::IsValid() const
uint32_t uint32_t
SBProcess::GetNumThreads () SBProcess::GetNumThreads ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBProcess::GetNumThreads ()");
uint32_t num_threads = 0;
if (m_opaque_sp) if (m_opaque_sp)
{ {
const bool can_update = true; const bool can_update = true;
return m_opaque_sp->GetThreadList().GetSize(can_update); num_threads = m_opaque_sp->GetThreadList().GetSize(can_update);
} }
return 0;
if (log)
log->Printf ("SBProcess::GetNumThreads ==> %d", num_threads);
return num_threads;
} }
SBThread SBThread
SBProcess::GetSelectedThread () const SBProcess::GetSelectedThread () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBProcess::GetSelectedThread ()");
SBThread sb_thread; SBThread sb_thread;
if (m_opaque_sp) if (m_opaque_sp)
sb_thread.SetThread (m_opaque_sp->GetThreadList().GetSelectedThread()); sb_thread.SetThread (m_opaque_sp->GetThreadList().GetSelectedThread());
if (log)
{
SBStream sstr;
sb_thread.GetDescription (sstr);
log->Printf ("SBProcess::GetSelectedThread ==> SBThread (this = %p, '%s')", &sb_thread, sstr.GetData());
}
return sb_thread; return sb_thread;
} }
SBTarget SBTarget
SBProcess::GetTarget() const SBProcess::GetTarget() const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBProcess::GetTarget ()");
SBTarget sb_target; SBTarget sb_target;
if (m_opaque_sp) if (m_opaque_sp)
sb_target = m_opaque_sp->GetTarget().GetSP(); sb_target = m_opaque_sp->GetTarget().GetSP();
if (log)
log->Printf ("SBProcess::GetTarget ==> SBTarget (this = %p, m_opaque_sp.get())", &sb_target,
sb_target.get());
return sb_target; return sb_target;
} }
@ -120,37 +168,64 @@ SBProcess::GetTarget() const
size_t size_t
SBProcess::PutSTDIN (const char *src, size_t src_len) SBProcess::PutSTDIN (const char *src, size_t src_len)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBProcess::PutSTDIN (%s, %d)", src, src_len);
size_t ret_val = 0;
if (m_opaque_sp != NULL) if (m_opaque_sp != NULL)
{ {
Error error; Error error;
return m_opaque_sp->PutSTDIN (src, src_len, error); ret_val = m_opaque_sp->PutSTDIN (src, src_len, error);
} }
else
return 0; if (log)
log->Printf ("SBProcess::PutSTDIN ==> %d", ret_val);
return ret_val;
} }
size_t size_t
SBProcess::GetSTDOUT (char *dst, size_t dst_len) const SBProcess::GetSTDOUT (char *dst, size_t dst_len) const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBProcess::GetSTDOUT (char *dst, size_t dst_Len)");
size_t ret_val = 0;
if (m_opaque_sp != NULL) if (m_opaque_sp != NULL)
{ {
Error error; Error error;
return m_opaque_sp->GetSTDOUT (dst, dst_len, error); ret_val = m_opaque_sp->GetSTDOUT (dst, dst_len, error);
} }
else
return 0; if (log)
log->Printf ("SBProcess::GetSTDOUT ==> %d", ret_val);
return ret_val;
} }
size_t size_t
SBProcess::GetSTDERR (char *dst, size_t dst_len) const SBProcess::GetSTDERR (char *dst, size_t dst_len) const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBProcess::GetSTDERR (char *dst, size_t dst_len)");
size_t ret_val = 0;
if (m_opaque_sp != NULL) if (m_opaque_sp != NULL)
{ {
Error error; Error error;
return m_opaque_sp->GetSTDERR (dst, dst_len, error); ret_val = m_opaque_sp->GetSTDERR (dst, dst_len, error);
} }
else
return 0; if (log)
log->Printf ("SBProcess::GetSTDERR ==> %d", ret_val);
return ret_val;
} }
void void
@ -202,27 +277,59 @@ SBProcess::SetSelectedThread (const SBThread &thread)
bool bool
SBProcess::SetSelectedThreadByID (uint32_t tid) SBProcess::SetSelectedThreadByID (uint32_t tid)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBProcess::SetSelectedThreadByID (%d)", tid);
bool ret_val = false;
if (m_opaque_sp != NULL) if (m_opaque_sp != NULL)
return m_opaque_sp->GetThreadList().SetSelectedThreadByID (tid); ret_val = m_opaque_sp->GetThreadList().SetSelectedThreadByID (tid);
return false;
if (log)
log->Printf ("SBProcess::SetSelectedThreadByID ==> %s", (ret_val ? "true" : "false"));
return ret_val;
} }
SBThread SBThread
SBProcess::GetThreadAtIndex (size_t index) SBProcess::GetThreadAtIndex (size_t index)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBProcess::GetThreadAtIndex (%d)");
SBThread thread; SBThread thread;
if (m_opaque_sp) if (m_opaque_sp)
thread.SetThread (m_opaque_sp->GetThreadList().GetThreadAtIndex(index)); thread.SetThread (m_opaque_sp->GetThreadList().GetThreadAtIndex(index));
if (log)
{
SBStream sstr;
thread.GetDescription (sstr);
log->Printf ("SBProcess::GetThreadAtIndex ==> SBThread (this = %p, '%s')", &thread, sstr.GetData());
}
return thread; return thread;
} }
StateType StateType
SBProcess::GetState () SBProcess::GetState ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBProcess::GetState ()");
StateType ret_val = eStateInvalid;
if (m_opaque_sp != NULL) if (m_opaque_sp != NULL)
return m_opaque_sp->GetState(); ret_val = m_opaque_sp->GetState();
else
return eStateInvalid; if (log)
log->Printf ("SBProcess::GetState ==> %s", lldb_private::StateAsCString (ret_val));
return ret_val;
} }
@ -247,19 +354,37 @@ SBProcess::GetExitDescription ()
lldb::pid_t lldb::pid_t
SBProcess::GetProcessID () SBProcess::GetProcessID ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBProcess::GetProcessID ()");
lldb::pid_t ret_val = LLDB_INVALID_PROCESS_ID;
if (m_opaque_sp) if (m_opaque_sp)
return m_opaque_sp->GetID(); ret_val = m_opaque_sp->GetID();
else
return LLDB_INVALID_PROCESS_ID; if (log)
log->Printf ("SBProcess::GetProcessID ==> %d", ret_val);
return ret_val;
} }
uint32_t uint32_t
SBProcess::GetAddressByteSize () const SBProcess::GetAddressByteSize () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBProcess::GetAddressByteSize()");
uint32_t size = 0;
if (m_opaque_sp) if (m_opaque_sp)
return m_opaque_sp->GetAddressByteSize(); size = m_opaque_sp->GetAddressByteSize();
else
return 0; if (log)
log->Printf ("SBProcess::GetAddressByteSize ==> %d", size);
return size;
} }
bool bool
@ -286,6 +411,11 @@ SBProcess::WaitUntilProcessHasStopped (SBCommandReturnObject &result)
SBError SBError
SBProcess::Continue () SBProcess::Continue ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBProcess::Continue ()");
SBError sb_error; SBError sb_error;
if (IsValid()) if (IsValid())
{ {
@ -300,6 +430,13 @@ SBProcess::Continue ()
else else
sb_error.SetErrorString ("SBProcess is invalid"); sb_error.SetErrorString ("SBProcess is invalid");
if (log)
{
SBStream sstr;
sb_error.GetDescription (sstr);
log->Printf ("SBProcess::Continue ==> SBError (this = %p, '%s')", &sb_error, sstr.GetData());
}
return sb_error; return sb_error;
} }
@ -320,22 +457,48 @@ SBProcess::Destroy ()
SBError SBError
SBProcess::Stop () SBProcess::Stop ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBProcess::Stop ()");
SBError sb_error; SBError sb_error;
if (IsValid()) if (IsValid())
sb_error.SetError (m_opaque_sp->Halt()); sb_error.SetError (m_opaque_sp->Halt());
else else
sb_error.SetErrorString ("SBProcess is invalid"); sb_error.SetErrorString ("SBProcess is invalid");
if (log)
{
SBStream sstr;
sb_error.GetDescription (sstr);
log->Printf ("SBProcess::Stop ==> SBError (this = %p, '%s')", &sb_error, sstr.GetData());
}
return sb_error; return sb_error;
} }
SBError SBError
SBProcess::Kill () SBProcess::Kill ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBProcess::Kill ()");
SBError sb_error; SBError sb_error;
if (m_opaque_sp) if (m_opaque_sp)
sb_error.SetError (m_opaque_sp->Destroy()); sb_error.SetError (m_opaque_sp->Destroy());
else else
sb_error.SetErrorString ("SBProcess is invalid"); sb_error.SetErrorString ("SBProcess is invalid");
if (log)
{
SBStream sstr;
sb_error.GetDescription (sstr);
log->Printf ("SBProcess::Kill ==> SBError (this = %p,'%s')", &sb_error, sstr.GetData());
}
return sb_error; return sb_error;
} }
@ -405,7 +568,21 @@ SBProcess::GetThreadByID (tid_t sb_thread_id)
StateType StateType
SBProcess::GetStateFromEvent (const SBEvent &event) SBProcess::GetStateFromEvent (const SBEvent &event)
{ {
return Process::ProcessEventData::GetStateFromEvent (event.get()); Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
SBStream sstr;
event.GetDescription (sstr);
log->Printf ("SBProcess::GetStateFromEvent (%s)", sstr.GetData());
}
StateType ret_val = Process::ProcessEventData::GetStateFromEvent (event.get());
if (log)
log->Printf ("SBProcess::GetStateFromEvent ==> %s", lldb_private::StateAsCString (ret_val));
return ret_val;
} }
bool bool
@ -425,7 +602,16 @@ SBProcess::GetProcessFromEvent (const SBEvent &event)
SBBroadcaster SBBroadcaster
SBProcess::GetBroadcaster () const SBProcess::GetBroadcaster () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBProcess::GetBroadcaster ()");
SBBroadcaster broadcaster(m_opaque_sp.get(), false); SBBroadcaster broadcaster(m_opaque_sp.get(), false);
if (log)
log->Printf ("SBProcess::GetBroadcaster ==> SBBroadcaster (this = %p, m_opaque = %p)", &broadcaster,
m_opaque_sp.get());
return broadcaster; return broadcaster;
} }
@ -438,6 +624,11 @@ SBProcess::operator->() const
size_t size_t
SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error) SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBProcess::ReadMemory (%p, %p, %d, sb_error)", addr, dst, dst_len);
size_t bytes_read = 0; size_t bytes_read = 0;
if (IsValid()) if (IsValid())
@ -451,6 +642,9 @@ SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error
sb_error.SetErrorString ("SBProcess is invalid"); sb_error.SetErrorString ("SBProcess is invalid");
} }
if (log)
log->Printf ("SBProcess::ReadMemory ==> %d", bytes_read);
return bytes_read; return bytes_read;
} }
@ -490,7 +684,7 @@ SBProcess::GetDescription (SBStream &description)
description.Printf ("SBProcess: pid = %d, state = %s, threads = %d%s%s", description.Printf ("SBProcess: pid = %d, state = %s, threads = %d%s%s",
m_opaque_sp->GetID(), m_opaque_sp->GetID(),
SBDebugger::StateAsCString (GetState()), lldb_private::StateAsCString (GetState()),
GetNumThreads(), GetNumThreads(),
exe_name ? ", executable = " : "", exe_name ? ", executable = " : "",
exe_name ? exe_name : ""); exe_name ? exe_name : "");

View File

@ -10,6 +10,7 @@
#include "lldb/API/SBSymbol.h" #include "lldb/API/SBSymbol.h"
#include "lldb/API/SBStream.h" #include "lldb/API/SBStream.h"
#include "lldb/Core/Disassembler.h" #include "lldb/Core/Disassembler.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h" #include "lldb/Core/Module.h"
#include "lldb/Symbol/Symbol.h" #include "lldb/Symbol/Symbol.h"
#include "lldb/Target/ExecutionContext.h" #include "lldb/Target/ExecutionContext.h"
@ -21,11 +22,24 @@ using namespace lldb_private;
SBSymbol::SBSymbol () : SBSymbol::SBSymbol () :
m_opaque_ptr (NULL) m_opaque_ptr (NULL)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBSymbol::SBSymbol () ==> this = %p", this);
} }
SBSymbol::SBSymbol (lldb_private::Symbol *lldb_object_ptr) : SBSymbol::SBSymbol (lldb_private::Symbol *lldb_object_ptr) :
m_opaque_ptr (lldb_object_ptr) m_opaque_ptr (lldb_object_ptr)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
{
SBStream sstr;
GetDescription (sstr);
log->Printf ("SBSymbol::SBSymbol (lldb_private::Symbol *lldb_object_ptr) lldb_object_ptr = %p ==> "
"this = %p (%s)", lldb_object_ptr, this, sstr.GetData());
}
} }
SBSymbol::~SBSymbol () SBSymbol::~SBSymbol ()
@ -42,8 +56,21 @@ SBSymbol::IsValid () const
const char * const char *
SBSymbol::GetName() const SBSymbol::GetName() const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBSymbol::GetName ()");
if (m_opaque_ptr) if (m_opaque_ptr)
{
if (log)
log->Printf ("SBSymbol::GetName ==> %s", m_opaque_ptr->GetMangled().GetName().AsCString());
return m_opaque_ptr->GetMangled().GetName().AsCString(); return m_opaque_ptr->GetMangled().GetName().AsCString();
}
if (log)
log->Printf ("SBSymbol::GetName ==> NULL");
return NULL; return NULL;
} }

View File

@ -10,6 +10,7 @@
#include "lldb/API/SBSymbolContext.h" #include "lldb/API/SBSymbolContext.h"
#include "lldb/API/SBStream.h" #include "lldb/API/SBStream.h"
#include "lldb/Symbol/SymbolContext.h" #include "lldb/Symbol/SymbolContext.h"
#include "lldb/Core/Log.h"
using namespace lldb; using namespace lldb;
using namespace lldb_private; using namespace lldb_private;
@ -19,18 +20,38 @@ using namespace lldb_private;
SBSymbolContext::SBSymbolContext () : SBSymbolContext::SBSymbolContext () :
m_opaque_ap () m_opaque_ap ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBSymbolContext::SBSymbolContext () ==> this = %p", this);
} }
SBSymbolContext::SBSymbolContext (const SymbolContext *sc_ptr) : SBSymbolContext::SBSymbolContext (const SymbolContext *sc_ptr) :
m_opaque_ap () m_opaque_ap ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (sc_ptr) if (sc_ptr)
m_opaque_ap.reset (new SymbolContext (*sc_ptr)); m_opaque_ap.reset (new SymbolContext (*sc_ptr));
if (log)
{
SBStream sstr;
GetDescription (sstr);
log->Printf ("SBSymbolContext::SBSymcolContext (const SymbolContext *sc_ptr) sc_ptr = %p ==> this = %p (%s)",
sc_ptr, this, sstr.GetData());
}
} }
SBSymbolContext::SBSymbolContext (const SBSymbolContext& rhs) : SBSymbolContext::SBSymbolContext (const SBSymbolContext& rhs) :
m_opaque_ap () m_opaque_ap ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBSymbolContext::SBSymcolContext (const SBSymbolContext &rhs) rhs.m_opaque_ap.get() = %p "
"==> this = %p", (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), this);
if (rhs.IsValid()) if (rhs.IsValid())
{ {
if (m_opaque_ap.get()) if (m_opaque_ap.get())
@ -38,6 +59,7 @@ SBSymbolContext::SBSymbolContext (const SBSymbolContext& rhs) :
else else
ref() = *rhs.m_opaque_ap; ref() = *rhs.m_opaque_ap;
} }
} }
SBSymbolContext::~SBSymbolContext () SBSymbolContext::~SBSymbolContext ()
@ -83,9 +105,22 @@ SBSymbolContext::IsValid () const
SBModule SBModule
SBSymbolContext::GetModule () SBSymbolContext::GetModule ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBSymbolContext::GetModule ()");
SBModule sb_module; SBModule sb_module;
if (m_opaque_ap.get()) if (m_opaque_ap.get())
sb_module.SetModule(m_opaque_ap->module_sp); sb_module.SetModule(m_opaque_ap->module_sp);
if (log)
{
SBStream sstr;
sb_module.GetDescription (sstr);
log->Printf ("SBSymbolContext::GetModule ==> SBModule (this = %p, '%s')", &sb_module, sstr.GetData());
}
return sb_module; return sb_module;
} }
@ -98,7 +133,18 @@ SBSymbolContext::GetCompileUnit ()
SBFunction SBFunction
SBSymbolContext::GetFunction () SBSymbolContext::GetFunction ()
{ {
return SBFunction (m_opaque_ap.get() ? m_opaque_ap->function : NULL); Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBSymbolContext::GetFunction ()");
SBFunction ret_function (m_opaque_ap.get() ? m_opaque_ap->function : NULL);
if (log)
log->Printf ("SBSymbolContext::GetFunction ==> SBFunction (this = %p, '%s')", &ret_function,
ret_function.GetName());
return ret_function;
} }
SBBlock SBBlock
@ -110,17 +156,44 @@ SBSymbolContext::GetBlock ()
SBLineEntry SBLineEntry
SBSymbolContext::GetLineEntry () SBSymbolContext::GetLineEntry ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBSymbolContext::GetLineEntry ()");
SBLineEntry sb_line_entry; SBLineEntry sb_line_entry;
if (m_opaque_ap.get()) if (m_opaque_ap.get())
sb_line_entry.SetLineEntry (m_opaque_ap->line_entry); sb_line_entry.SetLineEntry (m_opaque_ap->line_entry);
if (log)
{
SBStream sstr;
sb_line_entry.GetDescription (sstr);
log->Printf ("SBSymbolContext::GetLineEntry ==> SBLineEntry (this = %p, '%s')", &sb_line_entry,
sstr.GetData());
}
return sb_line_entry; return sb_line_entry;
} }
SBSymbol SBSymbol
SBSymbolContext::GetSymbol () SBSymbolContext::GetSymbol ()
{ {
return SBSymbol (m_opaque_ap.get() ? m_opaque_ap->symbol : NULL); Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBSymbolContext::GetSymbol ()");
SBSymbol ret_symbol (m_opaque_ap.get() ? m_opaque_ap->symbol : NULL);
if (log)
{
SBStream sstr;
ret_symbol.GetDescription (sstr);
log->Printf ("SBSymbolContext::GetSymbol ==> SBSymbol (this = %p, '%s')", &ret_symbol, sstr.GetData());
}
return ret_symbol;
} }
lldb_private::SymbolContext* lldb_private::SymbolContext*

View File

@ -26,6 +26,7 @@
#include "lldb/Core/Debugger.h" #include "lldb/Core/Debugger.h"
#include "lldb/Core/Disassembler.h" #include "lldb/Core/Disassembler.h"
#include "lldb/Core/FileSpec.h" #include "lldb/Core/FileSpec.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/RegularExpression.h" #include "lldb/Core/RegularExpression.h"
#include "lldb/Core/SearchFilter.h" #include "lldb/Core/SearchFilter.h"
#include "lldb/Core/STLUtils.h" #include "lldb/Core/STLUtils.h"
@ -51,25 +52,48 @@ using namespace lldb_private;
//---------------------------------------------------------------------- //----------------------------------------------------------------------
SBTarget::SBTarget () SBTarget::SBTarget ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBTarget::SBTarget () ==> this = %p", this);
} }
SBTarget::SBTarget (const SBTarget& rhs) : SBTarget::SBTarget (const SBTarget& rhs) :
m_opaque_sp (rhs.m_opaque_sp) m_opaque_sp (rhs.m_opaque_sp)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBTarget::SBTarget (const SBTarget &rhs) rhs.m_opaque_sp.get() = %p ==> this = %p",
rhs.m_opaque_sp.get(), this);
} }
SBTarget::SBTarget(const TargetSP& target_sp) : SBTarget::SBTarget(const TargetSP& target_sp) :
m_opaque_sp (target_sp) m_opaque_sp (target_sp)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBTarget::SBTarget (const TargetSP &target_sp) target_sp.get() = %p ==> this = %p",
target_sp.get(), this);
} }
const SBTarget& const SBTarget&
SBTarget::Assign (const SBTarget& rhs) SBTarget::Assign (const SBTarget& rhs)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBTarget::Assign (const SBTarget &rhs) rhs = %p", &rhs);
if (this != &rhs) if (this != &rhs)
{ {
m_opaque_sp = rhs.m_opaque_sp; m_opaque_sp = rhs.m_opaque_sp;
} }
if (log)
log->Printf ("SBTarget::Assign ==> SBTarget (this = %p, m_opaque_sp.get() = %p)", this, m_opaque_sp.get());
return *this; return *this;
} }
@ -90,9 +114,22 @@ SBTarget::IsValid () const
SBProcess SBProcess
SBTarget::GetProcess () SBTarget::GetProcess ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBTarget::GetProcess ()");
SBProcess sb_process; SBProcess sb_process;
if (m_opaque_sp) if (m_opaque_sp)
sb_process.SetProcess (m_opaque_sp->GetProcessSP()); sb_process.SetProcess (m_opaque_sp->GetProcessSP());
if (log)
{
SBStream sstr;
sb_process.GetDescription (sstr);
log->Printf ("SBTarget::GetProcess ==> SBProcess (this = %p, '%s')", &sb_process, sstr.GetData());
}
return sb_process; return sb_process;
} }
@ -110,11 +147,23 @@ SBTarget::GetDebugger () const
SBProcess SBProcess
SBTarget::CreateProcess () SBTarget::CreateProcess ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBTarget::CreateProcess ()");
SBProcess sb_process; SBProcess sb_process;
if (m_opaque_sp) if (m_opaque_sp)
sb_process.SetProcess (m_opaque_sp->CreateProcess (m_opaque_sp->GetDebugger().GetListener())); sb_process.SetProcess (m_opaque_sp->CreateProcess (m_opaque_sp->GetDebugger().GetListener()));
if (log)
{
SBStream sstr;
sb_process.GetDescription (sstr);
log->Printf ("SBTarget::CreateProcess ==> SBProcess (this = %p, '%s')", &sb_process, sstr.GetData());
}
return sb_process; return sb_process;
} }
@ -129,8 +178,45 @@ SBTarget::LaunchProcess
bool stop_at_entry bool stop_at_entry
) )
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
log->Printf ("SBTarget::LaunchProcess (char const **argv, char const **envp, const char *tty, "
"uint32_t launch_flags, bool stop_at_entry)");
if (!argv)
log->Printf ("argv: NULL");
else
{
for (int i = 0; argv[i]; ++i)
log->Printf (" %s", argv[i]);
}
if (!envp)
log->Printf ("envp: NULL");
else
{
for (int i = 0; envp[i]; ++i)
log->Printf (" %s", envp[i]);
}
log->Printf (" tty = %s, launch_flags = %d, stop_at_entry = %s", tty, launch_flags, (stop_at_entry ?
"true" :
"false"));
}
SBError sb_error; SBError sb_error;
return Launch (argv, envp, tty, launch_flags, stop_at_entry, sb_error); SBProcess sb_process = Launch (argv, envp, tty, launch_flags, stop_at_entry, sb_error);
if (log)
{
SBStream sstr;
sb_process.GetDescription (sstr);
log->Printf ("SBTarget::LaunchProcess ==> SBProcess (this = %p, '%s')", this, sstr.GetData());
}
return sb_process;
} }
SBProcess SBProcess
@ -144,6 +230,32 @@ SBTarget::Launch
SBError &error SBError &error
) )
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
{
log->Printf ("SBTarget::Launch (char const **argv, char const **envp, const char *tty, uint32_t launch_flag,"
"bool stop_at_entry, SBError error)");
if (!argv)
log->Printf ("argv: NULL");
else
{
for (int i = 0; argv[i]; ++i)
log->Printf (" %s", argv[i]);
}
if (!envp)
log->Printf ("envp: NULL");
else
{
for (int i = 0; envp[i]; ++i)
log->Printf (" %s", envp[i]);
}
log->Printf (" tty = %s, launch_flags = %d, stop_at_entry = %s, error (this = %p)", tty, launch_flags,
(stop_at_entry ? "true" : "false"), &error);
}
SBProcess sb_process; SBProcess sb_process;
if (m_opaque_sp) if (m_opaque_sp)
{ {
@ -193,6 +305,14 @@ SBTarget::Launch
{ {
error.SetErrorString ("SBTarget is invalid"); error.SetErrorString ("SBTarget is invalid");
} }
if (log)
{
SBStream sstr;
sb_process.GetDescription (sstr);
log->Printf ("SBTarget::Launch ==> SBProceess (this = %p, '%s')", &sb_process, sstr.GetData());
}
return sb_process; return sb_process;
} }
@ -279,6 +399,11 @@ SBTarget::AttachToProcessWithName
SBFileSpec SBFileSpec
SBTarget::GetExecutable () SBTarget::GetExecutable ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBTarget::GetExecutable ()");
SBFileSpec exe_file_spec; SBFileSpec exe_file_spec;
if (m_opaque_sp) if (m_opaque_sp)
{ {
@ -286,6 +411,20 @@ SBTarget::GetExecutable ()
if (exe_module_sp) if (exe_module_sp)
exe_file_spec.SetFileSpec (exe_module_sp->GetFileSpec()); exe_file_spec.SetFileSpec (exe_module_sp->GetFileSpec());
} }
if (log)
{
if (exe_file_spec.Exists())
{
SBStream sstr;
exe_file_spec.GetDescription (sstr);
log->Printf ("SBTarget::GetExecutable ==> SBFileSpec (this = %p, '%s')", &exe_file_spec, sstr.GetData());
}
else
log->Printf ("SBTarget::GetExecutable ==> SBFileSpec (this = %p, 'Unable to find valid file')",
&exe_file_spec);
}
return exe_file_spec; return exe_file_spec;
} }
@ -332,24 +471,59 @@ SBTarget::reset (const lldb::TargetSP& target_sp)
SBBreakpoint SBBreakpoint
SBTarget::BreakpointCreateByLocation (const char *file, uint32_t line) SBTarget::BreakpointCreateByLocation (const char *file, uint32_t line)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBTarget::BreakpointCreateByLocation (const char *file, uint32_t line) file = '%s', line = %d",
file, line);
SBBreakpoint sb_bp; SBBreakpoint sb_bp;
if (file != NULL && line != 0) if (file != NULL && line != 0)
sb_bp = BreakpointCreateByLocation (SBFileSpec (file), line); sb_bp = BreakpointCreateByLocation (SBFileSpec (file), line);
if (log)
{
SBStream sstr;
sb_bp.GetDescription (sstr);
log->Printf("SBTarget::BreakpointCreateByLocation ==> SBBreakpoint (this = %p, '%s')", &sb_bp, sstr.GetData());
}
return sb_bp; return sb_bp;
} }
SBBreakpoint SBBreakpoint
SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, uint32_t line) SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, uint32_t line)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBTarget::BreakpointCreateByLocation (const SBFileSpec &sb_file_spec, uint32_t line) "
"sb_file_spec (%p), line = %d)", &sb_file_spec, line);
SBBreakpoint sb_bp; SBBreakpoint sb_bp;
if (m_opaque_sp.get() && line != 0) if (m_opaque_sp.get() && line != 0)
*sb_bp = m_opaque_sp->CreateBreakpoint (NULL, *sb_file_spec, line, true, false); *sb_bp = m_opaque_sp->CreateBreakpoint (NULL, *sb_file_spec, line, true, false);
if (log)
{
SBStream sstr;
sb_bp.GetDescription (sstr);
log->Printf ("SBTarget::BreakpointCreateByLocation ==> SBBreakpoint (this = %p, '%s')", &sb_bp,
sstr.GetData());
}
return sb_bp; return sb_bp;
} }
SBBreakpoint SBBreakpoint
SBTarget::BreakpointCreateByName (const char *symbol_name, const char *module_name) SBTarget::BreakpointCreateByName (const char *symbol_name, const char *module_name)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBTarget::BreakpointCreateByName (const char *symbol_name, const char *module_name) "
"symbol_name = %s, module_name = %s)", symbol_name, module_name);
SBBreakpoint sb_bp; SBBreakpoint sb_bp;
if (m_opaque_sp.get() && symbol_name && symbol_name[0]) if (m_opaque_sp.get() && symbol_name && symbol_name[0])
{ {
@ -363,12 +537,26 @@ SBTarget::BreakpointCreateByName (const char *symbol_name, const char *module_na
*sb_bp = m_opaque_sp->CreateBreakpoint (NULL, symbol_name, eFunctionNameTypeFull | eFunctionNameTypeBase, false); *sb_bp = m_opaque_sp->CreateBreakpoint (NULL, symbol_name, eFunctionNameTypeFull | eFunctionNameTypeBase, false);
} }
} }
if (log)
{
SBStream sstr;
sb_bp.GetDescription (sstr);
log->Printf ("SBTarget::BreakpointCreateByName ==> SBBreakpoint (this = %p, '%s')", &sb_bp, sstr.GetData());
}
return sb_bp; return sb_bp;
} }
SBBreakpoint SBBreakpoint
SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name) SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name) "
"symbol_name_regex = %s, module_name = %s)", symbol_name_regex, module_name);
SBBreakpoint sb_bp; SBBreakpoint sb_bp;
if (m_opaque_sp.get() && symbol_name_regex && symbol_name_regex[0]) if (m_opaque_sp.get() && symbol_name_regex && symbol_name_regex[0])
{ {
@ -385,6 +573,14 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *mo
*sb_bp = m_opaque_sp->CreateBreakpoint (NULL, regexp, false); *sb_bp = m_opaque_sp->CreateBreakpoint (NULL, regexp, false);
} }
} }
if (log)
{
SBStream sstr;
sb_bp.GetDescription (sstr);
log->Printf ("SBTarget::BreakpointCreateByRegex ==> SBBreakpoint (this = %p, '%s')", &sb_bp, sstr.GetData());
}
return sb_bp; return sb_bp;
} }
@ -393,18 +589,44 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *mo
SBBreakpoint SBBreakpoint
SBTarget::BreakpointCreateByAddress (addr_t address) SBTarget::BreakpointCreateByAddress (addr_t address)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBTarget::BreakpointCreateByAddress (addr_t address) address = %p", address);
SBBreakpoint sb_bp; SBBreakpoint sb_bp;
if (m_opaque_sp.get()) if (m_opaque_sp.get())
*sb_bp = m_opaque_sp->CreateBreakpoint (address, false); *sb_bp = m_opaque_sp->CreateBreakpoint (address, false);
if (log)
{
SBStream sstr;
sb_bp.GetDescription (sstr);
log->Printf ("SBTarget::BreakpointCreateByAddress ==> SBBreakpoint (this = %p, '%s')", &sb_bp, sstr.GetData());
}
return sb_bp; return sb_bp;
} }
SBBreakpoint SBBreakpoint
SBTarget::FindBreakpointByID (break_id_t bp_id) SBTarget::FindBreakpointByID (break_id_t bp_id)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBTarget::FindBreakpointByID (break_id_t bp_id) bp_id = %d", bp_id);
SBBreakpoint sb_breakpoint; SBBreakpoint sb_breakpoint;
if (m_opaque_sp && bp_id != LLDB_INVALID_BREAK_ID) if (m_opaque_sp && bp_id != LLDB_INVALID_BREAK_ID)
*sb_breakpoint = m_opaque_sp->GetBreakpointByID (bp_id); *sb_breakpoint = m_opaque_sp->GetBreakpointByID (bp_id);
if (log)
{
SBStream sstr;
sb_breakpoint.GetDescription (sstr);
log->Printf ("SBTarget::FindBreakpointByID ==> SBBreakpoint (this = %p, '%s'", &bp_id, sstr.GetData());
}
return sb_breakpoint; return sb_breakpoint;
} }
@ -428,9 +650,24 @@ SBTarget::GetBreakpointAtIndex (uint32_t idx) const
bool bool
SBTarget::BreakpointDelete (break_id_t bp_id) SBTarget::BreakpointDelete (break_id_t bp_id)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBTarget::BreakpointDelete (break_id_t bp_id) bp_id = %d", bp_id);
bool result = false;
if (m_opaque_sp) if (m_opaque_sp)
return m_opaque_sp->RemoveBreakpointByID (bp_id); result = m_opaque_sp->RemoveBreakpointByID (bp_id);
return false;
if (log)
{
if (result)
log->Printf ("SBTarget::BreakpointDelete ==> true");
else
log->Printf ("SBTarget::BreakpointDelete ==> false");
}
return result;
} }
bool bool
@ -470,14 +707,29 @@ SBTarget::DeleteAllBreakpoints ()
uint32_t uint32_t
SBTarget::GetNumModules () const SBTarget::GetNumModules () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBTarget::GetNumModules ()");
uint32_t num = 0;
if (m_opaque_sp) if (m_opaque_sp)
return m_opaque_sp->GetImages().GetSize(); num = m_opaque_sp->GetImages().GetSize();
return 0;
if (log)
log->Printf ("SBTarget::GetNumModules ==> %d", num);
return num;
} }
void void
SBTarget::Clear () SBTarget::Clear ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBTarget::Clear ()");
m_opaque_sp.reset(); m_opaque_sp.reset();
} }
@ -494,9 +746,22 @@ SBTarget::FindModule (const SBFileSpec &sb_file_spec)
SBModule SBModule
SBTarget::GetModuleAtIndex (uint32_t idx) SBTarget::GetModuleAtIndex (uint32_t idx)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBTarget::GetModuleAtIndex (uint32_t idx) idx = %d", idx);
SBModule sb_module; SBModule sb_module;
if (m_opaque_sp) if (m_opaque_sp)
sb_module.SetModule(m_opaque_sp->GetImages().GetModuleAtIndex(idx)); sb_module.SetModule(m_opaque_sp->GetImages().GetModuleAtIndex(idx));
if (log)
{
SBStream sstr;
sb_module.GetDescription (sstr);
log->Printf ("SBTarget::GetModuleAtIndex ==> SBModule: this = %p, %s", &sb_module, sstr.GetData());
}
return sb_module; return sb_module;
} }
@ -504,7 +769,16 @@ SBTarget::GetModuleAtIndex (uint32_t idx)
SBBroadcaster SBBroadcaster
SBTarget::GetBroadcaster () const SBTarget::GetBroadcaster () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBTarget::GetBroadcaster ()");
SBBroadcaster broadcaster(m_opaque_sp.get(), false); SBBroadcaster broadcaster(m_opaque_sp.get(), false);
if (log)
log->Printf ("SBTarget::GetBroadcaster ==> SBBroadcaster (this = %p)", &broadcaster);
return broadcaster; return broadcaster;
} }
@ -634,12 +908,26 @@ SBTarget::Disassemble (const char *function_name, const char *module_name)
} }
bool bool
SBTarget::GetDescription (SBStream &description) SBTarget::GetDescription (SBStream &description, lldb::DescriptionLevel description_level)
{ {
if (m_opaque_sp) if (m_opaque_sp)
{ {
description.ref(); description.ref();
m_opaque_sp->Dump (description.get()); m_opaque_sp->Dump (description.get(), description_level);
}
else
description.Printf ("No value");
return true;
}
bool
SBTarget::GetDescription (SBStream &description, lldb::DescriptionLevel description_level) const
{
if (m_opaque_sp)
{
description.ref();
m_opaque_sp->Dump (description.get(), description_level);
} }
else else
description.Printf ("No value"); description.Printf ("No value");

View File

@ -41,6 +41,10 @@ using namespace lldb_private;
SBThread::SBThread () : SBThread::SBThread () :
m_opaque_sp () m_opaque_sp ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBThread::SBThread () ==> this = %p", this);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -49,10 +53,21 @@ SBThread::SBThread () :
SBThread::SBThread (const ThreadSP& lldb_object_sp) : SBThread::SBThread (const ThreadSP& lldb_object_sp) :
m_opaque_sp (lldb_object_sp) m_opaque_sp (lldb_object_sp)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBThread::SBThread (const ThreadSP &lldb_object_sp) lldb_object_sp.get() = %p ==> this = %p",
lldb_object_sp.get(), this);
} }
SBThread::SBThread (const SBThread &rhs) SBThread::SBThread (const SBThread &rhs)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBThread::SBThread (const SBThread &rhs) rhs.m_opaque_sp.get() = %p ==> this = %p",
rhs.m_opaque_sp.get(), this);
m_opaque_sp = rhs.m_opaque_sp; m_opaque_sp = rhs.m_opaque_sp;
} }
@ -79,18 +94,33 @@ SBThread::Clear ()
StopReason StopReason
SBThread::GetStopReason() SBThread::GetStopReason()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBThread::GetStopReason ()");
StopReason reason = eStopReasonInvalid;
if (m_opaque_sp) if (m_opaque_sp)
{ {
StopInfoSP stop_info_sp = m_opaque_sp->GetStopInfo (); StopInfoSP stop_info_sp = m_opaque_sp->GetStopInfo ();
if (stop_info_sp) if (stop_info_sp)
return stop_info_sp->GetStopReason(); reason = stop_info_sp->GetStopReason();
} }
return eStopReasonInvalid;
if (log)
log->Printf ("SBThread::GetStopReason ==> %s", Thread::StopReasonAsCString (reason));
return reason;
} }
size_t size_t
SBThread::GetStopDescription (char *dst, size_t dst_len) SBThread::GetStopDescription (char *dst, size_t dst_len)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBThread::GetStopDescription (char *dst, size_t dst_len)");
if (m_opaque_sp) if (m_opaque_sp)
{ {
StopInfoSP stop_info_sp = m_opaque_sp->GetStopInfo (); StopInfoSP stop_info_sp = m_opaque_sp->GetStopInfo ();
@ -99,6 +129,8 @@ SBThread::GetStopDescription (char *dst, size_t dst_len)
const char *stop_desc = stop_info_sp->GetDescription(); const char *stop_desc = stop_info_sp->GetDescription();
if (stop_desc) if (stop_desc)
{ {
if (log)
log->Printf ("SBThread::GetStopDescription ==> %s", stop_desc);
if (dst) if (dst)
return ::snprintf (dst, dst_len, "%s", stop_desc); return ::snprintf (dst, dst_len, "%s", stop_desc);
else else
@ -163,6 +195,9 @@ SBThread::GetStopDescription (char *dst, size_t dst_len)
if (stop_desc && stop_desc[0]) if (stop_desc && stop_desc[0])
{ {
if (log)
log->Printf ("SBThread::GetStopDescription ==> %s", stop_desc);
if (dst) if (dst)
return ::snprintf (dst, dst_len, "%s", stop_desc) + 1; // Include the NULL byte return ::snprintf (dst, dst_len, "%s", stop_desc) + 1; // Include the NULL byte
@ -189,10 +224,19 @@ SBThread::SetThread (const ThreadSP& lldb_object_sp)
lldb::tid_t lldb::tid_t
SBThread::GetThreadID () const SBThread::GetThreadID () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBThread::GetThreadID()");
lldb::tid_t id = LLDB_INVALID_THREAD_ID;
if (m_opaque_sp) if (m_opaque_sp)
return m_opaque_sp->GetID(); id = m_opaque_sp->GetID();
else
return LLDB_INVALID_THREAD_ID; if (log)
log->Printf ("SBThread::GetThreadID ==> %d", id);
return id;
} }
uint32_t uint32_t
@ -205,16 +249,42 @@ SBThread::GetIndexID () const
const char * const char *
SBThread::GetName () const SBThread::GetName () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBThread::GetName ()");
if (m_opaque_sp) if (m_opaque_sp)
{
if (log)
log->Printf ("SBThread::GetName ==> %s", m_opaque_sp->GetName());
return m_opaque_sp->GetName(); return m_opaque_sp->GetName();
}
if (log)
log->Printf ("SBThread::GetName ==> NULL");
return NULL; return NULL;
} }
const char * const char *
SBThread::GetQueueName () const SBThread::GetQueueName () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBThread::GetQueueName ()");
if (m_opaque_sp) if (m_opaque_sp)
{
if (log)
log->Printf ("SBThread::GetQueueName ==> %s", m_opaque_sp->GetQueueName());
return m_opaque_sp->GetQueueName(); return m_opaque_sp->GetQueueName();
}
if (log)
log->Printf ("SBThread::GetQueueName ==> NULL");
return NULL; return NULL;
} }
@ -222,6 +292,12 @@ SBThread::GetQueueName () const
void void
SBThread::StepOver (lldb::RunMode stop_other_threads) SBThread::StepOver (lldb::RunMode stop_other_threads)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBThread::StepOver (lldb::RunMode stop_other_threads) stop_other_threads = %s)",
Thread::RunModeAsCString (stop_other_threads));
if (m_opaque_sp) if (m_opaque_sp)
{ {
bool abort_other_plans = true; bool abort_other_plans = true;
@ -265,6 +341,12 @@ SBThread::StepOver (lldb::RunMode stop_other_threads)
void void
SBThread::StepInto (lldb::RunMode stop_other_threads) SBThread::StepInto (lldb::RunMode stop_other_threads)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBThread::StepInto (lldb::RunMode stop_other_threads) stop_other_threads =%s",
Thread::RunModeAsCString (stop_other_threads));
if (m_opaque_sp) if (m_opaque_sp)
{ {
bool abort_other_plans = true; bool abort_other_plans = true;
@ -306,6 +388,11 @@ SBThread::StepInto (lldb::RunMode stop_other_threads)
void void
SBThread::StepOut () SBThread::StepOut ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBThread::StepOut ()");
if (m_opaque_sp) if (m_opaque_sp)
{ {
bool abort_other_plans = true; bool abort_other_plans = true;
@ -329,6 +416,11 @@ SBThread::StepOut ()
void void
SBThread::StepInstruction (bool step_over) SBThread::StepInstruction (bool step_over)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBThread::StepInstruction (bool step_over) step_over = %s", (step_over ? "true" : "false"));
if (m_opaque_sp) if (m_opaque_sp)
{ {
m_opaque_sp->QueueThreadPlanForStepSingleInstruction (step_over, true, true); m_opaque_sp->QueueThreadPlanForStepSingleInstruction (step_over, true, true);
@ -348,6 +440,11 @@ SBThread::StepInstruction (bool step_over)
void void
SBThread::RunToAddress (lldb::addr_t addr) SBThread::RunToAddress (lldb::addr_t addr)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBThread::RunToAddress (lldb:;addr_t addr) addr = %p", addr);
if (m_opaque_sp) if (m_opaque_sp)
{ {
bool abort_other_plans = true; bool abort_other_plans = true;
@ -373,35 +470,77 @@ SBThread::RunToAddress (lldb::addr_t addr)
SBProcess SBProcess
SBThread::GetProcess () SBThread::GetProcess ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBThread::GetProcess ()");
SBProcess process; SBProcess process;
if (m_opaque_sp) if (m_opaque_sp)
{ {
// Have to go up to the target so we can get a shared pointer to our process... // Have to go up to the target so we can get a shared pointer to our process...
process.SetProcess(m_opaque_sp->GetProcess().GetTarget().GetProcessSP()); process.SetProcess(m_opaque_sp->GetProcess().GetTarget().GetProcessSP());
} }
if (log)
{
SBStream sstr;
process.GetDescription (sstr);
log->Printf ("SBThread::GetProcess ==> SBProcess (this = %p, '%s')", &process, sstr.GetData());
}
return process; return process;
} }
uint32_t uint32_t
SBThread::GetNumFrames () SBThread::GetNumFrames ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBThread::GetNumFrames ()");
uint32_t num_frames = 0;
if (m_opaque_sp) if (m_opaque_sp)
return m_opaque_sp->GetStackFrameCount(); num_frames = m_opaque_sp->GetStackFrameCount();
return 0;
if (log)
log->Printf ("SBThread::GetNumFrames ==> %d", num_frames);
return num_frames;
} }
SBFrame SBFrame
SBThread::GetFrameAtIndex (uint32_t idx) SBThread::GetFrameAtIndex (uint32_t idx)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBThread::GetFrameAtIndex (uint32_t idx) idx = %d", idx);
SBFrame sb_frame; SBFrame sb_frame;
if (m_opaque_sp) if (m_opaque_sp)
sb_frame.SetFrame (m_opaque_sp->GetStackFrameAtIndex (idx)); sb_frame.SetFrame (m_opaque_sp->GetStackFrameAtIndex (idx));
if (log)
{
SBStream sstr;
sb_frame.GetDescription (sstr);
log->Printf ("SBThread::GetFrameAtIndex ==> SBFrame (this = %p, '%s')", &sb_frame, sstr.GetData());
}
return sb_frame; return sb_frame;
} }
const lldb::SBThread & const lldb::SBThread &
SBThread::operator = (const lldb::SBThread &rhs) SBThread::operator = (const lldb::SBThread &rhs)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBThread::operator= (const lldb::SBThread &rhs) rhs.m_opaque_sp.get() = %p ==> this = %p",
rhs.m_opaque_sp.get(), this);
m_opaque_sp = rhs.m_opaque_sp; m_opaque_sp = rhs.m_opaque_sp;
return *this; return *this;
} }
@ -461,3 +600,17 @@ SBThread::GetDescription (SBStream &description)
return true; return true;
} }
bool
SBThread::GetDescription (SBStream &description) const
{
if (m_opaque_sp)
{
StreamString strm;
description.Printf("SBThread: tid = 0x%4.4x", m_opaque_sp->GetID());
}
else
description.Printf ("No value");
return true;
}

View File

@ -10,6 +10,7 @@
#include "lldb/API/SBType.h" #include "lldb/API/SBType.h"
#include "lldb/API/SBStream.h" #include "lldb/API/SBStream.h"
#include "lldb/Core/ConstString.h" #include "lldb/Core/ConstString.h"
#include "lldb/Core/Log.h"
#include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ClangASTType.h" #include "lldb/Symbol/ClangASTType.h"
@ -20,7 +21,17 @@ using namespace lldb_private;
bool bool
SBType::IsPointerType (void *opaque_type) SBType::IsPointerType (void *opaque_type)
{ {
return ClangASTContext::IsPointerType (opaque_type); Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBType::IsPointerType (%p)", opaque_type);
bool ret_value = ClangASTContext::IsPointerType (opaque_type);
if (log)
log->Printf ("SBType::IsPointerType ==> %s", (ret_value ? "true" : "false"));
return ret_value;
} }

View File

@ -11,6 +11,7 @@
#include "lldb/API/SBStream.h" #include "lldb/API/SBStream.h"
#include "lldb/Core/DataExtractor.h" #include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h" #include "lldb/Core/Module.h"
#include "lldb/Core/Stream.h" #include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h" #include "lldb/Core/StreamFile.h"
@ -36,11 +37,24 @@ using namespace lldb_private;
SBValue::SBValue () : SBValue::SBValue () :
m_opaque_sp () m_opaque_sp ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBValue::SBValue () ==> this = %p", this);
} }
SBValue::SBValue (const lldb::ValueObjectSP &value_sp) : SBValue::SBValue (const lldb::ValueObjectSP &value_sp) :
m_opaque_sp (value_sp) m_opaque_sp (value_sp)
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
{
SBStream sstr;
GetDescription (sstr);
log->Printf ("SBValue::SBValue (const lldb::ValueObjectSP &value_sp) value_sp.get() = %p ==> this = %p (%s)",
value_sp.get(), this, sstr.GetData());
}
} }
SBValue::~SBValue() SBValue::~SBValue()
@ -67,10 +81,23 @@ SBValue::GetError()
const char * const char *
SBValue::GetName() SBValue::GetName()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBValue::GetName ()");
if (IsValid()) if (IsValid())
{
if (log)
log->Printf ("SBValue::GetName ==> %s", m_opaque_sp->GetName().AsCString());
return m_opaque_sp->GetName().AsCString(); return m_opaque_sp->GetName().AsCString();
}
else else
{
if (log)
log->Printf ("SBValue::GetName ==> NULL");
return NULL; return NULL;
}
} }
const char * const char *

View File

@ -10,7 +10,10 @@
#include "lldb/API/SBValueList.h" #include "lldb/API/SBValueList.h"
#include "lldb/API/SBValue.h" #include "lldb/API/SBValue.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/ValueObjectList.h" #include "lldb/Core/ValueObjectList.h"
using namespace lldb; using namespace lldb;
@ -19,20 +22,60 @@ using namespace lldb_private;
SBValueList::SBValueList () : SBValueList::SBValueList () :
m_opaque_ap () m_opaque_ap ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBValueList::SBValueList () ==> this = %p", this);
} }
SBValueList::SBValueList (const SBValueList &rhs) : SBValueList::SBValueList (const SBValueList &rhs) :
m_opaque_ap () m_opaque_ap ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBValueList::SBValueList (const SBValueList &rhs) rhs.m_opaque_ap.get() = %p ==> this = %p",
(rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), this);
if (rhs.IsValid()) if (rhs.IsValid())
m_opaque_ap.reset (new lldb_private::ValueObjectList (*rhs)); m_opaque_ap.reset (new lldb_private::ValueObjectList (*rhs));
if (log)
{
uint32_t num_vars = GetSize();
for (uint32_t i = 0; i < num_vars; ++i)
{
SBValue value = GetValueAtIndex (i);
SBStream sstr;
value.GetDescription (sstr);
log->Printf (" %s", sstr.GetData());
}
}
} }
SBValueList::SBValueList (const lldb_private::ValueObjectList *lldb_object_ptr) : SBValueList::SBValueList (const lldb_private::ValueObjectList *lldb_object_ptr) :
m_opaque_ap () m_opaque_ap ()
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
if (log)
log->Printf ("SBValueList::SBValueList (const lldb_private::ValueObjectList *lldb_object_ptr) "
"lldb_object_ptr = %p ==> this = %p", lldb_object_ptr, this);
if (lldb_object_ptr) if (lldb_object_ptr)
m_opaque_ap.reset (new lldb_private::ValueObjectList (*lldb_object_ptr)); m_opaque_ap.reset (new lldb_private::ValueObjectList (*lldb_object_ptr));
if (log)
{
uint32_t num_vars = GetSize();
for (uint32_t i = 0; i < num_vars; ++i)
{
SBValue value = GetValueAtIndex (i);
SBStream sstr;
value.GetDescription (sstr);
log->Printf (" %s", sstr.GetData());
}
}
} }
SBValueList::~SBValueList () SBValueList::~SBValueList ()
@ -106,18 +149,40 @@ SBValueList::Append (lldb::ValueObjectSP& val_obj_sp)
SBValue SBValue
SBValueList::GetValueAtIndex (uint32_t idx) const SBValueList::GetValueAtIndex (uint32_t idx) const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBValueList::GetValueAtIndex (uint32_t idx) idx = %d", idx);
SBValue sb_value; SBValue sb_value;
if (m_opaque_ap.get()) if (m_opaque_ap.get())
*sb_value = m_opaque_ap->GetValueObjectAtIndex (idx); *sb_value = m_opaque_ap->GetValueObjectAtIndex (idx);
if (log)
{
SBStream sstr;
sb_value.GetDescription (sstr);
log->Printf ("SBValueList::GetValueAtIndex ==> SBValue (this = %p, '%s')", &sb_value, sstr.GetData());
}
return sb_value; return sb_value;
} }
uint32_t uint32_t
SBValueList::GetSize () const SBValueList::GetSize () const
{ {
Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
if (log)
log->Printf ("SBValueList::GetSize ()");
uint32_t size = 0; uint32_t size = 0;
if (m_opaque_ap.get()) if (m_opaque_ap.get())
size = m_opaque_ap->GetSize(); size = m_opaque_ap->GetSize();
if (log)
log->Printf ("SBValueList::GetSize ==> %d", size);
return size; return size;
} }

View File

@ -64,18 +64,27 @@ public:
"Enable logging for a single log channel.", "Enable logging for a single log channel.",
NULL) NULL)
{ {
CommandArgumentEntry arg;
CommandArgumentEntry arg1;
CommandArgumentEntry arg2;
CommandArgumentData channel_arg; CommandArgumentData channel_arg;
CommandArgumentData category_arg;
// Define the first (and only) variant of this arg. // Define the first (and only) variant of this arg.
channel_arg.arg_type = eArgTypeLogChannel; channel_arg.arg_type = eArgTypeLogChannel;
channel_arg.arg_repetition = eArgRepeatPlain; channel_arg.arg_repetition = eArgRepeatPlain;
// There is only one variant this argument could be; put it into the argument entry. // There is only one variant this argument could be; put it into the argument entry.
arg.push_back (channel_arg); arg1.push_back (channel_arg);
category_arg.arg_type = eArgTypeLogCategory;
category_arg.arg_repetition = eArgRepeatPlus;
arg2.push_back (category_arg);
// Push the data for the first argument into the m_arguments vector. // Push the data for the first argument into the m_arguments vector.
m_arguments.push_back (arg); m_arguments.push_back (arg1);
m_arguments.push_back (arg2);
} }
virtual virtual

View File

@ -364,3 +364,20 @@ Communication::SetConnection (Connection *connection)
Disconnect (NULL); Disconnect (NULL);
m_connection_ap.reset(connection); m_connection_ap.reset(connection);
} }
const char *
Communication::ConnectionStatusAsCString (lldb::ConnectionStatus status)
{
switch (status)
{
case eConnectionStatusSuccess: return "success";
case eConnectionStatusError: return "error";
case eConnectionStatusTimedOut: return "timed out";
case eConnectionStatusNoConnection: return "no connection";
case eConnectionStatusLostConnection: return "lost connection";
}
static char unknown_state_string[64];
snprintf(unknown_state_string, sizeof (unknown_state_string), "ConnectionStatus = %i", status);
return unknown_state_string;
}

View File

@ -338,3 +338,21 @@ InputReader::WaitOnReaderIsDone ()
{ {
m_reader_done.WaitForValueEqualTo (true); m_reader_done.WaitForValueEqualTo (true);
} }
const char *
InputReader::GranularityAsCString (lldb::InputReaderGranularity granularity)
{
switch (granularity)
{
case eInputReaderGranularityInvalid: return "invalid";
case eInputReaderGranularityByte: return "byte";
case eInputReaderGranularityWord: return "word";
case eInputReaderGranularityLine: return "line";
case eInputReaderGranularityAll: return "all";
}
static char unknown_state_string[64];
snprintf(unknown_state_string, sizeof (unknown_state_string), "InputReaderGranularity = %i", granularity);
return unknown_state_string;
}

View File

@ -375,6 +375,20 @@ Module::GetArchitecture () const
return m_arch; return m_arch;
} }
void
Module::GetDescription (Stream *s)
{
Mutex::Locker locker (m_mutex);
s->Printf("Module %s/%s%s%s%s\n",
m_file.GetDirectory().AsCString(),
m_file.GetFilename().AsCString(),
m_object_name ? "(" : "",
m_object_name ? m_object_name.GetCString() : "",
m_object_name ? ")" : "");
}
void void
Module::Dump(Stream *s) Module::Dump(Stream *s)
{ {

View File

@ -622,7 +622,8 @@ CommandObject::g_arguments_data[] =
{ eArgTypeFunctionName, "function-name", CommandCompletions::eNoCompletion, NULL, "The name of a function." }, { eArgTypeFunctionName, "function-name", CommandCompletions::eNoCompletion, NULL, "The name of a function." },
{ eArgTypeIndex, "index", CommandCompletions::eNoCompletion, NULL, "An index into a list." }, { eArgTypeIndex, "index", CommandCompletions::eNoCompletion, NULL, "An index into a list." },
{ eArgTypeLineNum, "linenum", CommandCompletions::eNoCompletion, NULL, "Line number in a source file." }, { eArgTypeLineNum, "linenum", CommandCompletions::eNoCompletion, NULL, "Line number in a source file." },
{ eArgTypeLogChannel, "log-channel", CommandCompletions::eNoCompletion, NULL, "Help text goes here." }, { eArgTypeLogCategory, "log-category", CommandCompletions::eNoCompletion, NULL, "The name of a category within a log channel, e.g. all (try \"log list\" to see a list of all channels and their categories." },
{ eArgTypeLogChannel, "log-channel", CommandCompletions::eNoCompletion, NULL, "The name of a log channel, e.g. process.gdb-remote (try \"log list\" to see a list of all channels and their categories)." },
{ eArgTypeMethod, "method", CommandCompletions::eNoCompletion, NULL, "A C++ method name." }, { eArgTypeMethod, "method", CommandCompletions::eNoCompletion, NULL, "A C++ method name." },
{ eArgTypeName, "name", CommandCompletions::eNoCompletion, NULL, "Help text goes here." }, { eArgTypeName, "name", CommandCompletions::eNoCompletion, NULL, "Help text goes here." },
{ eArgTypeNewPathPrefix, "new-path-prefix", CommandCompletions::eNoCompletion, NULL, "Help text goes here." }, { eArgTypeNewPathPrefix, "new-path-prefix", CommandCompletions::eNoCompletion, NULL, "Help text goes here." },

View File

@ -64,15 +64,27 @@ Target::~Target()
} }
void void
Target::Dump (Stream *s) Target::Dump (Stream *s, lldb::DescriptionLevel description_level)
{ {
// s->Printf("%.*p: ", (int)sizeof(void*) * 2, this); // s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
s->Indent(); if (description_level != lldb::eDescriptionLevelBrief)
s->PutCString("Target\n"); {
s->IndentMore(); s->Indent();
m_images.Dump(s); s->PutCString("Target\n");
m_breakpoint_list.Dump(s); s->IndentMore();
m_internal_breakpoint_list.Dump(s); m_images.Dump(s);
m_breakpoint_list.Dump(s);
m_internal_breakpoint_list.Dump(s);
}
else
{
char path[PATH_MAX];
int path_len = PATH_MAX;
if (GetExecutableModule()->GetFileSpec().GetPath (path, path_len))
s->Printf ("Target: %s\n", path);
else
s->Printf ("Target: <unknown>\n");
}
// if (m_process_sp.get()) // if (m_process_sp.get())
// m_process_sp->Dump(s); // m_process_sp->Dump(s);
s->IndentLess(); s->IndentLess();

View File

@ -1097,3 +1097,39 @@ Thread::GetStackFrameSPForStackFramePtr (StackFrame *stack_frame_ptr)
{ {
return GetStackFrameList().GetStackFrameSPForStackFramePtr (stack_frame_ptr); return GetStackFrameList().GetStackFrameSPForStackFramePtr (stack_frame_ptr);
} }
const char *
Thread::StopReasonAsCString (lldb::StopReason reason)
{
switch (reason)
{
case eStopReasonInvalid: return "invalid";
case eStopReasonNone: return "none";
case eStopReasonTrace: return "trace";
case eStopReasonBreakpoint: return "breakpoint";
case eStopReasonWatchpoint: return "watchpoint";
case eStopReasonSignal: return "signal";
case eStopReasonException: return "exception";
case eStopReasonPlanComplete: return "plan complete";
}
static char unknown_state_string[64];
snprintf(unknown_state_string, sizeof (unknown_state_string), "StopReason = %i", reason);
return unknown_state_string;
}
const char *
Thread::RunModeAsCString (lldb::RunMode mode)
{
switch (mode)
{
case eOnlyThisThread: return "only this thread";
case eAllThreads: return "all threads";
case eOnlyDuringStepping: return "only during stepping";
}
static char unknown_state_string[64];
snprintf(unknown_state_string, sizeof (unknown_state_string), "RunMode = %i", mode);
return unknown_state_string;
}

View File

@ -136,6 +136,7 @@ lldb_private::EnableLog (StreamSP &log_stream_sp, uint32_t log_options, Args &ar
const char *arg = args.GetArgumentAtIndex(i); const char *arg = args.GetArgumentAtIndex(i);
if (strcasecmp(arg, "all") == 0 ) flag_bits |= LIBLLDB_LOG_ALL; if (strcasecmp(arg, "all") == 0 ) flag_bits |= LIBLLDB_LOG_ALL;
else if (strcasecmp(arg, "api") == 0) flag_bits |= LIBLLDB_LOG_API;
else if (strcasestr(arg, "break") == arg) flag_bits |= LIBLLDB_LOG_BREAKPOINTS; else if (strcasestr(arg, "break") == arg) flag_bits |= LIBLLDB_LOG_BREAKPOINTS;
else if (strcasecmp(arg, "default") == 0 ) flag_bits |= LIBLLDB_LOG_DEFAULT; else if (strcasecmp(arg, "default") == 0 ) flag_bits |= LIBLLDB_LOG_DEFAULT;
else if (strcasestr(arg, "event") == arg) flag_bits |= LIBLLDB_LOG_EVENTS; else if (strcasestr(arg, "event") == arg) flag_bits |= LIBLLDB_LOG_EVENTS;
@ -177,6 +178,7 @@ lldb_private::ListLogCategories (Stream *strm)
{ {
strm->Printf("Logging categories for 'lldb':\n" strm->Printf("Logging categories for 'lldb':\n"
"\tall - turn on all available logging categories\n" "\tall - turn on all available logging categories\n"
"\tapi - enable logging of API calls and return values\n"
"\tdefault - enable the default set of logging categories for liblldb\n" "\tdefault - enable the default set of logging categories for liblldb\n"
"\tbreak - log breakpoints\n" "\tbreak - log breakpoints\n"
"\tevents - log broadcaster, listener and event queue activities\n" "\tevents - log broadcaster, listener and event queue activities\n"