Added a new class called lldb_private::SymbolFileType which is designed to
take a SymbolFile reference and a lldb::user_id_t and be used in objects
which represent things in debug symbols that have types where we don't need
to know the true type yet, such as in lldb_private::Variable objects. This
allows us to defer resolving the type until something is used. More specifically
this allows us to get 1000 local variables from the current function, and if
the user types "frame variable argc", we end up _only_ resolving the type for
"argc" and not for the 999 other local variables. We can expand the use of this
as needed in the future.
Modified the DWARFMappedHash class to be able to read the HashData that has
more than just the DIE offset. It currently will read the atoms in the header
definition and read the data correctly. Currently only the DIE offset and
type flags are supported. This is needed for adding type flags to the
.apple_types hash accelerator tables.
Fixed a assertion crash that would happen if we have a variable that had a
DW_AT_const_value instead of a location where "location.LocationContains_DW_OP_addr()"
would end up asserting when it tried to parse the variable location as a
DWARF opcode list.
Decreased the amount of memory that LLDB would use when evaluating an expression
by 3x - 4x for clang. There was a place in the namespace lookup code that was
parsing all namespaces with a certain name in a DWARF file instead of stopping
when it found the first match. This was causing all of the compile units with
a matching namespace to get parsed into memory and causing unnecessary memory
bloat.
Improved "Target::EvaluateExpression(...)" to not try and find a variable
when the expression contains characters that would certainly cause an expression
to need to be evaluated by the debugger.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@146130 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Target/Target.cpp b/source/Target/Target.cpp
index 978ab5e..a887866 100644
--- a/source/Target/Target.cpp
+++ b/source/Target/Target.cpp
@@ -1471,13 +1471,19 @@
ExecutionResults execution_results = eExecutionSetupError;
result_valobj_sp.reset();
-
+
+ if (expr_cstr == NULL || expr_cstr[0] == '\0')
+ return execution_results;
+
// We shouldn't run stop hooks in expressions.
// Be sure to reset this if you return anywhere within this function.
bool old_suppress_value = m_suppress_stop_hooks;
m_suppress_stop_hooks = true;
ExecutionContext exe_ctx;
+
+ const size_t expr_cstr_len = ::strlen (expr_cstr);
+
if (frame)
{
frame->CalculateExecutionContext(exe_ctx);
@@ -1486,11 +1492,17 @@
StackFrame::eExpressionPathOptionsNoFragileObjcIvar |
StackFrame::eExpressionPathOptionsNoSyntheticChildren;
lldb::VariableSP var_sp;
- result_valobj_sp = frame->GetValueForVariableExpressionPath (expr_cstr,
- use_dynamic,
- expr_path_options,
- var_sp,
- error);
+
+ // Make sure we don't have any things that we know a variable expression
+ // won't be able to deal with before calling into it
+ if (::strcspn (expr_cstr, "()+*&|!~<=/^%,?") == expr_cstr_len)
+ {
+ result_valobj_sp = frame->GetValueForVariableExpressionPath (expr_cstr,
+ use_dynamic,
+ expr_path_options,
+ var_sp,
+ error);
+ }
}
else if (m_process_sp)
{