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

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


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

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

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

View File

@@ -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;
}