summaryrefslogtreecommitdiffstats
path: root/lldb/source/API/SBLineEntry.cpp
diff options
context:
space:
mode:
authorCaroline Tice <ctice@apple.com>2010-10-26 03:11:13 +0000
committerCaroline Tice <ctice@apple.com>2010-10-26 03:11:13 +0000
commitceb6b1393d05e3f5a7a235fd34bcf5d74ecc1f8d (patch)
treed49e665f965c7acfc1d122c6c5e1b128a7ef9d5a /lldb/source/API/SBLineEntry.cpp
parente96b8d7ab66051f9fcbac5dfffd8dff7544a2909 (diff)
downloadbcm5719-llvm-ceb6b1393d05e3f5a7a235fd34bcf5d74ecc1f8d.tar.gz
bcm5719-llvm-ceb6b1393d05e3f5a7a235fd34bcf5d74ecc1f8d.zip
First pass at adding logging capabilities for the API functions. At the moment
it logs the function calls, their arguments and the return values. This is not complete or polished, but I am committing it now, at the request of someone who really wants to use it, even though it's not really done. It currently does not attempt to log all the functions, just the most important ones. I will be making further adjustments to the API logging code over the next few days/weeks. (Suggestions for improvements are welcome). Update the Python build scripts to re-build the swig C++ file whenever the python-extensions.swig file is modified. Correct the help for 'log enable' command (give it the correct number & type of arguments). llvm-svn: 117349
Diffstat (limited to 'lldb/source/API/SBLineEntry.cpp')
-rw-r--r--lldb/source/API/SBLineEntry.cpp59
1 files changed, 57 insertions, 2 deletions
diff --git a/lldb/source/API/SBLineEntry.cpp b/lldb/source/API/SBLineEntry.cpp
index 023afb94aad..8ade4c54f1f 100644
--- a/lldb/source/API/SBLineEntry.cpp
+++ b/lldb/source/API/SBLineEntry.cpp
@@ -10,22 +10,35 @@
#include "lldb/API/SBLineEntry.h"
#include "lldb/API/SBStream.h"
#include "lldb/Symbol/LineEntry.h"
+#include "lldb/Core/Log.h"
using namespace lldb;
+using namespace lldb_private;
SBLineEntry::SBLineEntry () :
m_opaque_ap ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
+
+ if (log)
+ log->Printf ("SBLineEntry::SBLineEntry () ==> this = %p", this);
}
SBLineEntry::SBLineEntry (const SBLineEntry &rhs) :
m_opaque_ap ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
+
if (rhs.IsValid())
{
m_opaque_ap.reset (new lldb_private::LineEntry (*rhs));
}
+
+ if (log)
+ log->Printf ("SBLineEntry::SBLineEntry (const SBLineEntry &rhs) rhs.m_opaque_ap.get() = %p ==> this = %p ",
+ (rhs.IsValid() ? rhs.m_opaque_ap.get() : NULL), this);
+
}
@@ -33,8 +46,14 @@ SBLineEntry::SBLineEntry (const SBLineEntry &rhs) :
SBLineEntry::SBLineEntry (const lldb_private::LineEntry *lldb_object_ptr) :
m_opaque_ap ()
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE);
+
if (lldb_object_ptr)
m_opaque_ap.reset (new lldb_private::LineEntry(*lldb_object_ptr));
+
+ if (log)
+ log->Printf ("SBLineEntry::SBLineEntry (const lldb_private::LineEntry *lldb_object_ptr) lldb_object_ptr = %p"
+ " ==> this = %p (m_opaque_ap.get() = %p)", lldb_object_ptr, this, m_opaque_ap.get());
}
const SBLineEntry &
@@ -66,9 +85,22 @@ SBLineEntry::~SBLineEntry ()
SBAddress
SBLineEntry::GetStartAddress () const
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBLineEntry::GetStartAddress ()");
+
SBAddress sb_address;
if (m_opaque_ap.get())
sb_address.SetAddress(&m_opaque_ap->range.GetBaseAddress());
+
+ if (log)
+ {
+ SBStream sstr;
+ sb_address.GetDescription (sstr);
+ log->Printf ("SBLineEntry::GetStartAddress ==> SBAddress (this = %p, (%s)", &sb_address, sstr.GetData());
+ }
+
return sb_address;
}
@@ -94,18 +126,41 @@ SBLineEntry::IsValid () const
SBFileSpec
SBLineEntry::GetFileSpec () const
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBLineEntry::GetFileSpec ()");
+
SBFileSpec sb_file_spec;
if (m_opaque_ap.get() && m_opaque_ap->file)
sb_file_spec.SetFileSpec(m_opaque_ap->file);
+
+ if (log)
+ {
+ SBStream sstr;
+ sb_file_spec.GetDescription (sstr);
+ log->Printf ("SBLineEntry::GetFileSpec ==> SBFileSpec (this = %p, '%s'", &sb_file_spec, sstr.GetData());
+ }
+
return sb_file_spec;
}
uint32_t
SBLineEntry::GetLine () const
{
+ Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API);
+
+ if (log)
+ log->Printf ("SBLineEntry::GetLine ()");
+
+ uint32_t line = 0;
if (m_opaque_ap.get())
- return m_opaque_ap->line;
- return 0;
+ line = m_opaque_ap->line;
+
+ if (log)
+ log->Printf ("SBLineEntry::GetLine ==> %d", line);
+
+ return line;
}
OpenPOWER on IntegriCloud