[Lldb-commits] [PATCH] D151497: [lldb] Improve function caller error message

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu May 25 16:14:04 PDT 2023

JDevlieghere added a comment.

In D151497#4374080 <https://reviews.llvm.org/D151497#4374080>, @bulbazord wrote:

> I think it's good to improve the error messaging but I think we can probably do better. "Function caller" is specific to the internals of LLDB and isn't really meaningful for many users. It's also somewhat confusing from a user's perspective when the expression you're running isn't calling a function.
> If I were an end user who didn't know much about LLDB, I would think "I'm trying to print a variable, what's this about a function?" and "Why is memory allocation involved?". I would suggest changing the error message to something like: "Unable to evaluate expression while the process is $STATE: the process must be running and stopped to evaluate this expression".
> What do you think?

I very much agree that error messages should first and foremost be helpful to our users. In this particular patch, we have two places where we emit this error. In `UtilityFunction::MakeFunctionCaller` I believe the current error is totally appropriate. That doesn't mean that I think it should be shown to the user as such. I didn't look at how this function is called, but if it trips, I would like to see an error along the lines of:

  error: Couldn't run utility function. Can't make a function caller while the process is stopped: the process must be stopped to allocate memory.

On the other hand, in `UserExpression::Evaluate` I think it's totally appropriate to rephrase this, but at the same time I don't think we need to dumb this down.

  error: Unable to evaluate expression while the process is $STATE: the process must be stopped because the expression might requires allocating memory.

I'll update the error messages accordingly.



More information about the lldb-commits mailing list