teak-llvm/lldb/packages/Python/lldbsuite/test/commands
Raphael Isemann 1442efea9a [lldb] Print better diagnostics for user expressions and modules
Summary:
Currently our expression evaluators only prints very basic errors that are not very useful when writing complex expressions.

For example, in the expression below the user made a type error, but it's not clear from the diagnostic what went wrong:
```
(lldb) expr printf("Modulos are:", foobar%mo1, foobar%mo2, foobar%mo3)
error: invalid operands to binary expression ('int' and 'double')
```

This patch enables full Clang diagnostics in our expression evaluator. After this patch the diagnostics for the expression look like this:

```
(lldb) expr printf("Modulos are:", foobar%mo1, foobar%mo2, foobar%mo3)
error: <user expression 1>:1:54: invalid operands to binary expression ('int' and 'float')
printf("Modulos are:", foobar%mo1, foobar%mo2, foobar%mo3)
                                               ~~~~~~^~~~
```

To make this possible, we now emulate a user expression file within our diagnostics. This prevents that the user is exposed to
our internal wrapper code we inject.

Note that the diagnostics that refer to declarations from the debug information (e.g. 'note' diagnostics pointing to a called function)
will not be improved by this as they don't have any source locations associated with them, so caret or line printing isn't possible.
We instead just suppress these diagnostics as we already do with warnings as they would otherwise just be a context message
without any context (and the original diagnostic in the user expression should be enough to explain the issue).

Fixes rdar://24306342

Reviewers: JDevlieghere, aprantl, shafik, #lldb

Reviewed By: JDevlieghere, #lldb

Subscribers: usaxena95, davide, jingham, aprantl, arphaman, kadircet, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D65646

llvm-svn: 372203
2019-09-18 08:53:35 +00:00
..
add-dsym/uuid [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
apropos [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
command [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
disassemble/basic [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
expression [lldb] Print better diagnostics for user expressions and modules 2019-09-18 08:53:35 +00:00
frame [ScriptInterpreter] Limit LLDB's globals to interactive mode. 2019-09-18 00:30:01 +00:00
gui [lldb][NFC] Add dimensions to pexpect tests failing on sanitizer bot 2019-09-05 14:51:23 +00:00
help
log [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
platform/basic
process [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
quit
register/register [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
reproducer/invalid-args [lldb][NFC] Remove unnecessary constructors from invalid-args tests 2019-09-03 09:25:02 +00:00
settings [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
source/info [dotest] Delete trivial inline test makefiles 2019-09-05 06:55:23 +00:00
statistics/basic [dotest] Delete trivial inline test makefiles 2019-09-05 06:55:23 +00:00
target [dotest] Avoid the need for LEVEL= makefile boilerplate 2019-09-04 07:46:25 +00:00
version
watchpoints [Windows] Add support of watchpoints to ProcessWindows 2019-09-06 05:37:03 +00:00