[Lldb-commits] [lldb] r150103 - /lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
Sean Callanan
scallanan at apple.com
Wed Feb 8 13:55:14 PST 2012
Author: spyffe
Date: Wed Feb 8 15:55:14 2012
New Revision: 150103
URL: http://llvm.org/viewvc/llvm-project?rev=150103&view=rev
Log:
Added support to the expression parser for reading
variables that are only available in symbols.
Modified:
lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=150103&r1=150102&r2=150103&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Wed Feb 8 15:55:14 2012
@@ -969,7 +969,7 @@
return false;
Error err;
- target->ReadMemory(file_addr, true, data, length, err);
+ target->ReadMemory(file_addr, false, data, length, err);
return err.Success();
}
@@ -1011,34 +1011,57 @@
if (expr_var_sp)
{
- if (!expr_var_sp->m_parser_vars.get() || !expr_var_sp->m_parser_vars->m_lldb_var)
+ if (!expr_var_sp->m_parser_vars.get())
return Value();
bool is_reference = expr_var_sp->m_flags & ClangExpressionVariable::EVTypeIsReference;
-
- std::auto_ptr<Value> value(GetVariableValue(exe_ctx, expr_var_sp->m_parser_vars->m_lldb_var, NULL));
-
- if (is_reference && value.get() && value->GetValueType() == Value::eValueTypeLoadAddress)
+
+ if (expr_var_sp->m_parser_vars->m_lldb_var)
{
- Process *process = m_parser_vars->m_exe_ctx->GetProcessPtr();
+ std::auto_ptr<Value> value(GetVariableValue(exe_ctx, expr_var_sp->m_parser_vars->m_lldb_var, NULL));
- if (!process)
+ if (is_reference && value.get() && value->GetValueType() == Value::eValueTypeLoadAddress)
+ {
+ Process *process = m_parser_vars->m_exe_ctx->GetProcessPtr();
+
+ if (!process)
+ return Value();
+
+ lldb::addr_t value_addr = value->GetScalar().ULongLong();
+ Error read_error;
+ addr_t ref_value = process->ReadPointerFromMemory (value_addr, read_error);
+
+ if (!read_error.Success())
+ return Value();
+
+ value->GetScalar() = (unsigned long long)ref_value;
+ }
+
+ if (value.get())
+ return *value;
+ else
return Value();
+ }
+ else if (expr_var_sp->m_parser_vars->m_lldb_sym)
+ {
+ const Address sym_address = expr_var_sp->m_parser_vars->m_lldb_sym->GetAddressRangeRef().GetBaseAddress();
- lldb::addr_t value_addr = value->GetScalar().ULongLong();
- Error read_error;
- addr_t ref_value = process->ReadPointerFromMemory (value_addr, read_error);
-
- if (!read_error.Success())
+ if (!sym_address.IsValid())
return Value();
+
+ Value ret;
+
+ uint64_t symbol_addr = sym_address.GetFileAddress();
+
+ ret.GetScalar() = symbol_addr;
+ ret.SetValueType(Value::eValueTypeFileAddress);
- value->GetScalar() = (unsigned long long)ref_value;
+ return ret;
}
-
- if (value.get())
- return *value;
else
+ {
return Value();
+ }
}
else if (persistent_var_sp)
{
More information about the lldb-commits
mailing list