[Lldb-commits] [lldb] r117349 - in /lldb/trunk: include/lldb/ include/lldb/API/ include/lldb/Core/ include/lldb/Target/ scripts/Python/ source/ source/API/ source/Commands/ source/Core/ source/Interpreter/ source/Target/
Caroline Tice
ctice at apple.com
Mon Oct 25 20:11:13 PDT 2010
Author: ctice
Date: Mon Oct 25 22:11:13 2010
New Revision: 117349
URL: http://llvm.org/viewvc/llvm-project?rev=117349&view=rev
Log:
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).
Modified:
lldb/trunk/include/lldb/API/SBBreakpointLocation.h
lldb/trunk/include/lldb/API/SBError.h
lldb/trunk/include/lldb/API/SBEvent.h
lldb/trunk/include/lldb/API/SBFileSpec.h
lldb/trunk/include/lldb/API/SBTarget.h
lldb/trunk/include/lldb/API/SBThread.h
lldb/trunk/include/lldb/Core/Communication.h
lldb/trunk/include/lldb/Core/InputReader.h
lldb/trunk/include/lldb/Core/Module.h
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/include/lldb/Target/Thread.h
lldb/trunk/include/lldb/lldb-enumerations.h
lldb/trunk/include/lldb/lldb-private-log.h
lldb/trunk/scripts/Python/build-swig-Python.sh
lldb/trunk/scripts/Python/python-extensions.swig
lldb/trunk/source/API/SBAddress.cpp
lldb/trunk/source/API/SBBreakpoint.cpp
lldb/trunk/source/API/SBBreakpointLocation.cpp
lldb/trunk/source/API/SBBroadcaster.cpp
lldb/trunk/source/API/SBCommandInterpreter.cpp
lldb/trunk/source/API/SBCommandReturnObject.cpp
lldb/trunk/source/API/SBCommunication.cpp
lldb/trunk/source/API/SBCompileUnit.cpp
lldb/trunk/source/API/SBDebugger.cpp
lldb/trunk/source/API/SBError.cpp
lldb/trunk/source/API/SBEvent.cpp
lldb/trunk/source/API/SBFileSpec.cpp
lldb/trunk/source/API/SBFrame.cpp
lldb/trunk/source/API/SBFunction.cpp
lldb/trunk/source/API/SBHostOS.cpp
lldb/trunk/source/API/SBInputReader.cpp
lldb/trunk/source/API/SBLineEntry.cpp
lldb/trunk/source/API/SBListener.cpp
lldb/trunk/source/API/SBModule.cpp
lldb/trunk/source/API/SBProcess.cpp
lldb/trunk/source/API/SBSymbol.cpp
lldb/trunk/source/API/SBSymbolContext.cpp
lldb/trunk/source/API/SBTarget.cpp
lldb/trunk/source/API/SBThread.cpp
lldb/trunk/source/API/SBType.cpp
lldb/trunk/source/API/SBValue.cpp
lldb/trunk/source/API/SBValueList.cpp
lldb/trunk/source/Commands/CommandObjectLog.cpp
lldb/trunk/source/Core/Communication.cpp
lldb/trunk/source/Core/InputReader.cpp
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/Interpreter/CommandObject.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Target/Thread.cpp
lldb/trunk/source/lldb-log.cpp
Modified: lldb/trunk/include/lldb/API/SBBreakpointLocation.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBBreakpointLocation.h?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBBreakpointLocation.h (original)
+++ lldb/trunk/include/lldb/API/SBBreakpointLocation.h Mon Oct 25 22:11:13 2010
@@ -75,7 +75,7 @@
IsResolved ();
bool
- GetDescription (const char *description_level, lldb::SBStream &description);
+ GetDescription (DescriptionLevel level, lldb::SBStream &description);
SBBreakpoint
GetBreakpoint ();
Modified: lldb/trunk/include/lldb/API/SBError.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBError.h?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBError.h (original)
+++ lldb/trunk/include/lldb/API/SBError.h Mon Oct 25 22:11:13 2010
@@ -68,6 +68,9 @@
bool
GetDescription (lldb::SBStream &description);
+ bool
+ GetDescription (lldb::SBStream &description) const;
+
protected:
friend class SBArguments;
friend class SBDebugger;
Modified: lldb/trunk/include/lldb/API/SBEvent.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBEvent.h?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBEvent.h (original)
+++ lldb/trunk/include/lldb/API/SBEvent.h Mon Oct 25 22:11:13 2010
@@ -57,6 +57,9 @@
bool
GetDescription (lldb::SBStream &description);
+ bool
+ GetDescription (lldb::SBStream &description) const;
+
protected:
friend class SBListener;
friend class SBBroadcaster;
Modified: lldb/trunk/include/lldb/API/SBFileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBFileSpec.h?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBFileSpec.h (original)
+++ lldb/trunk/include/lldb/API/SBFileSpec.h Mon Oct 25 22:11:13 2010
@@ -56,6 +56,9 @@
bool
GetDescription (lldb::SBStream &description);
+ bool
+ GetDescription (lldb::SBStream &description) const;
+
private:
friend class SBBlock;
friend class SBCompileUnit;
Modified: lldb/trunk/include/lldb/API/SBTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBTarget.h (original)
+++ lldb/trunk/include/lldb/API/SBTarget.h Mon Oct 25 22:11:13 2010
@@ -162,7 +162,10 @@
#endif
bool
- GetDescription (lldb::SBStream &description);
+ GetDescription (lldb::SBStream &description, lldb::DescriptionLevel);
+
+ bool
+ GetDescription (lldb::SBStream &description, lldb::DescriptionLevel) const;
protected:
friend class SBAddress;
Modified: lldb/trunk/include/lldb/API/SBThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBThread.h?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBThread.h (original)
+++ lldb/trunk/include/lldb/API/SBThread.h Mon Oct 25 22:11:13 2010
@@ -91,6 +91,9 @@
bool
GetDescription (lldb::SBStream &description);
+ bool
+ GetDescription (lldb::SBStream &description) const;
+
protected:
friend class SBBreakpoint;
friend class SBBreakpointLocation;
Modified: lldb/trunk/include/lldb/Core/Communication.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Communication.h?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Communication.h (original)
+++ lldb/trunk/include/lldb/Core/Communication.h Mon Oct 25 22:11:13 2010
@@ -331,6 +331,9 @@
SetReadThreadBytesReceivedCallback (ReadThreadBytesReceived callback,
void *callback_baton);
+ static const char *
+ ConnectionStatusAsCString (lldb::ConnectionStatus status);
+
private:
//------------------------------------------------------------------
// For Communication only
Modified: lldb/trunk/include/lldb/Core/InputReader.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/InputReader.h?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/InputReader.h (original)
+++ lldb/trunk/include/lldb/Core/InputReader.h Mon Oct 25 22:11:13 2010
@@ -95,6 +95,9 @@
void
WaitOnReaderIsDone ();
+ static const char *
+ GranularityAsCString (lldb::InputReaderGranularity granularity);
+
protected:
friend class Debugger;
Modified: lldb/trunk/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Mon Oct 25 22:11:13 2010
@@ -98,6 +98,9 @@
virtual void
CalculateSymbolContext (SymbolContext* sc);
+ void
+ GetDescription (Stream *s);
+
//------------------------------------------------------------------
/// Dump a description of this object to a Stream.
///
Modified: lldb/trunk/include/lldb/Target/Target.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Target.h?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Target.h (original)
+++ lldb/trunk/include/lldb/Target/Target.h Mon Oct 25 22:11:13 2010
@@ -183,7 +183,7 @@
/// The stream to which to dump the object descripton.
//------------------------------------------------------------------
void
- Dump (Stream *s);
+ Dump (Stream *s, lldb::DescriptionLevel description_level);
const lldb::ProcessSP &
CreateProcess (Listener &listener, const char *plugin_name = NULL);
Modified: lldb/trunk/include/lldb/Target/Thread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Thread.h (original)
+++ lldb/trunk/include/lldb/Target/Thread.h Mon Oct 25 22:11:13 2010
@@ -241,6 +241,12 @@
bool
ThreadStoppedForAReason ();
+ static const char *
+ RunModeAsCString (lldb::RunMode mode);
+
+ static const char *
+ StopReasonAsCString (lldb::StopReason reason);
+
virtual const char *
GetInfo () = 0;
Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Mon Oct 25 22:11:13 2010
@@ -533,6 +533,7 @@
eArgTypeFunctionName,
eArgTypeIndex,
eArgTypeLineNum,
+ eArgTypeLogCategory,
eArgTypeLogChannel,
eArgTypeMethod,
eArgTypeName,
Modified: lldb/trunk/include/lldb/lldb-private-log.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-log.h?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-private-log.h (original)
+++ lldb/trunk/include/lldb/lldb-private-log.h Mon Oct 25 22:11:13 2010
@@ -35,6 +35,7 @@
#define LIBLLDB_LOG_CONNECTION (1u << 13)
#define LIBLLDB_LOG_HOST (1u << 14)
#define LIBLLDB_LOG_UNWIND (1u << 15)
+#define LIBLLDB_LOG_API (1u << 16)
#define LIBLLDB_LOG_ALL (UINT32_MAX)
#define LIBLLDB_LOG_DEFAULT (LIBLLDB_LOG_PROCESS |\
LIBLLDB_LOG_THREAD |\
Modified: lldb/trunk/scripts/Python/build-swig-Python.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/build-swig-Python.sh?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/build-swig-Python.sh (original)
+++ lldb/trunk/scripts/Python/build-swig-Python.sh Mon Oct 25 22:11:13 2010
@@ -19,6 +19,7 @@
swig_output_file=${SRC_ROOT}/source/LLDBWrapPython.cpp
swig_input_file=${SRC_ROOT}/scripts/lldb.swig
+swig_input_file2=${SRC_ROOT}/scripts/Python/python-extensions.swig
if [ -n "$debug_flag" -a "$debug_flag" == "-debug" ]
@@ -119,6 +120,19 @@
fi
fi
+if [ $NeedToUpdate == 0 ]
+then
+ if [ ${swig_input_file2} -nt ${swig_output_file} ]
+ then
+ NeedToUpdate=1
+ if [ $Debug == 1 ]
+ then
+ echo "${swig_input_file2} is newer than ${swig_output_file}"
+ echo "swig file will need to be re-built."
+ fi
+ fi
+fi
+
os_name=`uname -s`
python_version=`/usr/bin/python --version 2>&1 | sed -e 's,Python ,,' -e 's,[.][0-9],,2' -e 's,[a-z][a-z][0-9],,'`
@@ -147,6 +161,10 @@
exit 0
else
echo "SWIG needs to be re-run."
+ if [ -f ${swig_output_file} ]
+ then
+ rm ${swig_output_file}
+ fi
fi
Modified: lldb/trunk/scripts/Python/python-extensions.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-extensions.swig?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/python-extensions.swig (original)
+++ lldb/trunk/scripts/Python/python-extensions.swig Mon Oct 25 22:11:13 2010
@@ -23,7 +23,7 @@
%extend lldb::SBBreakpointLocation {
PyObject *lldb::SBBreakpointLocation::__repr__ (){
lldb::SBStream description;
- $self->GetDescription ("full", description);
+ $self->GetDescription (lldb::eDescriptionLevelFull, description);
return PyString_FromString (description.GetData());
}
}
@@ -128,7 +128,7 @@
%extend lldb::SBTarget {
PyObject *lldb::SBTarget::__repr__ (){
lldb::SBStream description;
- $self->GetDescription (description);
+ $self->GetDescription (description, lldb::eDescriptionLevelBrief);
return PyString_FromString (description.GetData());
}
}
Modified: lldb/trunk/source/API/SBAddress.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBAddress.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBAddress.cpp (original)
+++ lldb/trunk/source/API/SBAddress.cpp Mon Oct 25 22:11:13 2010
@@ -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 @@
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 @@
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
Modified: lldb/trunk/source/API/SBBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpoint.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBreakpoint.cpp (original)
+++ lldb/trunk/source/API/SBBreakpoint.cpp Mon Oct 25 22:11:13 2010
@@ -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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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);
}
}
Modified: lldb/trunk/source/API/SBBreakpointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBreakpointLocation.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBreakpointLocation.cpp (original)
+++ lldb/trunk/source/API/SBBreakpointLocation.cpp Mon Oct 25 22:11:13 2010
@@ -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_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 @@
}
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 @@
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;
}
Modified: lldb/trunk/source/API/SBBroadcaster.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBBroadcaster.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBBroadcaster.cpp (original)
+++ lldb/trunk/source/API/SBBroadcaster.cpp Mon Oct 25 22:11:13 2010
@@ -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 @@
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 @@
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 @@
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;
Modified: lldb/trunk/source/API/SBCommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandInterpreter.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommandInterpreter.cpp (original)
+++ lldb/trunk/source/API/SBCommandInterpreter.cpp Mon Oct 25 22:11:13 2010
@@ -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 @@
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 @@
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 @@
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 @@
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;
}
Modified: lldb/trunk/source/API/SBCommandReturnObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommandReturnObject.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommandReturnObject.cpp (original)
+++ lldb/trunk/source/API/SBCommandReturnObject.cpp Mon Oct 25 22:11:13 2010
@@ -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 @@
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 @@
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;
}
Modified: lldb/trunk/source/API/SBCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCommunication.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCommunication.cpp (original)
+++ lldb/trunk/source/API/SBCommunication.cpp Mon Oct 25 22:11:13 2010
@@ -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 @@
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 @@
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 @@
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 @@
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 @@
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;
}
Modified: lldb/trunk/source/API/SBCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCompileUnit.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCompileUnit.cpp (original)
+++ lldb/trunk/source/API/SBCompileUnit.cpp Mon Oct 25 22:11:13 2010
@@ -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 @@
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 @@
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 @@
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 @@
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;
}
Modified: lldb/trunk/source/API/SBDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBDebugger.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBDebugger.cpp (original)
+++ lldb/trunk/source/API/SBDebugger.cpp Mon Oct 25 22:11:13 2010
@@ -37,6 +37,11 @@
void
SBDebugger::Initialize ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBDebugger::Initialize ()");
+
Debugger::Initialize();
}
@@ -49,14 +54,32 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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;
Modified: lldb/trunk/source/API/SBError.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBError.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBError.cpp (original)
+++ lldb/trunk/source/API/SBError.cpp Mon Oct 25 22:11:13 2010
@@ -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 @@
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 @@
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 @@
{
m_opaque_ap.reset();
}
+
+ if (log)
+ log->Printf ("SBError::operator= ==> this = %p", this);
+
return *this;
}
@@ -70,9 +99,19 @@
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 @@
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;
+}
Modified: lldb/trunk/source/API/SBEvent.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBEvent.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBEvent.cpp (original)
+++ lldb/trunk/source/API/SBEvent.cpp Mon Oct 25 22:11:13 2010
@@ -27,18 +27,34 @@
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 @@
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 @@
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 @@
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 @@
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;
+}
Modified: lldb/trunk/source/API/SBFileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFileSpec.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFileSpec.cpp (original)
+++ lldb/trunk/source/API/SBFileSpec.cpp Mon Oct 25 22:11:13 2010
@@ -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 @@
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, 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 @@
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 @@
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 @@
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 @@
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;
+}
Modified: lldb/trunk/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Mon Oct 25 22:11:13 2010
@@ -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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
}
}
+
+ 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 @@
}
}
}
+
+ 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;
}
Modified: lldb/trunk/source/API/SBFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFunction.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFunction.cpp (original)
+++ lldb/trunk/source/API/SBFunction.cpp Mon Oct 25 22:11:13 2010
@@ -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 @@
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 @@
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;
}
Modified: lldb/trunk/source/API/SBHostOS.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBHostOS.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBHostOS.cpp (original)
+++ lldb/trunk/source/API/SBHostOS.cpp Mon Oct 25 22:11:13 2010
@@ -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 @@
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);
}
Modified: lldb/trunk/source/API/SBInputReader.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBInputReader.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBInputReader.cpp (original)
+++ lldb/trunk/source/API/SBInputReader.cpp Mon Oct 25 22:11:13 2010
@@ -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 @@
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 @@
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 @@
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 @@
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
Modified: lldb/trunk/source/API/SBLineEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBLineEntry.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBLineEntry.cpp (original)
+++ lldb/trunk/source/API/SBLineEntry.cpp Mon Oct 25 22:11:13 2010
@@ -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 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 @@
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 @@
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;
}
Modified: lldb/trunk/source/API/SBListener.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBListener.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBListener.cpp (original)
+++ lldb/trunk/source/API/SBListener.cpp Mon Oct 25 22:11:13 2010
@@ -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 @@
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 @@
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 @@
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 @@
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;
}
Modified: lldb/trunk/source/API/SBModule.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBModule.cpp (original)
+++ lldb/trunk/source/API/SBModule.cpp Mon Oct 25 22:11:13 2010
@@ -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 @@
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 @@
if (m_opaque_sp)
{
description.ref();
- m_opaque_sp->Dump (description.get());
+ m_opaque_sp->GetDescription (description.get());
}
else
description.Printf ("No value");
Modified: lldb/trunk/source/API/SBProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBProcess.cpp (original)
+++ lldb/trunk/source/API/SBProcess.cpp Mon Oct 25 22:11:13 2010
@@ -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 @@
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 (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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
sb_error.SetErrorString ("SBProcess is invalid");
}
+ if (log)
+ log->Printf ("SBProcess::ReadMemory ==> %d", bytes_read);
+
return bytes_read;
}
@@ -490,7 +684,7 @@
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 : "");
Modified: lldb/trunk/source/API/SBSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbol.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSymbol.cpp (original)
+++ lldb/trunk/source/API/SBSymbol.cpp Mon Oct 25 22:11:13 2010
@@ -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 @@
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 @@
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;
}
Modified: lldb/trunk/source/API/SBSymbolContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbolContext.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSymbolContext.cpp (original)
+++ lldb/trunk/source/API/SBSymbolContext.cpp Mon Oct 25 22:11:13 2010
@@ -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 @@
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 @@
else
ref() = *rhs.m_opaque_ap;
}
+
}
SBSymbolContext::~SBSymbolContext ()
@@ -83,9 +105,22 @@
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 @@
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 @@
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*
Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Mon Oct 25 22:11:13 2010
@@ -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 @@
//----------------------------------------------------------------------
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 @@
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 @@
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 @@
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 @@
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 @@
{
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 @@
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 @@
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 @@
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 @@
*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 @@
*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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
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");
Modified: lldb/trunk/source/API/SBThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBThread.cpp (original)
+++ lldb/trunk/source/API/SBThread.cpp Mon Oct 25 22:11:13 2010
@@ -41,6 +41,10 @@
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 (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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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;
+}
Modified: lldb/trunk/source/API/SBType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBType.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBType.cpp (original)
+++ lldb/trunk/source/API/SBType.cpp Mon Oct 25 22:11:13 2010
@@ -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 @@
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;
}
Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Mon Oct 25 22:11:13 2010
@@ -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 @@
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 @@
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 *
Modified: lldb/trunk/source/API/SBValueList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValueList.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValueList.cpp (original)
+++ lldb/trunk/source/API/SBValueList.cpp Mon Oct 25 22:11:13 2010
@@ -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 @@
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 @@
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;
}
Modified: lldb/trunk/source/Commands/CommandObjectLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLog.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectLog.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectLog.cpp Mon Oct 25 22:11:13 2010
@@ -64,18 +64,27 @@
"Enable logging for a single log channel.",
NULL)
{
- CommandArgumentEntry arg;
+
+ CommandArgumentEntry arg1;
+ CommandArgumentEntry arg2;
CommandArgumentData channel_arg;
+ CommandArgumentData category_arg;
// Define the first (and only) variant of this arg.
channel_arg.arg_type = eArgTypeLogChannel;
channel_arg.arg_repetition = eArgRepeatPlain;
// There is only one variant this argument could be; put it into the argument entry.
- arg.push_back (channel_arg);
+ arg1.push_back (channel_arg);
+ category_arg.arg_type = eArgTypeLogCategory;
+ category_arg.arg_repetition = eArgRepeatPlus;
+
+ arg2.push_back (category_arg);
+
// Push the data for the first argument into the m_arguments vector.
- m_arguments.push_back (arg);
+ m_arguments.push_back (arg1);
+ m_arguments.push_back (arg2);
}
virtual
Modified: lldb/trunk/source/Core/Communication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Communication.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/Core/Communication.cpp (original)
+++ lldb/trunk/source/Core/Communication.cpp Mon Oct 25 22:11:13 2010
@@ -364,3 +364,20 @@
Disconnect (NULL);
m_connection_ap.reset(connection);
}
+
+const char *
+Communication::ConnectionStatusAsCString (lldb::ConnectionStatus status)
+{
+ switch (status)
+ {
+ case eConnectionStatusSuccess: return "success";
+ case eConnectionStatusError: return "error";
+ case eConnectionStatusTimedOut: return "timed out";
+ case eConnectionStatusNoConnection: return "no connection";
+ case eConnectionStatusLostConnection: return "lost connection";
+ }
+
+ static char unknown_state_string[64];
+ snprintf(unknown_state_string, sizeof (unknown_state_string), "ConnectionStatus = %i", status);
+ return unknown_state_string;
+}
Modified: lldb/trunk/source/Core/InputReader.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/InputReader.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/Core/InputReader.cpp (original)
+++ lldb/trunk/source/Core/InputReader.cpp Mon Oct 25 22:11:13 2010
@@ -338,3 +338,21 @@
{
m_reader_done.WaitForValueEqualTo (true);
}
+
+const char *
+InputReader::GranularityAsCString (lldb::InputReaderGranularity granularity)
+{
+ switch (granularity)
+ {
+ case eInputReaderGranularityInvalid: return "invalid";
+ case eInputReaderGranularityByte: return "byte";
+ case eInputReaderGranularityWord: return "word";
+ case eInputReaderGranularityLine: return "line";
+ case eInputReaderGranularityAll: return "all";
+ }
+
+ static char unknown_state_string[64];
+ snprintf(unknown_state_string, sizeof (unknown_state_string), "InputReaderGranularity = %i", granularity);
+ return unknown_state_string;
+}
+
Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Mon Oct 25 22:11:13 2010
@@ -376,6 +376,20 @@
}
void
+Module::GetDescription (Stream *s)
+{
+ Mutex::Locker locker (m_mutex);
+
+ s->Printf("Module %s/%s%s%s%s\n",
+ m_file.GetDirectory().AsCString(),
+ m_file.GetFilename().AsCString(),
+ m_object_name ? "(" : "",
+ m_object_name ? m_object_name.GetCString() : "",
+ m_object_name ? ")" : "");
+
+}
+
+void
Module::Dump(Stream *s)
{
Mutex::Locker locker (m_mutex);
Modified: lldb/trunk/source/Interpreter/CommandObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandObject.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObject.cpp Mon Oct 25 22:11:13 2010
@@ -622,7 +622,8 @@
{ eArgTypeFunctionName, "function-name", CommandCompletions::eNoCompletion, NULL, "The name of a function." },
{ eArgTypeIndex, "index", CommandCompletions::eNoCompletion, NULL, "An index into a list." },
{ eArgTypeLineNum, "linenum", CommandCompletions::eNoCompletion, NULL, "Line number in a source file." },
- { eArgTypeLogChannel, "log-channel", CommandCompletions::eNoCompletion, NULL, "Help text goes here." },
+ { eArgTypeLogCategory, "log-category", CommandCompletions::eNoCompletion, NULL, "The name of a category within a log channel, e.g. all (try \"log list\" to see a list of all channels and their categories." },
+ { eArgTypeLogChannel, "log-channel", CommandCompletions::eNoCompletion, NULL, "The name of a log channel, e.g. process.gdb-remote (try \"log list\" to see a list of all channels and their categories)." },
{ eArgTypeMethod, "method", CommandCompletions::eNoCompletion, NULL, "A C++ method name." },
{ eArgTypeName, "name", CommandCompletions::eNoCompletion, NULL, "Help text goes here." },
{ eArgTypeNewPathPrefix, "new-path-prefix", CommandCompletions::eNoCompletion, NULL, "Help text goes here." },
Modified: lldb/trunk/source/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Target.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/Target/Target.cpp (original)
+++ lldb/trunk/source/Target/Target.cpp Mon Oct 25 22:11:13 2010
@@ -64,15 +64,27 @@
}
void
-Target::Dump (Stream *s)
+Target::Dump (Stream *s, lldb::DescriptionLevel description_level)
{
// s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
- s->Indent();
- s->PutCString("Target\n");
- s->IndentMore();
- m_images.Dump(s);
- m_breakpoint_list.Dump(s);
- m_internal_breakpoint_list.Dump(s);
+ if (description_level != lldb::eDescriptionLevelBrief)
+ {
+ s->Indent();
+ s->PutCString("Target\n");
+ s->IndentMore();
+ m_images.Dump(s);
+ m_breakpoint_list.Dump(s);
+ m_internal_breakpoint_list.Dump(s);
+ }
+ else
+ {
+ char path[PATH_MAX];
+ int path_len = PATH_MAX;
+ if (GetExecutableModule()->GetFileSpec().GetPath (path, path_len))
+ s->Printf ("Target: %s\n", path);
+ else
+ s->Printf ("Target: <unknown>\n");
+ }
// if (m_process_sp.get())
// m_process_sp->Dump(s);
s->IndentLess();
Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Mon Oct 25 22:11:13 2010
@@ -1097,3 +1097,39 @@
{
return GetStackFrameList().GetStackFrameSPForStackFramePtr (stack_frame_ptr);
}
+
+const char *
+Thread::StopReasonAsCString (lldb::StopReason reason)
+{
+ switch (reason)
+ {
+ case eStopReasonInvalid: return "invalid";
+ case eStopReasonNone: return "none";
+ case eStopReasonTrace: return "trace";
+ case eStopReasonBreakpoint: return "breakpoint";
+ case eStopReasonWatchpoint: return "watchpoint";
+ case eStopReasonSignal: return "signal";
+ case eStopReasonException: return "exception";
+ case eStopReasonPlanComplete: return "plan complete";
+ }
+
+
+ static char unknown_state_string[64];
+ snprintf(unknown_state_string, sizeof (unknown_state_string), "StopReason = %i", reason);
+ return unknown_state_string;
+}
+
+const char *
+Thread::RunModeAsCString (lldb::RunMode mode)
+{
+ switch (mode)
+ {
+ case eOnlyThisThread: return "only this thread";
+ case eAllThreads: return "all threads";
+ case eOnlyDuringStepping: return "only during stepping";
+ }
+
+ static char unknown_state_string[64];
+ snprintf(unknown_state_string, sizeof (unknown_state_string), "RunMode = %i", mode);
+ return unknown_state_string;
+}
Modified: lldb/trunk/source/lldb-log.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/lldb-log.cpp?rev=117349&r1=117348&r2=117349&view=diff
==============================================================================
--- lldb/trunk/source/lldb-log.cpp (original)
+++ lldb/trunk/source/lldb-log.cpp Mon Oct 25 22:11:13 2010
@@ -136,6 +136,7 @@
const char *arg = args.GetArgumentAtIndex(i);
if (strcasecmp(arg, "all") == 0 ) flag_bits |= LIBLLDB_LOG_ALL;
+ else if (strcasecmp(arg, "api") == 0) flag_bits |= LIBLLDB_LOG_API;
else if (strcasestr(arg, "break") == arg) flag_bits |= LIBLLDB_LOG_BREAKPOINTS;
else if (strcasecmp(arg, "default") == 0 ) flag_bits |= LIBLLDB_LOG_DEFAULT;
else if (strcasestr(arg, "event") == arg) flag_bits |= LIBLLDB_LOG_EVENTS;
@@ -177,6 +178,7 @@
{
strm->Printf("Logging categories for 'lldb':\n"
"\tall - turn on all available logging categories\n"
+ "\tapi - enable logging of API calls and return values\n"
"\tdefault - enable the default set of logging categories for liblldb\n"
"\tbreak - log breakpoints\n"
"\tevents - log broadcaster, listener and event queue activities\n"
More information about the lldb-commits
mailing list