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);
}
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@117627 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBFrame.cpp b/source/API/SBFrame.cpp
index c0eb134..028c869 100644
--- a/source/API/SBFrame.cpp
+++ b/source/API/SBFrame.cpp
@@ -547,7 +547,13 @@
{
ExecutionContext exe_ctx;
m_opaque_sp->CalculateExecutionContext (exe_ctx);
- *expr_result_value = ClangUserExpression::Evaluate (exe_ctx, expr);
+
+ const char *prefix = NULL;
+
+ if (exe_ctx.target)
+ prefix = exe_ctx.target->GetExpressionPrefixContentsAsCString();
+
+ *expr_result_value = ClangUserExpression::Evaluate (exe_ctx, expr, prefix);
}
return expr_result_value;
}