diff options
author | Caroline Tice <ctice@apple.com> | 2010-10-26 03:11:13 +0000 |
---|---|---|
committer | Caroline Tice <ctice@apple.com> | 2010-10-26 03:11:13 +0000 |
commit | ceb6b1393d05e3f5a7a235fd34bcf5d74ecc1f8d (patch) | |
tree | d49e665f965c7acfc1d122c6c5e1b128a7ef9d5a /lldb/source/API/SBCommandInterpreter.cpp | |
parent | e96b8d7ab66051f9fcbac5dfffd8dff7544a2909 (diff) | |
download | bcm5719-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/SBCommandInterpreter.cpp')
-rw-r--r-- | lldb/source/API/SBCommandInterpreter.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp index d38b74107f8..38f41462b08 100644 --- a/lldb/source/API/SBCommandInterpreter.cpp +++ b/lldb/source/API/SBCommandInterpreter.cpp @@ -23,6 +23,7 @@ #include "lldb/API/SBProcess.h" #include "lldb/API/SBTarget.h" #include "lldb/API/SBListener.h" +#include "lldb/API/SBStream.h" #include "lldb/API/SBStringList.h" using namespace lldb; @@ -32,6 +33,11 @@ using namespace lldb_private; SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter *interpreter) : m_opaque_ptr (interpreter) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API | LIBLLDB_LOG_VERBOSE); + + if (log) + log->Printf ("SBCommandInterpreter::SBCommandInterpreter (CommandInterpreter *interpreter) interpreter = %p" + " ==> this = %p", interpreter, this); } SBCommandInterpreter::~SBCommandInterpreter () @@ -64,6 +70,12 @@ SBCommandInterpreter::AliasExists (const char *cmd) lldb::ReturnStatus SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnObject &result, bool add_to_history) { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBCommandInterpreter::HandleCommand ('%s', result, %s)", command_line, + (add_to_history ? "true" : "false")); + result.Clear(); if (m_opaque_ptr) { @@ -74,6 +86,14 @@ SBCommandInterpreter::HandleCommand (const char *command_line, SBCommandReturnOb result->AppendError ("SBCommandInterpreter is not valid"); result->SetStatus (eReturnStatusFailed); } + + if (log) + { + SBStream sstr; + result.GetDescription (sstr); + log->Printf ("SBCommandInterpreter::HandleCommand ==> %s", sstr.GetData()); + } + return result.GetStatus(); } @@ -209,7 +229,16 @@ SBCommandInterpreter::SourceInitFileInCurrentWorkingDirectory (SBCommandReturnOb SBBroadcaster SBCommandInterpreter::GetBroadcaster () { + Log *log = lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API); + + if (log) + log->Printf ("SBCommandInterpreter::GetBroadcaster ()"); + SBBroadcaster broadcaster (m_opaque_ptr, false); + + if (log) + log->Printf ("SBCommandInterpreter::GetBroadcaster ==> %p", m_opaque_ptr); + return broadcaster; } |