[lldb] Improve error message when evaluating expression when not stopped
authorJonas Devlieghere <jonas@devlieghere.com>
Fri, 26 May 2023 15:48:02 +0000 (08:48 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Fri, 26 May 2023 15:49:58 +0000 (08:49 -0700)
commite31f99464216ef4d04ffa821e174522b699780ee
tree136094479d141b299eba0a047e3d62223b434793
parent08be7a429551cc995c939b357f709b878bfaf322
[lldb] Improve error message when evaluating expression when not stopped

When trying to run an expression after a process has existed, you
currently are shown the following error message:

  (lldb) p strlen("")
  error: Can't make a function caller while the process is running

This error is wrong and pretty uninformative. After this patch, the
following error message is shown:

  (lldb) p strlen("")
  error: unable to evaluate expression while the process is exited: the
  process must be stopped because the expression might require
  allocating memory.

rdar://109731325

Differential revision: https://reviews.llvm.org/D151497
lldb/source/Expression/UserExpression.cpp
lldb/source/Expression/UtilityFunction.cpp
lldb/test/Shell/Expr/TestExited.test [new file with mode: 0644]