[Lldb-commits] [lldb] r121193 - in /lldb/trunk/source: API/SBFrame.cpp Expression/ClangUserExpression.cpp
Sean Callanan
scallanan at apple.com
Tue Dec 7 14:55:01 PST 2010
Author: spyffe
Date: Tue Dec 7 16:55:01 2010
New Revision: 121193
URL: http://llvm.org/viewvc/llvm-project?rev=121193&view=rev
Log:
More logging for use in debugging the interactions
between clients of the LLDB API and the expression
parser.
Modified:
lldb/trunk/source/API/SBFrame.cpp
lldb/trunk/source/Expression/ClangUserExpression.cpp
Modified: lldb/trunk/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=121193&r1=121192&r2=121193&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Tue Dec 7 16:55:01 2010
@@ -561,6 +561,8 @@
SBFrame::EvaluateExpression (const char *expr)
{
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ LogSP expr_log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
lldb::SBValue expr_result;
if (log)
@@ -580,6 +582,9 @@
ClangUserExpression::Evaluate (exe_ctx, discard_on_error, expr, prefix, *expr_result);
}
+ if (expr_log)
+ expr_log->Printf("** [SBFrame::EvaluateExpression] Expression result is %s, summary %s **", expr_result.GetValue(*this), expr_result.GetSummary(*this));
+
if (log)
log->Printf ("SBFrame(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p)", m_opaque_sp.get(), expr, expr_result.get());
Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=121193&r1=121192&r2=121193&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Tue Dec 7 16:55:01 2010
@@ -315,7 +315,7 @@
if (log)
{
- log->Printf("-- Materializing for execution --");
+ log->Printf("-- [ClangUserExpression::PrepareToExecuteJITExpression] Materializing for execution --");
log->Printf(" Function address : 0x%llx", (uint64_t)m_jit_addr);
@@ -377,7 +377,7 @@
if (log)
{
- log->Printf("-- Dematerializing after execution --");
+ log->Printf("-- [ClangUserExpression::FinalizeJITExecution] Dematerializing after execution --");
StreamString args;
@@ -442,14 +442,14 @@
uint32_t single_thread_timeout_usec = 10000000;
if (log)
- log->Printf("-- Execution of expression begins --");
+ log->Printf("-- [ClangUserExpression::Execute] Execution of expression begins --");
Process::ExecutionResults execution_result =
exe_ctx.process->RunThreadPlan (exe_ctx, call_plan_sp, stop_others, try_all_threads, discard_on_error,
single_thread_timeout_usec, error_stream);
if (log)
- log->Printf("-- Execution of expression completed --");
+ log->Printf("-- [ClangUserExpression::Execute] Execution of expression completed --");
if (execution_result == Process::eExecutionInterrupted)
{
@@ -494,6 +494,8 @@
const char *expr_prefix,
lldb::ValueObjectSP &result_valobj_sp)
{
+ lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+
Error error;
Process::ExecutionResults execution_results = Process::eExecutionSetupError;
@@ -507,6 +509,9 @@
if (!exe_ctx.process->GetDynamicCheckers())
{
+ if (log)
+ log->Printf("== [ClangUserExpression::Evaluate] Installing dynamic checkers ==");
+
DynamicCheckerFunctions *dynamic_checkers = new DynamicCheckerFunctions();
StreamString install_errors;
@@ -523,12 +528,18 @@
}
exe_ctx.process->SetDynamicCheckers(dynamic_checkers);
+
+ if (log)
+ log->Printf("== [ClangUserExpression::Evaluate] Finished installing dynamic checkers ==");
}
ClangUserExpressionSP user_expression_sp (new ClangUserExpression (expr_cstr, expr_prefix));
StreamString error_stream;
+ if (log)
+ log->Printf("== [ClangUserExpression::Evaluate] Parsing expression %s ==", expr_cstr);
+
if (!user_expression_sp->Parse (error_stream, exe_ctx, TypeFromUser(NULL, NULL)))
{
if (error_stream.GetString().empty())
@@ -541,6 +552,9 @@
ClangExpressionVariable *expr_result = NULL;
error_stream.GetString().clear();
+
+ if (log)
+ log->Printf("== [ClangUserExpression::Evaluate] Executing expression ==");
execution_results = user_expression_sp->Execute (error_stream,
exe_ctx,
@@ -549,6 +563,9 @@
expr_result);
if (execution_results != Process::eExecutionCompleted)
{
+ if (log)
+ log->Printf("== [ClangUserExpression::Evaluate] Execution completed abnormally ==");
+
if (error_stream.GetString().empty())
error.SetErrorString ("expression failed to execute, unknown error");
else
@@ -564,9 +581,15 @@
if (expr_result)
{
result_valobj_sp = expr_result->GetExpressionResult (&exe_ctx);
+
+ if (log)
+ log->Printf("== [ClangUserExpression::Evaluate] Execution completed normally with result %s ==", result_valobj_sp->GetValueAsCString(exe_ctx.GetBestExecutionContextScope()));
}
else
{
+ if (log)
+ log->Printf("== [ClangUserExpression::Evaluate] Execution completed normally with no result ==");
+
error.SetErrorString ("Expression did not return a result");
}
}
More information about the lldb-commits
mailing list