summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectExpression.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2010-10-29 00:29:03 +0000
committerSean Callanan <scallanan@apple.com>2010-10-29 00:29:03 +0000
commit322f529b37673527a61693f496b3b1ad5356f720 (patch)
treee6cdc37e3a6badaa74c2d28590fb4bc61006d676 /lldb/source/Commands/CommandObjectExpression.cpp
parent5d6f6a061b5fa81addedba29ca26a276fd51e7cc (diff)
downloadbcm5719-llvm-322f529b37673527a61693f496b3b1ad5356f720.tar.gz
bcm5719-llvm-322f529b37673527a61693f496b3b1ad5356f720.zip
Added a user-settable variable, 'target.expr-prefix',
which holds the name of a file whose contents are prefixed to each expression. For example, if the file ~/lldb.prefix.header contains: typedef unsigned short my_type; then you can do this: (lldb) settings set target.expr-prefix '~/lldb.prefix.header' (lldb) expr sizeof(my_type) (unsigned long) $0 = 2 When the variable is changed, the corresponding file is loaded and its contents are fetched into a string that is stored along with the target. This string is then passed to each expression and inserted into it during parsing, like this: typedef unsigned short my_type; void $__lldb_expr(void *$__lldb_arg) { sizeof(my_type); } llvm-svn: 117627
Diffstat (limited to 'lldb/source/Commands/CommandObjectExpression.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectExpression.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lldb/source/Commands/CommandObjectExpression.cpp b/lldb/source/Commands/CommandObjectExpression.cpp
index 178ca530f10..7f7c780978a 100644
--- a/lldb/source/Commands/CommandObjectExpression.cpp
+++ b/lldb/source/Commands/CommandObjectExpression.cpp
@@ -233,7 +233,12 @@ CommandObjectExpression::EvaluateExpression
m_exe_ctx.process->SetDynamicCheckers(dynamic_checkers);
}
- lldb::ValueObjectSP result_valobj_sp (ClangUserExpression::Evaluate (m_exe_ctx, expr));
+ const char *prefix = NULL;
+
+ if (m_exe_ctx.target)
+ prefix = m_exe_ctx.target->GetExpressionPrefixContentsAsCString();
+
+ lldb::ValueObjectSP result_valobj_sp (ClangUserExpression::Evaluate (m_exe_ctx, expr, prefix));
assert (result_valobj_sp.get());
if (result_valobj_sp->GetError().Success())
{
OpenPOWER on IntegriCloud