[Bug 15784] New: expression interpreter fails after the inferior has crashed

Bug ID 15784
Summary expression interpreter fails after the inferior has crashed
Product lldb
Version unspecified
Hardware PC
OS All
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@cs.uiuc.edu
Reporter ashok.thirumurthi@intel.com
Classification Unclassified

When expression evaluation is performed after a crash, and the expression can
be handled by the expression interpreter, lldb fails with 

error: warning: expression result unused
error: Interpreting the expression locally failed: Result of expression is in
bad memory

To reproduce, build test/functionalities/inferior-crashing and run
  lldb a.out
  run
  p argc

Note that the automated test, test_inferior_expr shows the expected result and
can be run using:
  python dotest.py --executable <path-to-lldb>
functionalities/inferior-crashing

Note that the above test fails because ClangExpressionParser::ParseAST fails:

runCmd: p argc
error: use of undeclared identifier 'argc'
error: 1 errors parsing expression

The following stack frame shows the expected context for the call:
#1  0x00007ffff1474b93 in lldb_private::ClangUserExpression::Parse
(this=0x102d410, error_stream=..., exe_ctx=...,
execution_policy=lldb_private::eExecutionPolicyNever, 
keep_result_in_memory=true) at 
/home/athirumu/dev/lldb/tools/lldb/source/Expression/ClangUserExpression.cpp:453

To reproduce the above failure manually, use:
  lldb a.out
  run
  p argc
  p argc

Reproduced using Ubuntu 12.04 with clang using r179749.  Also reproduces using
gcc 4.6.3 and icc 13.1.0.  Cannot reproduce manually using gcc in place of
lldb.

Ashok Thirumurthi changed bug 15784

What | Removed | Added |

Comment # 2 on bug 15784 from Ashok Thirumurthi