summaryrefslogtreecommitdiffstats
path: root/lldb/source/API
diff options
context:
space:
mode:
authorCaroline Tice <ctice@apple.com>2010-10-26 03:11:13 +0000
committerCaroline Tice <ctice@apple.com>2010-10-26 03:11:13 +0000
commitceb6b1393d05e3f5a7a235fd34bcf5d74ecc1f8d (patch)
treed49e665f965c7acfc1d122c6c5e1b128a7ef9d5a /lldb/source/API
parente96b8d7ab66051f9fcbac5dfffd8dff7544a2909 (diff)
downloadbcm5719-llvm-ceb6b1393d05e3f5a7a235fd34bcf5d74ecc1f8d.tar.gz
bcm5719-llvm-ceb6b1393d05e3f5a7a235fd34bcf5d74ecc1f8d.zip
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
Diffstat (limited to 'lldb/source/API')
-rw-r--r--lldb/source/API/SBAddress.cpp44
-rw-r--r--lldb/source/API/SBBreakpoint.cpp85
-rw-r--r--lldb/source/API/SBBreakpointLocation.cpp41
-rw-r--r--lldb/source/API/SBBroadcaster.cpp20
-rw-r--r--lldb/source/API/SBCommandInterpreter.cpp29
-rw-r--r--lldb/source/API/SBCommandReturnObject.cpp31
-rw-r--r--lldb/source/API/SBCommunication.cpp83
-rw-r--r--lldb/source/API/SBCompileUnit.cpp53
-rw-r--r--lldb/source/API/SBDebugger.cpp104
-rw-r--r--lldb/source/API/SBError.cpp62
-rw-r--r--lldb/source/API/SBEvent.cpp64
-rw-r--r--lldb/source/API/SBFileSpec.cpp84
-rw-r--r--lldb/source/API/SBFrame.cpp132
-rw-r--r--lldb/source/API/SBFunction.cpp26
-rw-r--r--lldb/source/API/SBHostOS.cpp8
-rw-r--r--lldb/source/API/SBInputReader.cpp49
-rw-r--r--lldb/source/API/SBLineEntry.cpp59
-rw-r--r--lldb/source/API/SBListener.cpp48
-rw-r--r--lldb/source/API/SBModule.cpp43
-rw-r--r--lldb/source/API/SBProcess.cpp242
-rw-r--r--lldb/source/API/SBSymbol.cpp27
-rw-r--r--lldb/source/API/SBSymbolContext.cpp77
-rw-r--r--lldb/source/API/SBTarget.cpp302
-rw-r--r--lldb/source/API/SBThread.cpp167
-rw-r--r--lldb/source/API/SBType.cpp13
-rw-r--r--lldb/source/API/SBValue.cpp27
-rw-r--r--lldb/source/API/SBValueList.cpp65
27 files changed, 1894 insertions, 91 deletions
diff --git a/lldb/source/API/SBAddress.cpp b/lldb/source/API/SBAddress.cpp
index 7f21cf79fca..913847a893e 100644
--- a/lldb/source/API/SBAddress.cpp
+++ b/lldb/source/API/SBAddress.cpp
@@ -11,27 +11,49 @@
#include "lldb/API/SBProcess.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/Address.h"
+#include "lldb/Core/Log.h"
using namespace lldb;
+using namespace lldb_private;
SBAddress::SBAddress () :
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) :
m_opaque_ap ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
+
if (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) :
m_opaque_ap ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
+
if (rhs.IsValid())
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 ()
@@ -41,11 +63,17 @@ SBAddress::~SBAddress ()
const SBAddress &
SBAddress::operator = (const SBAddress &rhs)
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
if (this != &rhs)
{
if (rhs.IsValid())
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;
}
@@ -88,10 +116,24 @@ SBAddress::GetFileAddress () const
lldb::addr_t
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())
- 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
+ {
+ if (log)
+ log->Printf ("SBAddress::GetLoadAddress ==> LLDB_INVALID_ADDRESS");
return LLDB_INVALID_ADDRESS;
+ }
}
bool
diff --git a/lldb/source/API/SBBreakpoint.cpp b/lldb/source/API/SBBreakpoint.cpp
index 2ba7b9e96b9..a98ce0e0d1f 100644
--- a/lldb/source/API/SBBreakpoint.cpp
+++ b/lldb/source/API/SBBreakpoint.cpp
@@ -19,6 +19,7 @@
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Breakpoint/StoppointCallbackContext.h"
#include "lldb/Core/Address.h"
+#include "lldb/Core/Log.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Target/Process.h"
@@ -66,17 +67,39 @@ public:
SBBreakpoint::SBBreakpoint () :
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) :
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) :
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()
@@ -86,18 +109,42 @@ SBBreakpoint::~SBBreakpoint()
const SBBreakpoint &
SBBreakpoint::operator = (const SBBreakpoint& rhs)
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBBreakpoint::operator=");
+
if (this != &rhs)
{
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;
}
break_id_t
SBBreakpoint::GetID () const
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBBreakpoint::GetID");
+
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;
}
@@ -185,6 +232,11 @@ SBBreakpoint::GetLocationAtIndex (uint32_t index)
void
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)
m_opaque_sp->SetEnabled (enable);
}
@@ -201,6 +253,11 @@ SBBreakpoint::IsEnabled ()
void
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)
m_opaque_sp->SetIgnoreCount (count);
}
@@ -220,10 +277,24 @@ SBBreakpoint::GetCondition ()
uint32_t
SBBreakpoint::GetHitCount () const
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBBreakpoint::GetHitCount");
+
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();
+ }
else
+ {
+ if (log)
+ log->Printf ("SBBreakpoint::GetHitCount ==> 0");
return 0;
+ }
}
uint32_t
@@ -389,9 +460,21 @@ SBBreakpoint::PrivateBreakpointHitCallback
void
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())
{
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);
}
}
diff --git a/lldb/source/API/SBBreakpointLocation.cpp b/lldb/source/API/SBBreakpointLocation.cpp
index b284f6a2341..a7decda4895 100644
--- a/lldb/source/API/SBBreakpointLocation.cpp
+++ b/lldb/source/API/SBBreakpointLocation.cpp
@@ -21,6 +21,7 @@
#include "lldb/lldb-defines.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Target/ThreadSpec.h"
+#include "lldb/Core/Log.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Target/ThreadSpec.h"
@@ -29,16 +30,26 @@ using namespace lldb;
using namespace lldb_private;
-
-//class 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) :
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 ()
@@ -210,20 +221,10 @@ SBBreakpointLocation::SetLocation (const lldb::BreakpointLocationSP &break_loc_s
}
bool
-SBBreakpointLocation::GetDescription (const char *description_level, SBStream &description)
+SBBreakpointLocation::GetDescription (DescriptionLevel level, SBStream &description)
{
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();
m_opaque_sp->GetDescription (description.get(), level);
description.get()->EOL();
@@ -237,9 +238,21 @@ SBBreakpointLocation::GetDescription (const char *description_level, SBStream &d
SBBreakpoint
SBBreakpointLocation::GetBreakpoint ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBBreakpointLocation::GetBreakpoint ()");
+
SBBreakpoint sb_bp;
if (m_opaque_sp)
*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;
}
diff --git a/lldb/source/API/SBBroadcaster.cpp b/lldb/source/API/SBBroadcaster.cpp
index bbad8e2c5d3..8368135a2e0 100644
--- a/lldb/source/API/SBBroadcaster.cpp
+++ b/lldb/source/API/SBBroadcaster.cpp
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "lldb/Core/Broadcaster.h"
+#include "lldb/Core/Log.h"
#include "lldb/lldb-forward-rtti.h"
#include "lldb/API/SBBroadcaster.h"
@@ -22,6 +23,10 @@ SBBroadcaster::SBBroadcaster () :
m_opaque (NULL),
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_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) :
m_opaque (broadcaster),
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()
@@ -45,6 +60,11 @@ SBBroadcaster::~SBBroadcaster()
void
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)
return;
diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp
index d38b74107f8..38f41462b08 100644
--- a/lldb/source/API/SBCommandInterpreter.cpp
+++ b/lldb/source/API/SBCommandInterpreter.cpp
@@ -23,6 +23,7 @@
#include "lldb/API/SBProcess.h"
#include "lldb/API/SBTarget.h"
#include "lldb/API/SBListener.h"
+#include "lldb/API/SBStream.h"
#include "lldb/API/SBStringList.h"
using namespace lldb;
@@ -32,6 +33,11 @@ using namespace lldb_private;
SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter *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 ()
@@ -64,6 +70,12 @@ SBCommandInterpreter::AliasExists (const char *cmd)
lldb::ReturnStatus
SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnObject &result, bool add_to_history)
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBCommandInterpreter::HandleCommand ('%s', result, %s)", command_line,
+ (add_to_history ? "true" : "false"));
+
result.Clear();
if (m_opaque_ptr)
{
@@ -74,6 +86,14 @@ SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnOb
result->AppendError ("SBCommandInterpreter is not valid");
result->SetStatus (eReturnStatusFailed);
}
+
+ if (log)
+ {
+ SBStream sstr;
+ result.GetDescription (sstr);
+ log->Printf ("SBCommandInterpreter::HandleCommand ==> %s", sstr.GetData());
+ }
+
return result.GetStatus();
}
@@ -209,7 +229,16 @@ SBCommandInterpreter::SourceInitFileInCurrentWorkingDirectory (SBCommandReturnOb
SBBroadcaster
SBCommandInterpreter::GetBroadcaster ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBCommandInterpreter::GetBroadcaster ()");
+
SBBroadcaster broadcaster (m_opaque_ptr, false);
+
+ if (log)
+ log->Printf ("SBCommandInterpreter::GetBroadcaster ==> %p", m_opaque_ptr);
+
return broadcaster;
}
diff --git a/lldb/source/API/SBCommandReturnObject.cpp b/lldb/source/API/SBCommandReturnObject.cpp
index 35195f6da23..32600b882ce 100644
--- a/lldb/source/API/SBCommandReturnObject.cpp
+++ b/lldb/source/API/SBCommandReturnObject.cpp
@@ -10,6 +10,7 @@
#include "lldb/API/SBCommandReturnObject.h"
#include "lldb/API/SBStream.h"
+#include "lldb/Core/Log.h"
#include "lldb/Interpreter/CommandReturnObject.h"
using namespace lldb;
@@ -18,6 +19,10 @@ using namespace lldb_private;
SBCommandReturnObject::SBCommandReturnObject () :
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 ()
@@ -35,16 +40,42 @@ SBCommandReturnObject::IsValid() const
const char *
SBCommandReturnObject::GetOutput ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBCommandReturnObject::GetOutput ()");
+
if (m_opaque_ap.get())
+ {
+ if (log)
+ log->Printf ("SBCommandReturnObject::GetOutput ==> %s", m_opaque_ap->GetOutputStream().GetData());
return m_opaque_ap->GetOutputStream().GetData();
+ }
+
+ if (log)
+ log->Printf ("SBCommandReturnObject::GetOutput ==> NULL");
+
return NULL;
}
const char *
SBCommandReturnObject::GetError ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBCommandReturnObject::GetError ()");
+
if (m_opaque_ap.get())
+ {
+ if (log)
+ log->Printf ("SBCommandReturnObject::GetError ==> %s", m_opaque_ap->GetErrorStream().GetData());
return m_opaque_ap->GetErrorStream().GetData();
+ }
+
+ if (log)
+ log->Printf ("SBCommandReturnObject::GetError ==> NULL");
+
return NULL;
}
diff --git a/lldb/source/API/SBCommunication.cpp b/lldb/source/API/SBCommunication.cpp
index b1ae37b3315..b6ca30d54e3 100644
--- a/lldb/source/API/SBCommunication.cpp
+++ b/lldb/source/API/SBCommunication.cpp
@@ -11,6 +11,7 @@
#include "lldb/API/SBBroadcaster.h"
#include "lldb/Core/Communication.h"
#include "lldb/Core/ConnectionFileDescriptor.h"
+#include "lldb/Core/Log.h"
using namespace lldb;
using namespace lldb_private;
@@ -21,12 +22,21 @@ SBCommunication::SBCommunication() :
m_opaque (NULL),
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) :
m_opaque (new Communication (broadcaster_name)),
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()
@@ -76,19 +86,36 @@ SBCommunication::Connect (const char *url)
ConnectionStatus
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->HasConnection ())
{
if (m_opaque->IsConnected())
- m_opaque->Disconnect ();
+ m_opaque->Disconnect();
}
m_opaque->SetConnection (new ConnectionFileDescriptor (fd, owns_fd));
if (m_opaque->IsConnected())
+ {
+ if (log)
+ log->Printf ("SBCommunication::AdoptFileDescriptor ==> eConnectionStatusSuccess");
return eConnectionStatusSuccess;
+ }
else
+ {
+ if (log)
+ log->Printf ("SBCommunication::AdoptFileDescriptor ==> eConnectionStatusLostConnection");
return eConnectionStatusLostConnection;
+ }
}
+
+ if (log)
+ log->Printf ("SBCommunication::AdoptFileDescriptor ==> eConnectionStatusNoConnection");
+
return eConnectionStatusNoConnection;
}
@@ -96,9 +123,19 @@ SBCommunication::AdoptFileDesriptor (int fd, bool owns_fd)
ConnectionStatus
SBCommunication::Disconnect ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBCommunication::Disconnect ()");
+
+ ConnectionStatus status= eConnectionStatusNoConnection;
if (m_opaque)
- return m_opaque->Disconnect ();
- return eConnectionStatusNoConnection;
+ status = m_opaque->Disconnect ();
+
+ if (log)
+ log->Printf ("SBCommunication::Disconnect ==> %s", Communication::ConnectionStatusAsCString (status));
+
+ return status;
}
bool
@@ -131,18 +168,38 @@ SBCommunication::Write (const void *src, size_t src_len, ConnectionStatus &statu
bool
SBCommunication::ReadThreadStart ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBCommunication::ReadThreadStart ()");
+
+ bool success = false;
if (m_opaque)
- return m_opaque->StartReadThread ();
- return false;
+ success = m_opaque->StartReadThread ();
+
+ if (log)
+ log->Printf ("SBCommunication::ReadThreadStart ==> %s", (success ? "true" : "false"));
+
+ return success;
}
bool
SBCommunication::ReadThreadStop ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBCommunication::ReadThreadStop ()");
+
+ bool success = false;
if (m_opaque)
- return m_opaque->StopReadThread ();
- return false;
+ success = m_opaque->StopReadThread ();
+
+ if (log)
+ log->Printf ("SBCommunication::ReadThreadStop ==> %s", (success ? "true" : "false"));
+
+ return success;
}
bool
@@ -160,11 +217,23 @@ SBCommunication::SetReadThreadBytesReceivedCallback
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)
{
m_opaque->SetReadThreadBytesReceivedCallback (callback, callback_baton);
+ if (log)
+ log->Printf ("SBCommunication::SetReaDThreadBytesReceivedCallback ==> true");
return true;
}
+
+ if (log)
+ log->Printf ("SBCommunication::SetReaDThreadBytesReceivedCallback ==> false");
+
return false;
}
diff --git a/lldb/source/API/SBCompileUnit.cpp b/lldb/source/API/SBCompileUnit.cpp
index 42bbf82a7e5..d85e403a2ef 100644
--- a/lldb/source/API/SBCompileUnit.cpp
+++ b/lldb/source/API/SBCompileUnit.cpp
@@ -13,6 +13,7 @@
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/LineEntry.h"
#include "lldb/Symbol/LineTable.h"
+#include "lldb/Core/Log.h"
using namespace lldb;
using namespace lldb_private;
@@ -21,11 +22,24 @@ using namespace lldb_private;
SBCompileUnit::SBCompileUnit () :
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) :
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 ()
@@ -57,6 +71,11 @@ SBCompileUnit::GetNumLineEntries () const
SBLineEntry
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;
if (m_opaque_ptr)
{
@@ -68,12 +87,29 @@ SBCompileUnit::GetLineEntryAtIndex (uint32_t idx) const
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;
}
uint32_t
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)
{
FileSpec file_spec;
@@ -82,11 +118,20 @@ SBCompileUnit::FindLineEntryIndex (uint32_t start_idx, uint32_t line, SBFileSpec
else
file_spec = *m_opaque_ptr;
- return m_opaque_ptr->FindLineEntry (start_idx,
- line,
- inline_file_spec ? inline_file_spec->get() : NULL,
- NULL);
+
+ uint32_t ret_value = m_opaque_ptr->FindLineEntry (start_idx,
+ line,
+ 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;
}
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index 1c0f79d1ca0..32bf989d229 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -37,6 +37,11 @@ using namespace lldb_private;
void
SBDebugger::Initialize ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBDebugger::Initialize ()");
+
Debugger::Initialize();
}
@@ -49,14 +54,32 @@ SBDebugger::Terminate ()
void
SBDebugger::Clear ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBDebugger::Clear ()");
+
m_opaque_sp.reset();
}
SBDebugger
SBDebugger::Create()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBDebugger::Create ()");
+
SBDebugger debugger;
debugger.reset(Debugger::CreateInstance());
+
+ if (log)
+ {
+ SBStream sstr;
+ debugger.GetDescription (sstr);
+ log->Printf ("SBDebugger::Create ==> %s", sstr.GetData());
+ }
+
return debugger;
}
@@ -95,6 +118,11 @@ SBDebugger::SkipLLDBInitFiles (bool b)
void
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)
m_opaque_sp->SetInputFileHandle (fh, transfer_ownership);
}
@@ -102,6 +130,12 @@ SBDebugger::SetInputFileHandle (FILE *fh, bool transfer_ownership)
void
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)
m_opaque_sp->SetOutputFileHandle (fh, transfer_ownership);
}
@@ -109,6 +143,12 @@ SBDebugger::SetOutputFileHandle (FILE *fh, bool transfer_ownership)
void
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)
m_opaque_sp->SetErrorFileHandle (fh, transfer_ownership);
}
@@ -140,9 +180,15 @@ SBDebugger::GetErrorFileHandle ()
SBCommandInterpreter
SBDebugger::GetCommandInterpreter ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBDebugger::GetCommandInterpreter ()");
+
SBCommandInterpreter sb_interpreter;
if (m_opaque_sp)
sb_interpreter.reset (&m_opaque_sp->GetCommandInterpreter());
+
return sb_interpreter;
}
@@ -181,9 +227,15 @@ SBDebugger::HandleCommand (const char *command)
SBListener
SBDebugger::GetListener ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBDebugger::GetListener ()");
+
SBListener sb_listener;
if (m_opaque_sp)
sb_listener.reset(&m_opaque_sp->GetListener(), false);
+
return sb_listener;
}
@@ -357,6 +409,11 @@ SBDebugger::GetVersionString ()
const char *
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);
}
@@ -369,6 +426,12 @@ SBDebugger::StateIsRunningState (lldb::StateType state)
bool
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);
}
@@ -393,6 +456,11 @@ SBDebugger::CreateTargetWithFileAndTargetTriple (const char *filename,
SBTarget
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;
if (m_opaque_sp)
{
@@ -430,6 +498,14 @@ SBDebugger::CreateTargetWithFileAndArch (const char *filename, const char *archn
target.reset(target_sp);
}
}
+
+ if (log)
+ {
+ SBStream sstr;
+ target.GetDescription (sstr, lldb::eDescriptionLevelFull);
+ log->Printf ("SBDebugger::CreateTargetWithFileAndArch ==> %s", sstr.GetData());
+ }
+
return target;
}
@@ -522,15 +598,33 @@ SBDebugger::GetNumTargets ()
SBTarget
SBDebugger::GetSelectedTarget ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBDebugger::GetSelectedTarget ()");
+
SBTarget sb_target;
if (m_opaque_sp)
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;
}
void
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)
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
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())
{
InputReaderSP reader_sp(*reader);
@@ -640,6 +739,11 @@ SBDebugger::SetTerminalWidth (uint32_t term_width)
const char *
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)
return m_opaque_sp->GetPrompt ();
return 0;
diff --git a/lldb/source/API/SBError.cpp b/lldb/source/API/SBError.cpp
index 9553b6f4166..3e91ea07b9b 100644
--- a/lldb/source/API/SBError.cpp
+++ b/lldb/source/API/SBError.cpp
@@ -10,6 +10,7 @@
#include "lldb/API/SBError.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/Error.h"
+#include "lldb/Core/Log.h"
#include <stdarg.h>
@@ -20,13 +21,27 @@ using namespace lldb_private;
SBError::SBError () :
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) :
m_opaque_ap ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
+
if (rhs.IsValid())
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 &
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 (m_opaque_ap.get())
@@ -48,6 +73,10 @@ SBError::operator = (const SBError &rhs)
{
m_opaque_ap.reset();
}
+
+ if (log)
+ log->Printf ("SBError::operator= ==> this = %p", this);
+
return *this;
}
@@ -70,9 +99,19 @@ SBError::Clear ()
bool
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())
- return m_opaque_ap->Fail();
- return false;
+ ret_value = m_opaque_ap->Fail();
+
+ if (log)
+ log->Printf ("SBError::Fail ==> %s", (ret_value ? "true" : "false"));
+
+ return ret_value;
}
bool
@@ -198,3 +237,22 @@ SBError::GetDescription (SBStream &description)
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;
+}
diff --git a/lldb/source/API/SBEvent.cpp b/lldb/source/API/SBEvent.cpp
index d1123e7f858..70a4277a1b0 100644
--- a/lldb/source/API/SBEvent.cpp
+++ b/lldb/source/API/SBEvent.cpp
@@ -27,18 +27,34 @@ SBEvent::SBEvent () :
m_event_sp (),
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) :
m_event_sp (new Event (event_type, new EventDataBytes (cstr, cstr_len))),
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) :
m_event_sp (event_sp),
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()
@@ -57,10 +73,20 @@ SBEvent::GetDataFlavor ()
uint32_t
SBEvent::GetType () const
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBEvent::GetType ()");
+
const Event *lldb_event = get();
+ uint32_t event_type = 0;
if (lldb_event)
- return lldb_event->GetType();
- return 0;
+ event_type = lldb_event->GetType();
+
+ if (log)
+ log->Printf ("SBEvent::GetType ==> %d", event_type);
+
+ return event_type;
}
SBBroadcaster
@@ -88,10 +114,20 @@ SBEvent::BroadcasterMatchesPtr (const SBBroadcaster *broadcaster)
bool
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();
+ bool success = false;
if (lldb_event)
- return lldb_event->BroadcasterIs (broadcaster.get());
- return false;
+ success = lldb_event->BroadcasterIs (broadcaster.get());
+
+ if (log)
+ log->Printf ("SBEvent::BroadcasterMathesRef ==> %s", (success ? "true" : "false"));
+
+ return success;
}
void
@@ -147,6 +183,12 @@ SBEvent::IsValid() const
const char *
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()));
}
@@ -164,3 +206,17 @@ SBEvent::GetDescription (SBStream &description)
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;
+}
diff --git a/lldb/source/API/SBFileSpec.cpp b/lldb/source/API/SBFileSpec.cpp
index fb504f233f9..8f0b067ea0a 100644
--- a/lldb/source/API/SBFileSpec.cpp
+++ b/lldb/source/API/SBFileSpec.cpp
@@ -10,6 +10,7 @@
#include "lldb/API/SBFileSpec.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/FileSpec.h"
+#include "lldb/Core/Log.h"
using namespace lldb;
using namespace lldb_private;
@@ -19,11 +20,25 @@ using namespace lldb_private;
SBFileSpec::SBFileSpec () :
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) :
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())
m_opaque_ap.reset (new FileSpec (rhs.get()));
}
@@ -37,6 +52,12 @@ SBFileSpec::SBFileSpec (const char *path) :
SBFileSpec::SBFileSpec (const char *path, bool resolve) :
m_opaque_ap(new FileSpec (path, resolve))
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | 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 ()
@@ -63,9 +84,19 @@ SBFileSpec::IsValid() const
bool
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())
- return m_opaque_ap->Exists();
- return false;
+ result = m_opaque_ap->Exists();
+
+ if (log)
+ log->Printf ("SBFileSpec::Exists ==> %s", (result ? "true" : "false"));
+
+ return result;
}
bool
@@ -85,8 +116,21 @@ SBFileSpec::ResolvePath (const char *src_path, char *dst_path, size_t dst_len)
const char *
SBFileSpec::GetFilename() const
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBFileSpec::GetFilename ()");
+
if (m_opaque_ap.get())
+ {
+ if (log)
+ log->Printf ("SBFileSpec::GetFilename ==> %s", m_opaque_ap->GetFilename().AsCString());
return m_opaque_ap->GetFilename().AsCString();
+ }
+
+ if (log)
+ log->Printf ("SBFileSpec::GetFilename ==> NULL");
+
return NULL;
}
@@ -101,8 +145,22 @@ SBFileSpec::GetDirectory() const
uint32_t
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())
- 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)
*dst_path = '\0';
@@ -164,3 +222,23 @@ SBFileSpec::GetDescription (SBStream &description)
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;
+}
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp
index 9afac97b4ba..6b963606c85 100644
--- a/lldb/source/API/SBFrame.cpp
+++ b/lldb/source/API/SBFrame.cpp
@@ -16,6 +16,7 @@
#include "lldb/Core/Address.h"
#include "lldb/Core/ConstString.h"
+#include "lldb/Core/Log.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/ValueObjectRegister.h"
@@ -45,11 +46,24 @@ using namespace lldb_private;
SBFrame::SBFrame () :
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) :
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()
@@ -73,9 +87,18 @@ SBFrame::IsValid() const
SBSymbolContext
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;
if (m_opaque_sp)
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;
}
@@ -89,7 +112,16 @@ SBFrame::GetModule () const
SBCompileUnit
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);
+
+ if (log)
+ log->Printf ("SBFrame::GetCompileUnit ==> SBCompileUnit (this = %p", &sb_comp_unit);
+
return sb_comp_unit;
}
@@ -140,17 +172,37 @@ SBFrame::GetFrameID () const
lldb::addr_t
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)
- return m_opaque_sp->GetFrameCodeAddress().GetLoadAddress (&m_opaque_sp->GetThread().GetProcess().GetTarget());
- return LLDB_INVALID_ADDRESS;
+ addr = m_opaque_sp->GetFrameCodeAddress().GetLoadAddress (&m_opaque_sp->GetThread().GetProcess().GetTarget());
+
+ if (log)
+ log->Printf ("SBFrame::GetPC ==> %p", addr);
+
+ return addr;
}
bool
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)
- return m_opaque_sp->GetRegisterContext()->SetPC (new_pc);
- return false;
+ ret_val = m_opaque_sp->GetRegisterContext()->SetPC (new_pc);
+
+ if (log)
+ log->Printf ("SBFrame::SetPC ==> %s", (ret_val ? "true" : "false"));
+
+ return ret_val;
}
lldb::addr_t
@@ -165,9 +217,19 @@ SBFrame::GetSP () const
lldb::addr_t
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)
- return m_opaque_sp->GetRegisterContext()->GetFP();
- return LLDB_INVALID_ADDRESS;
+ addr = m_opaque_sp->GetRegisterContext()->GetFP();
+
+ if (log)
+ log->Printf ("SBFrame::GetFP ==> %p", addr);
+
+ return addr;
}
@@ -303,13 +365,30 @@ SBFrame::get() const
SBThread
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());
+
+ if (log)
+ log->Printf ("SBFrame::GetThread ==> SBThread (this = %p)", &sb_thread);
+
return sb_thread;
}
const char *
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)
return m_opaque_sp->Disassemble();
return NULL;
@@ -329,6 +408,18 @@ SBFrame::GetVariables (bool arguments,
bool statics,
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;
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;
}
lldb::SBValueList
SBFrame::GetRegisters ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBFrame::GetRegisters ()");
+
SBValueList value_list;
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;
}
diff --git a/lldb/source/API/SBFunction.cpp b/lldb/source/API/SBFunction.cpp
index de56a2e0ede..459ead23650 100644
--- a/lldb/source/API/SBFunction.cpp
+++ b/lldb/source/API/SBFunction.cpp
@@ -11,6 +11,7 @@
#include "lldb/API/SBProcess.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/Disassembler.h"
+#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/Function.h"
@@ -24,11 +25,24 @@ using namespace lldb_private;
SBFunction::SBFunction () :
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) :
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 ()
@@ -45,8 +59,20 @@ SBFunction::IsValid () const
const char *
SBFunction::GetName() const
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBFunction::GetName ()");
+
if (m_opaque_ptr)
+ {
+ if (log)
+ log->Printf ("SBFunction::GetName ==> %s", m_opaque_ptr->GetMangled().GetName().AsCString());
return m_opaque_ptr->GetMangled().GetName().AsCString();
+ }
+
+ if (log)
+ log->Printf ("SBFunction::GetName ==> NULL");
return NULL;
}
diff --git a/lldb/source/API/SBHostOS.cpp b/lldb/source/API/SBHostOS.cpp
index f0af9cd5069..b052c81ad7e 100644
--- a/lldb/source/API/SBHostOS.cpp
+++ b/lldb/source/API/SBHostOS.cpp
@@ -10,6 +10,7 @@
#include "lldb/API/SBHostOS.h"
#include "lldb/API/SBError.h"
#include "lldb/Core/FileSpec.h"
+#include "lldb/Core/Log.h"
#include "lldb/Host/Host.h"
using namespace lldb;
@@ -34,6 +35,13 @@ SBHostOS::ThreadCreate
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);
}
diff --git a/lldb/source/API/SBInputReader.cpp b/lldb/source/API/SBInputReader.cpp
index 4d1c7b91e8e..bb1d2dbaedf 100644
--- a/lldb/source/API/SBInputReader.cpp
+++ b/lldb/source/API/SBInputReader.cpp
@@ -13,8 +13,10 @@
#include "lldb/API/SBDebugger.h"
#include "lldb/API/SBError.h"
#include "lldb/API/SBInputReader.h"
+#include "lldb/API/SBStream.h"
#include "lldb/API/SBStringList.h"
#include "lldb/Core/InputReader.h"
+#include "lldb/Core/Log.h"
using namespace lldb;
@@ -26,16 +28,30 @@ SBInputReader::SBInputReader () :
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) :
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) :
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 ()
@@ -72,6 +88,17 @@ SBInputReader::Initialize
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;
m_opaque_sp.reset (new InputReader (debugger.ref()));
@@ -95,6 +122,13 @@ SBInputReader::Initialize
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;
}
@@ -162,10 +196,19 @@ SBInputReader::SetIsDone (bool value)
bool
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)
- return m_opaque_sp->IsActive();
- else
- return false;
+ ret_value = m_opaque_sp->IsActive();
+
+ if (log)
+ log->Printf ("SBInputReader::IsActive ==> %s", (ret_value ? "true" : "false"));
+
+ return ret_value;
}
InputReaderGranularity
diff --git a/lldb/source/API/SBLineEntry.cpp b/lldb/source/API/SBLineEntry.cpp
index 023afb94aad..8ade4c54f1f 100644
--- a/lldb/source/API/SBLineEntry.cpp
+++ b/lldb/source/API/SBLineEntry.cpp
@@ -10,22 +10,35 @@
#include "lldb/API/SBLineEntry.h"
#include "lldb/API/SBStream.h"
#include "lldb/Symbol/LineEntry.h"
+#include "lldb/Core/Log.h"
using namespace lldb;
+using namespace lldb_private;
SBLineEntry::SBLineEntry () :
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) :
m_opaque_ap ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
+
if (rhs.IsValid())
{
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) :
m_opaque_ap ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
+
if (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 &
@@ -66,9 +85,22 @@ SBLineEntry::~SBLineEntry ()
SBAddress
SBLineEntry::GetStartAddress () const
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBLineEntry::GetStartAddress ()");
+
SBAddress sb_address;
if (m_opaque_ap.get())
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;
}
@@ -94,18 +126,41 @@ SBLineEntry::IsValid () const
SBFileSpec
SBLineEntry::GetFileSpec () const
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBLineEntry::GetFileSpec ()");
+
SBFileSpec sb_file_spec;
if (m_opaque_ap.get() && 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;
}
uint32_t
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())
- return m_opaque_ap->line;
- return 0;
+ line = m_opaque_ap->line;
+
+ if (log)
+ log->Printf ("SBLineEntry::GetLine ==> %d", line);
+
+ return line;
}
diff --git a/lldb/source/API/SBListener.cpp b/lldb/source/API/SBListener.cpp
index 3e2f2122bdd..a9f66bca22b 100644
--- a/lldb/source/API/SBListener.cpp
+++ b/lldb/source/API/SBListener.cpp
@@ -8,12 +8,14 @@
//===----------------------------------------------------------------------===//
#include "lldb/Core/Listener.h"
+#include "lldb/Core/Log.h"
#include "lldb/lldb-forward-rtti.h"
#include "lldb/Host/TimeValue.h"
#include "lldb/API/SBListener.h"
#include "lldb/API/SBEvent.h"
#include "lldb/API/SBBroadcaster.h"
+#include "lldb/API/SBStream.h"
using namespace lldb;
using namespace lldb_private;
@@ -23,18 +25,32 @@ SBListener::SBListener () :
m_opaque_ptr (NULL),
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) :
m_opaque_ptr (new Listener (name)),
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) :
m_opaque_ptr (&listener),
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 ()
@@ -73,11 +89,24 @@ SBListener::Clear ()
uint32_t
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())
{
- 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
@@ -93,6 +122,15 @@ SBListener::StopListeningForEvents (const SBBroadcaster& broadcaster, uint32_t e
bool
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)
{
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))
{
event.reset (event_sp);
+ if (log)
+ log->Printf ("SBListener::WaitForEvent ==> true");
return true;
}
}
+
+ if (log)
+ log->Printf ("SBListener::WaitForEvent ==> false");
+
event.reset (NULL);
return false;
}
diff --git a/lldb/source/API/SBModule.cpp b/lldb/source/API/SBModule.cpp
index b59a6002925..35a88b61ce8 100644
--- a/lldb/source/API/SBModule.cpp
+++ b/lldb/source/API/SBModule.cpp
@@ -13,18 +13,30 @@
#include "lldb/API/SBFileSpec.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/Module.h"
+#include "lldb/Core/Log.h"
+#include "lldb/Core/STreamString.h"
using namespace lldb;
+using namespace lldb_private;
SBModule::SBModule () :
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) :
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 ()
@@ -40,17 +52,46 @@ SBModule::IsValid () const
SBFileSpec
SBModule::GetFileSpec () const
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBModule::GetFileSpec ()");
+
SBFileSpec file_spec;
if (m_opaque_sp)
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;
}
const uint8_t *
SBModule::GetUUIDBytes () const
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBModule::GetUUIDBytes ()");
+
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();
+ }
+
+ if (log)
+ log->Printf ("SBModule::GetUUIDBytes ==> NULL");
return NULL;
}
@@ -134,7 +175,7 @@ SBModule::GetDescription (SBStream &description)
if (m_opaque_sp)
{
description.ref();
- m_opaque_sp->Dump (description.get());
+ m_opaque_sp->GetDescription (description.get());
}
else
description.Printf ("No value");
diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp
index 53d6ad2d5c3..0b1e9cf3319 100644
--- a/lldb/source/API/SBProcess.cpp
+++ b/lldb/source/API/SBProcess.cpp
@@ -16,6 +16,7 @@
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Debugger.h"
+#include "lldb/Core/Log.h"
#include "lldb/Core/State.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
@@ -42,6 +43,10 @@ using namespace lldb_private;
SBProcess::SBProcess () :
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) :
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) :
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
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)
{
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
SBProcess::GetSelectedThread () const
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBProcess::GetSelectedThread ()");
+
SBThread sb_thread;
if (m_opaque_sp)
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;
}
SBTarget
SBProcess::GetTarget() const
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBProcess::GetTarget ()");
+
SBTarget sb_target;
if (m_opaque_sp)
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;
}
@@ -120,37 +168,64 @@ SBProcess::GetTarget() const
size_t
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)
{
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
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)
{
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
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)
{
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
@@ -202,27 +277,59 @@ SBProcess::SetSelectedThread (const SBThread &thread)
bool
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)
- return m_opaque_sp->GetThreadList().SetSelectedThreadByID (tid);
- return false;
+ ret_val = m_opaque_sp->GetThreadList().SetSelectedThreadByID (tid);
+
+ if (log)
+ log->Printf ("SBProcess::SetSelectedThreadByID ==> %s", (ret_val ? "true" : "false"));
+
+ return ret_val;
}
SBThread
SBProcess::GetThreadAtIndex (size_t index)
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBProcess::GetThreadAtIndex (%d)");
+
SBThread thread;
if (m_opaque_sp)
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;
}
StateType
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)
- return m_opaque_sp->GetState();
- else
- return eStateInvalid;
+ ret_val = m_opaque_sp->GetState();
+
+ if (log)
+ log->Printf ("SBProcess::GetState ==> %s", lldb_private::StateAsCString (ret_val));
+
+ return ret_val;
}
@@ -247,19 +354,37 @@ SBProcess::GetExitDescription ()
lldb::pid_t
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)
- return m_opaque_sp->GetID();
- else
- return LLDB_INVALID_PROCESS_ID;
+ ret_val = m_opaque_sp->GetID();
+
+ if (log)
+ log->Printf ("SBProcess::GetProcessID ==> %d", ret_val);
+
+ return ret_val;
}
uint32_t
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)
- return m_opaque_sp->GetAddressByteSize();
- else
- return 0;
+ size = m_opaque_sp->GetAddressByteSize();
+
+ if (log)
+ log->Printf ("SBProcess::GetAddressByteSize ==> %d", size);
+
+ return size;
}
bool
@@ -286,6 +411,11 @@ SBProcess::WaitUntilProcessHasStopped (SBCommandReturnObject &result)
SBError
SBProcess::Continue ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBProcess::Continue ()");
+
SBError sb_error;
if (IsValid())
{
@@ -300,6 +430,13 @@ SBProcess::Continue ()
else
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;
}
@@ -320,22 +457,48 @@ SBProcess::Destroy ()
SBError
SBProcess::Stop ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBProcess::Stop ()");
+
SBError sb_error;
if (IsValid())
sb_error.SetError (m_opaque_sp->Halt());
else
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;
}
SBError
SBProcess::Kill ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBProcess::Kill ()");
+
SBError sb_error;
if (m_opaque_sp)
sb_error.SetError (m_opaque_sp->Destroy());
else
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;
}
@@ -405,7 +568,21 @@ SBProcess::GetThreadByID (tid_t sb_thread_id)
StateType
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
@@ -425,7 +602,16 @@ SBProcess::GetProcessFromEvent (const SBEvent &event)
SBBroadcaster
SBProcess::GetBroadcaster () const
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBProcess::GetBroadcaster ()");
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;
}
@@ -438,6 +624,11 @@ SBProcess::operator->() const
size_t
SBProcess::ReadMemory (addr_t addr, void *dst, size_t dst_len, SBError &sb_error)
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBProcess::ReadMemory (%p, %p, %d, sb_error)", addr, dst, dst_len);
+
size_t bytes_read = 0;
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");
}
+ if (log)
+ log->Printf ("SBProcess::ReadMemory ==> %d", bytes_read);
+
return bytes_read;
}
@@ -490,7 +684,7 @@ SBProcess::GetDescription (SBStream &description)
description.Printf ("SBProcess: pid = %d, state = %s, threads = %d%s%s",
m_opaque_sp->GetID(),
- SBDebugger::StateAsCString (GetState()),
+ lldb_private::StateAsCString (GetState()),
GetNumThreads(),
exe_name ? ", executable = " : "",
exe_name ? exe_name : "");
diff --git a/lldb/source/API/SBSymbol.cpp b/lldb/source/API/SBSymbol.cpp
index eed84d5c608..a3dc21881f3 100644
--- a/lldb/source/API/SBSymbol.cpp
+++ b/lldb/source/API/SBSymbol.cpp
@@ -10,6 +10,7 @@
#include "lldb/API/SBSymbol.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/Disassembler.h"
+#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Target/ExecutionContext.h"
@@ -21,11 +22,24 @@ using namespace lldb_private;
SBSymbol::SBSymbol () :
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) :
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 ()
@@ -42,8 +56,21 @@ SBSymbol::IsValid () const
const char *
SBSymbol::GetName() const
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBSymbol::GetName ()");
+
if (m_opaque_ptr)
+ {
+ if (log)
+ log->Printf ("SBSymbol::GetName ==> %s", m_opaque_ptr->GetMangled().GetName().AsCString());
return m_opaque_ptr->GetMangled().GetName().AsCString();
+ }
+
+ if (log)
+ log->Printf ("SBSymbol::GetName ==> NULL");
+
return NULL;
}
diff --git a/lldb/source/API/SBSymbolContext.cpp b/lldb/source/API/SBSymbolContext.cpp
index ecd7d6677ff..8010af204a8 100644
--- a/lldb/source/API/SBSymbolContext.cpp
+++ b/lldb/source/API/SBSymbolContext.cpp
@@ -10,6 +10,7 @@
#include "lldb/API/SBSymbolContext.h"
#include "lldb/API/SBStream.h"
#include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Core/Log.h"
using namespace lldb;
using namespace lldb_private;
@@ -19,18 +20,38 @@ using namespace lldb_private;
SBSymbolContext::SBSymbolContext () :
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) :
m_opaque_ap ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
+
if (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) :
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 (m_opaque_ap.get())
@@ -38,6 +59,7 @@ SBSymbolContext::SBSymbolContext (const SBSymbolContext& rhs) :
else
ref() = *rhs.m_opaque_ap;
}
+
}
SBSymbolContext::~SBSymbolContext ()
@@ -83,9 +105,22 @@ SBSymbolContext::IsValid () const
SBModule
SBSymbolContext::GetModule ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBSymbolContext::GetModule ()");
+
SBModule sb_module;
if (m_opaque_ap.get())
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;
}
@@ -98,7 +133,18 @@ SBSymbolContext::GetCompileUnit ()
SBFunction
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
@@ -110,17 +156,44 @@ SBSymbolContext::GetBlock ()
SBLineEntry
SBSymbolContext::GetLineEntry ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBSymbolContext::GetLineEntry ()");
+
SBLineEntry sb_line_entry;
if (m_opaque_ap.get())
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;
}
SBSymbol
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*
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 9b78220567b..fbb1083f8ea 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -26,6 +26,7 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Disassembler.h"
#include "lldb/Core/FileSpec.h"
+#include "lldb/Core/Log.h"
#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/SearchFilter.h"
#include "lldb/Core/STLUtils.h"
@@ -51,25 +52,48 @@ using namespace lldb_private;
//----------------------------------------------------------------------
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) :
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) :
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&
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)
{
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;
}
@@ -90,9 +114,22 @@ SBTarget::IsValid () const
SBProcess
SBTarget::GetProcess ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBTarget::GetProcess ()");
+
SBProcess sb_process;
if (m_opaque_sp)
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;
}
@@ -110,11 +147,23 @@ SBTarget::GetDebugger () const
SBProcess
SBTarget::CreateProcess ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBTarget::CreateProcess ()");
+
SBProcess sb_process;
if (m_opaque_sp)
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;
}
@@ -129,8 +178,45 @@ SBTarget::LaunchProcess
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;
- 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
@@ -144,6 +230,32 @@ SBTarget::Launch
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;
if (m_opaque_sp)
{
@@ -193,6 +305,14 @@ SBTarget::Launch
{
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;
}
@@ -279,6 +399,11 @@ SBTarget::AttachToProcessWithName
SBFileSpec
SBTarget::GetExecutable ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBTarget::GetExecutable ()");
+
SBFileSpec exe_file_spec;
if (m_opaque_sp)
{
@@ -286,6 +411,20 @@ SBTarget::GetExecutable ()
if (exe_module_sp)
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;
}
@@ -332,24 +471,59 @@ SBTarget::reset (const lldb::TargetSP& target_sp)
SBBreakpoint
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;
if (file != NULL && line != 0)
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;
}
SBBreakpoint
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;
if (m_opaque_sp.get() && line != 0)
*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;
}
SBBreakpoint
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;
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);
}
}
+
+ if (log)
+ {
+ SBStream sstr;
+ sb_bp.GetDescription (sstr);
+ log->Printf ("SBTarget::BreakpointCreateByName ==> SBBreakpoint (this = %p, '%s')", &sb_bp, sstr.GetData());
+ }
+
return sb_bp;
}
SBBreakpoint
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;
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);
}
}
+
+ if (log)
+ {
+ SBStream sstr;
+ sb_bp.GetDescription (sstr);
+ log->Printf ("SBTarget::BreakpointCreateByRegex ==> SBBreakpoint (this = %p, '%s')", &sb_bp, sstr.GetData());
+ }
+
return sb_bp;
}
@@ -393,18 +589,44 @@ SBTarget::BreakpointCreateByRegex (const char *symbol_name_regex, const char *mo
SBBreakpoint
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;
if (m_opaque_sp.get())
*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;
}
SBBreakpoint
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;
if (m_opaque_sp && bp_id != LLDB_INVALID_BREAK_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;
}
@@ -428,9 +650,24 @@ SBTarget::GetBreakpointAtIndex (uint32_t idx) const
bool
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)
- return m_opaque_sp->RemoveBreakpointByID (bp_id);
- return false;
+ result = m_opaque_sp->RemoveBreakpointByID (bp_id);
+
+ if (log)
+ {
+ if (result)
+ log->Printf ("SBTarget::BreakpointDelete ==> true");
+ else
+ log->Printf ("SBTarget::BreakpointDelete ==> false");
+ }
+
+ return result;
}
bool
@@ -470,14 +707,29 @@ SBTarget::DeleteAllBreakpoints ()
uint32_t
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)
- return m_opaque_sp->GetImages().GetSize();
- return 0;
+ num = m_opaque_sp->GetImages().GetSize();
+
+ if (log)
+ log->Printf ("SBTarget::GetNumModules ==> %d", num);
+
+ return num;
}
void
SBTarget::Clear ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBTarget::Clear ()");
+
m_opaque_sp.reset();
}
@@ -494,9 +746,22 @@ SBTarget::FindModule (const SBFileSpec &sb_file_spec)
SBModule
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;
if (m_opaque_sp)
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;
}
@@ -504,7 +769,16 @@ SBTarget::GetModuleAtIndex (uint32_t idx)
SBBroadcaster
SBTarget::GetBroadcaster () const
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBTarget::GetBroadcaster ()");
+
SBBroadcaster broadcaster(m_opaque_sp.get(), false);
+
+ if (log)
+ log->Printf ("SBTarget::GetBroadcaster ==> SBBroadcaster (this = %p)", &broadcaster);
+
return broadcaster;
}
@@ -634,12 +908,26 @@ SBTarget::Disassemble (const char *function_name, const char *module_name)
}
bool
-SBTarget::GetDescription (SBStream &description)
+SBTarget::GetDescription (SBStream &description, lldb::DescriptionLevel description_level)
+{
+ if (m_opaque_sp)
+ {
+ description.ref();
+ 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());
+ m_opaque_sp->Dump (description.get(), description_level);
}
else
description.Printf ("No value");
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index ee6b6874678..a0a00c1ec61 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -41,6 +41,10 @@ using namespace lldb_private;
SBThread::SBThread () :
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) :
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)
{
+ 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;
}
@@ -79,18 +94,33 @@ SBThread::Clear ()
StopReason
SBThread::GetStopReason()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBThread::GetStopReason ()");
+
+ StopReason reason = eStopReasonInvalid;
if (m_opaque_sp)
{
StopInfoSP stop_info_sp = m_opaque_sp->GetStopInfo ();
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
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)
{
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();
if (stop_desc)
{
+ if (log)
+ log->Printf ("SBThread::GetStopDescription ==> %s", stop_desc);
if (dst)
return ::snprintf (dst, dst_len, "%s", stop_desc);
else
@@ -163,6 +195,9 @@ SBThread::GetStopDescription (char *dst, size_t dst_len)
if (stop_desc && stop_desc[0])
{
+ if (log)
+ log->Printf ("SBThread::GetStopDescription ==> %s", stop_desc);
+
if (dst)
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
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)
- return m_opaque_sp->GetID();
- else
- return LLDB_INVALID_THREAD_ID;
+ id = m_opaque_sp->GetID();
+
+ if (log)
+ log->Printf ("SBThread::GetThreadID ==> %d", id);
+
+ return id;
}
uint32_t
@@ -205,16 +249,42 @@ SBThread::GetIndexID () const
const char *
SBThread::GetName () const
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBThread::GetName ()");
+
if (m_opaque_sp)
+ {
+ if (log)
+ log->Printf ("SBThread::GetName ==> %s", m_opaque_sp->GetName());
return m_opaque_sp->GetName();
+ }
+
+ if (log)
+ log->Printf ("SBThread::GetName ==> NULL");
+
return NULL;
}
const char *
SBThread::GetQueueName () const
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBThread::GetQueueName ()");
+
if (m_opaque_sp)
+ {
+ if (log)
+ log->Printf ("SBThread::GetQueueName ==> %s", m_opaque_sp->GetQueueName());
return m_opaque_sp->GetQueueName();
+ }
+
+ if (log)
+ log->Printf ("SBThread::GetQueueName ==> NULL");
+
return NULL;
}
@@ -222,6 +292,12 @@ SBThread::GetQueueName () const
void
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)
{
bool abort_other_plans = true;
@@ -265,6 +341,12 @@ SBThread::StepOver (lldb::RunMode stop_other_threads)
void
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)
{
bool abort_other_plans = true;
@@ -306,6 +388,11 @@ SBThread::StepInto (lldb::RunMode stop_other_threads)
void
SBThread::StepOut ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBThread::StepOut ()");
+
if (m_opaque_sp)
{
bool abort_other_plans = true;
@@ -329,6 +416,11 @@ SBThread::StepOut ()
void
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)
{
m_opaque_sp->QueueThreadPlanForStepSingleInstruction (step_over, true, true);
@@ -348,6 +440,11 @@ SBThread::StepInstruction (bool step_over)
void
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)
{
bool abort_other_plans = true;
@@ -373,35 +470,77 @@ SBThread::RunToAddress (lldb::addr_t addr)
SBProcess
SBThread::GetProcess ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBThread::GetProcess ()");
+
SBProcess process;
if (m_opaque_sp)
{
// 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());
}
+
+ if (log)
+ {
+ SBStream sstr;
+ process.GetDescription (sstr);
+ log->Printf ("SBThread::GetProcess ==> SBProcess (this = %p, '%s')", &process, sstr.GetData());
+ }
+
return process;
}
uint32_t
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)
- return m_opaque_sp->GetStackFrameCount();
- return 0;
+ num_frames = m_opaque_sp->GetStackFrameCount();
+
+ if (log)
+ log->Printf ("SBThread::GetNumFrames ==> %d", num_frames);
+
+ return num_frames;
}
SBFrame
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;
if (m_opaque_sp)
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;
}
const lldb::SBThread &
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;
return *this;
}
@@ -461,3 +600,17 @@ SBThread::GetDescription (SBStream &description)
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;
+}
diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp
index 35c280dc21e..7a7805837c8 100644
--- a/lldb/source/API/SBType.cpp
+++ b/lldb/source/API/SBType.cpp
@@ -10,6 +10,7 @@
#include "lldb/API/SBType.h"
#include "lldb/API/SBStream.h"
#include "lldb/Core/ConstString.h"
+#include "lldb/Core/Log.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ClangASTType.h"
@@ -20,7 +21,17 @@ using namespace lldb_private;
bool
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;
}
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index 6fbd5fd1777..780a61f9578 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -11,6 +11,7 @@
#include "lldb/API/SBStream.h"
#include "lldb/Core/DataExtractor.h"
+#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
@@ -36,11 +37,24 @@ using namespace lldb_private;
SBValue::SBValue () :
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) :
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()
@@ -67,10 +81,23 @@ SBValue::GetError()
const char *
SBValue::GetName()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBValue::GetName ()");
+
if (IsValid())
+ {
+ if (log)
+ log->Printf ("SBValue::GetName ==> %s", m_opaque_sp->GetName().AsCString());
return m_opaque_sp->GetName().AsCString();
+ }
else
+ {
+ if (log)
+ log->Printf ("SBValue::GetName ==> NULL");
return NULL;
+ }
}
const char *
diff --git a/lldb/source/API/SBValueList.cpp b/lldb/source/API/SBValueList.cpp
index 4223fadb388..56c95196d89 100644
--- a/lldb/source/API/SBValueList.cpp
+++ b/lldb/source/API/SBValueList.cpp
@@ -10,7 +10,10 @@
#include "lldb/API/SBValueList.h"
#include "lldb/API/SBValue.h"
+#include "lldb/API/SBStream.h"
+
+#include "lldb/Core/Log.h"
#include "lldb/Core/ValueObjectList.h"
using namespace lldb;
@@ -19,20 +22,60 @@ using namespace lldb_private;
SBValueList::SBValueList () :
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) :
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())
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) :
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)
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 ()
@@ -106,18 +149,40 @@ SBValueList::Append (lldb::ValueObjectSP& val_obj_sp)
SBValue
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;
if (m_opaque_ap.get())
*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;
}
uint32_t
SBValueList::GetSize () const
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBValueList::GetSize ()");
+
uint32_t size = 0;
if (m_opaque_ap.get())
size = m_opaque_ap->GetSize();
+
+ if (log)
+ log->Printf ("SBValueList::GetSize ==> %d", size);
+
return size;
}
OpenPOWER on IntegriCloud