From 322f529b37673527a61693f496b3b1ad5356f720 Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Fri, 29 Oct 2010 00:29:03 +0000 Subject: 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 --- lldb/source/Commands/CommandObjectExpression.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lldb/source/Commands/CommandObjectExpression.cpp') 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()) { -- cgit v1.2.3