aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectExpression.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-12-14 02:59:59 +0000
committerGreg Clayton <gclayton@apple.com>2010-12-14 02:59:59 +0000
commit8b2fe6dcbdf27b0df84ef4bdf514f9bc577c5804 (patch)
tree9816fbd1612d4cb872b44f996c47f67f9fc6470f /lldb/source/Commands/CommandObjectExpression.cpp
parent12960558416a6797ea7504e7d9934bb11a5b1f42 (diff)
downloadllvm-8b2fe6dcbdf27b0df84ef4bdf514f9bc577c5804.zip
llvm-8b2fe6dcbdf27b0df84ef4bdf514f9bc577c5804.tar.gz
llvm-8b2fe6dcbdf27b0df84ef4bdf514f9bc577c5804.tar.bz2
Modified LLDB expressions to not have to JIT and run code just to see variable
values or persistent expression variables. Now if an expression consists of a value that is a child of a variable, or of a persistent variable only, we will create a value object for it and make a ValueObjectConstResult from it to freeze the value (for program variables only, not persistent variables) and avoid running JITed code. For everything else we still parse up and JIT code and run it in the inferior. There was also a lot of clean up in the expression code. I made the ClangExpressionVariables be stored in collections of shared pointers instead of in collections of objects. This will help stop a lot of copy constructors on these large objects and also cleans up the code considerably. The persistent clang expression variables were moved over to the Target to ensure they persist across process executions. Added the ability for lldb_private::Target objects to evaluate expressions. We want to evaluate expressions at the target level in case we aren't running yet, or we have just completed running. We still want to be able to access the persistent expression variables between runs, and also evaluate constant expressions. Added extra logging to the dynamic loader plug-in for MacOSX. ModuleList objects can now dump their contents with the UUID, arch and full paths being logged with appropriate prefix values. Thread hardened the Communication class a bit by making the connection auto_ptr member into a shared pointer member and then making a local copy of the shared pointer in each method that uses it to make sure another thread can't nuke the connection object while it is being used by another thread. Added a new file to the lldb/test/load_unload test that causes the test a.out file to link to the libd.dylib file all the time. This will allow us to test using the DYLD_LIBRARY_PATH environment variable after moving libd.dylib somewhere else. llvm-svn: 121745
Diffstat (limited to 'lldb/source/Commands/CommandObjectExpression.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectExpression.cpp80
1 files changed, 40 insertions, 40 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp
index c58f3f5..d0e9ef9 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -232,55 +232,55 @@ CommandObjectExpression::EvaluateExpression
CommandReturnObject *result
)
{
- if (!m_exe_ctx.process)
- {
- error_stream.Printf ("Execution context doesn't contain a process\n");
- return false;
- }
-
- const char *prefix = NULL;
-
if (m_exe_ctx.target)
- prefix = m_exe_ctx.target->GetExpressionPrefixContentsAsCString();
-
- lldb::ValueObjectSP result_valobj_sp;
- Process::ExecutionResults execution_results = ClangUserExpression::Evaluate (m_exe_ctx, m_options.unwind_on_error, expr, prefix, result_valobj_sp);
- assert (result_valobj_sp.get());
- if (result_valobj_sp->GetError().Success())
{
- if (m_options.format != eFormatDefault)
- result_valobj_sp->SetFormat (m_options.format);
-
- ValueObject::DumpValueObject (output_stream,
- m_exe_ctx.GetBestExecutionContextScope(),
- result_valobj_sp.get(), // Variable object to dump
- result_valobj_sp->GetName().AsCString(),// Root object name
- 0, // Pointer depth to traverse (zero means stop at pointers)
- 0, // Current depth, this is the top most, so zero...
- UINT32_MAX, // Max depth to go when dumping concrete types, dump everything...
- m_options.show_types, // Show types when dumping?
- false, // Show locations of variables, no since this is a host address which we don't care to see
- m_options.print_object, // Print the objective C object?
- true, // Scope is already checked. Const results are always in scope.
- false); // Don't flatten output
- if (result)
- result->SetStatus (eReturnStatusSuccessFinishResult);
- }
- else
- {
- error_stream.PutCString(result_valobj_sp->GetError().AsCString());
- // If we've been interrupted, display state information.
- if (execution_results == Process::eExecutionInterrupted && !m_options.unwind_on_error)
+ lldb::ValueObjectSP result_valobj_sp;
+
+ lldb::ExecutionResults exe_results;
+ exe_results = m_exe_ctx.target->EvaluateExpression(expr, m_exe_ctx.frame, m_options.unwind_on_error, result_valobj_sp);
+
+ if (exe_results == eExecutionInterrupted && !m_options.unwind_on_error)
{
if (m_exe_ctx.thread)
lldb_private::DisplayThreadInfo (m_interpreter, result->GetOutputStream(), m_exe_ctx.thread, false, true);
else
- {
lldb_private::DisplayThreadsInfo (m_interpreter, &m_exe_ctx, *result, true, true);
+ }
+
+ if (result_valobj_sp)
+ {
+ if (result_valobj_sp->GetError().Success())
+ {
+ if (m_options.format != eFormatDefault)
+ result_valobj_sp->SetFormat (m_options.format);
+
+ ValueObject::DumpValueObject (output_stream,
+ m_exe_ctx.GetBestExecutionContextScope(),
+ result_valobj_sp.get(), // Variable object to dump
+ result_valobj_sp->GetName().GetCString(),// Root object name
+ 0, // Pointer depth to traverse (zero means stop at pointers)
+ 0, // Current depth, this is the top most, so zero...
+ UINT32_MAX, // Max depth to go when dumping concrete types, dump everything...
+ m_options.show_types, // Show types when dumping?
+ false, // Show locations of variables, no since this is a host address which we don't care to see
+ m_options.print_object, // Print the objective C object?
+ true, // Scope is already checked. Const results are always in scope.
+ false); // Don't flatten output
+ if (result)
+ result->SetStatus (eReturnStatusSuccessFinishResult);
+ }
+ else
+ {
+ error_stream.PutCString(result_valobj_sp->GetError().AsCString());
+ if (result)
+ result->SetStatus (eReturnStatusFailed);
}
}
- if (result)
- result->SetStatus (eReturnStatusFailed);
+ }
+ else
+ {
+ error_stream.Printf ("error: invalid execution context for expression\n");
+ return false;
}
return true;