History log of /llvm-project/lldb/source/Commands/CommandObjectDWIMPrint.cpp (Results 1 – 25 of 37)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5
# 1250a1db 02-Dec-2024 Dave Lee <davelee.com@gmail.com>

[lldb] Update dwim-print to support limited variable expression paths (#117452)

`frame variable` supports nested variable access, which the API calls "variable
expression paths". This change update

[lldb] Update dwim-print to support limited variable expression paths (#117452)

`frame variable` supports nested variable access, which the API calls "variable
expression paths". This change updates `dwim-print` to support a subset of supported
variable expression paths.

Consider the expression `a->b`. In C++, the arrow operator can be overloaded, and where
that is the case, expression evaluation must be used to evaluate it, not frame variable.
Likewise, the subscript operator can be overloaded.

To avoid those cases, this change introduces a limited support for variable expression
paths. Use of the dot operator is allowed.

Additionally, this change allows `dwim-print` to directly access children of `this` and
`self` (see AllowDirectIVarAccess). This functionality is also provided by the same
`GetValueForVariableExpressionPath` method.

rdar://104348908

show more ...


Revision tags: llvmorg-19.1.4
# 79178ca6 02-Nov-2024 Jonas Devlieghere <jonas@devlieghere.com>

[lldb] Highlight "note:" in CommandReturnObject (#114610)

We have helpers to emit warnings and errors. Do the same thing for notes
to they stand out more.


# 2bd21b26 01-Nov-2024 Dave Lee <davelee.com@gmail.com>

[lldb] Improve command status when dwim-print has no result (#114478)

When an expression produces no result, set `dwim-print` status to
`eReturnStatusSuccessFinishNoResult`.


Revision tags: llvmorg-19.1.3
# b852fb1e 25-Oct-2024 Jonas Devlieghere <jonas@devlieghere.com>

[lldb] Move ValueObject into its own library (NFC) (#113393)

ValueObject is part of lldbCore for historical reasons, but conceptually
it deserves to be its own library. This does introduce a (link-

[lldb] Move ValueObject into its own library (NFC) (#113393)

ValueObject is part of lldbCore for historical reasons, but conceptually
it deserves to be its own library. This does introduce a (link-time) circular
dependency between lldbCore and lldbValueObject, which is unfortunate
but probably unavoidable because so many things in LLDB rely on
ValueObject. We already have cycles and these libraries are never built
as dylibs so while this doesn't improve the situation, it also doesn't
make things worse.

The header includes were updated with the following command:

```
find . -type f -exec sed -i.bak "s%include \"lldb/Core/ValueObject%include \"lldb/ValueObject/ValueObject%" '{}' \;
```

show more ...


Revision tags: llvmorg-19.1.2
# 9eddc8b9 14-Oct-2024 Adrian Prantl <aprantl@apple.com>

[lldb] Expose structured command diagnostics via the SBAPI. (#112109)

This allows IDEs to render LLDB expression diagnostics to their liking
without relying on characterprecise ASCII art from LLDB.

[lldb] Expose structured command diagnostics via the SBAPI. (#112109)

This allows IDEs to render LLDB expression diagnostics to their liking
without relying on characterprecise ASCII art from LLDB. It is exposed
as a versioned SBStructuredData object, since it is expected that this
may need to be tweaked based on actual usage.

show more ...


# 089227fe 11-Oct-2024 Adrian Prantl <aprantl@apple.com>

Support inline diagnostics in CommandReturnObject (#110901)

and implement them for dwim-print (a.k.a. `p`) as an example.

The next step will be to expose them as structured data in
SBCommandRetu

Support inline diagnostics in CommandReturnObject (#110901)

and implement them for dwim-print (a.k.a. `p`) as an example.

The next step will be to expose them as structured data in
SBCommandReturnObject.

show more ...


# 8789c966 02-Oct-2024 Adrian Prantl <aprantl@apple.com>

[lldb] Unify implementation of CommandReturnObject::SetError(NFC) (#110707)

This is a cleanup that moves the API towards value semantics.


Revision tags: llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init
# 9473e162 20-Jun-2024 Adrian Prantl <aprantl@apple.com>

[DWIMPrint] Move the setting of the result status into dump_val_object (#96232)

Previously the result would get overwritten by a success on all code
paths.

This is another NFC change for TypeSys

[DWIMPrint] Move the setting of the result status into dump_val_object (#96232)

Previously the result would get overwritten by a success on all code
paths.

This is another NFC change for TypeSystemClang, because an object
description cannot actually fail there. It will have different behavior
in the Swift plugin.

show more ...


# d1bc75c0 17-Jun-2024 Adrian Prantl <aprantl@apple.com>

Convert ValueObject::Dump() to return llvm::Error() (NFCish)

This change by itself has no measurable effect on the LLDB
testsuite. I'm making it in preparation for threading through more
errors in t

Convert ValueObject::Dump() to return llvm::Error() (NFCish)

This change by itself has no measurable effect on the LLDB
testsuite. I'm making it in preparation for threading through more
errors in the Swift language plugin.

show more ...


Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5
# 35fa46a5 29-Apr-2024 Adrian Prantl <aprantl@apple.com>

Improve comment


# 975eca0e 29-Apr-2024 Adrian Prantl <aprantl@apple.com>

Add a new SBExpressionOptions::SetLanguage() API (NFCI) (#89981)

that separates out language and version. To avoid reinventing the wheel
and introducing subtle incompatibilities, this API uses the

Add a new SBExpressionOptions::SetLanguage() API (NFCI) (#89981)

that separates out language and version. To avoid reinventing the wheel
and introducing subtle incompatibilities, this API uses the table of
languages and versiond defined by the upcoming DWARF 6 standard
(https://dwarfstd.org/languages-v6.html). While the DWARF 6 spec is not
finialized, the list of languages is broadly considered stable.

The primary motivation for this is to allow the Swift language plugin to
switch between language dialects between, e.g., Swift 5.9 and 6.0 with
out introducing a ton of new language codes. On the main branch this
change is considered NFC.

Depends on https://github.com/llvm/llvm-project/pull/89980

show more ...


Revision tags: llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2
# 65d444b9 18-Mar-2024 Felipe de Azevedo Piovezan <fpiovezan@apple.com>

[lldb][nfc] Factor out repeated code in DWIM Print (#85669)

The code that prints ValueObjects is duplicated across two different
cases of the dwim-print command, and a subsequent commit will add a

[lldb][nfc] Factor out repeated code in DWIM Print (#85669)

The code that prints ValueObjects is duplicated across two different
cases of the dwim-print command, and a subsequent commit will add a
third case. As such, this commit factors out the common code into a
lambda. A free function was considered, but there is too much
function-local context required in that.

We also reword some of the comments so that they stop counting cases,
making it easier to add other cases later.

show more ...


# 4da2b542 15-Mar-2024 Dave Lee <davelee.com@gmail.com>

[lldb] Fix dwim-print to not delete non-result persistent variables (#85152)

`EvaluateExpression` does not always create a new persistent result. If the expression
is a bare persistent variable, th

[lldb] Fix dwim-print to not delete non-result persistent variables (#85152)

`EvaluateExpression` does not always create a new persistent result. If the expression
is a bare persistent variable, then a new persistent result is not created. This means
the caller can't assume a new persistent result is created for each evaluation.
However, `dwim-print` was doing exactly that: assuming a new persistent result for each
evaluation. This resulted in a bug:

```
(lldb) p int $j = 23
(lldb) p $j
(lldb) p $j
```

The first `p $j` would not create a persistent result, and so `dwim-print` would
inadvertently delete `$j`. The second `p $j` would fail.

The fix is to try `expr` as a persistent variable, after trying `expr` as a frame
variable. For persistent variables, this avoids calling `EvaluateExpression`.

Resolves https://github.com/llvm/llvm-project/issues/84806

rdar://124688427

show more ...


Revision tags: llvmorg-18.1.1
# 2d704f4b 27-Feb-2024 jimingham <jingham@apple.com>

Start to clean up the process of defining command arguments. (#83097)

Partly, there's just a lot of unnecessary boiler plate. It's also
possible to define combinations of arguments that make no sen

Start to clean up the process of defining command arguments. (#83097)

Partly, there's just a lot of unnecessary boiler plate. It's also
possible to define combinations of arguments that make no sense (e.g.
eArgRepeatPlus followed by eArgRepeatPlain...) but these are never
checked since we just push_back directly into the argument definitions.

This commit is step 1 of this cleanup - do the obvious stuff. In it, all
the simple homogenous argument lists and the breakpoint/watchpoint
ID/Range types, are set with common functions. This is an NFC change, it
just centralizes boiler plate. There's no checking yet because you can't
get a single argument wrong.

The end goal is that all argument definition goes through functions and
m_arguments is hidden so that you can't define inconsistent argument
sets.

show more ...


Revision tags: llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3
# 563ef306 20-Feb-2024 jimingham <jingham@apple.com>

Add the RegisterCompleter to eArgTypeRegisterName in g_argument_table (#82428)

This is a follow-on to:

https://github.com/llvm/llvm-project/pull/82085

The completer for register names was miss

Add the RegisterCompleter to eArgTypeRegisterName in g_argument_table (#82428)

This is a follow-on to:

https://github.com/llvm/llvm-project/pull/82085

The completer for register names was missing from the argument table. I
somehow missed that the only register completer test was x86_64, so that
test broke.

I added the completer in to the right slot in the argument table, and
added a small completions test that just uses the alias register names.
If we end up having a platform that doesn't define register names, we'll
have to skip this test there, but it should add a sniff test for
register completion that will run most everywhere.

show more ...


# 9ed8b272 20-Feb-2024 Shubham Sandeep Rastogi <srastogi22@apple.com>

Revert "Centralize the handling of completion for simple argument lists. (#82085)"

This reverts commit 21631494b068d9364b8dc8f18e59adee9131a0a5.

Reverted because of greendragon failure:

**********

Revert "Centralize the handling of completion for simple argument lists. (#82085)"

This reverts commit 21631494b068d9364b8dc8f18e59adee9131a0a5.

Reverted because of greendragon failure:

******************** TEST 'lldb-api :: functionalities/completion/TestCompletion.py' FAILED ********************
Script:

show more ...


# 21631494 20-Feb-2024 jimingham <jingham@apple.com>

Centralize the handling of completion for simple argument lists. (#82085)

Most commands were adding argument completion handling by themselves,
resulting in a lot of unnecessary boilerplate. In man

Centralize the handling of completion for simple argument lists. (#82085)

Most commands were adding argument completion handling by themselves,
resulting in a lot of unnecessary boilerplate. In many cases, this could
be done generically given the argument definition and the entries in the
g_argument_table.

I'm going to address this in a couple passes. In this first pass, I
added handling of commands that have only one argument list, with one
argument type, either single or repeated, and changed all the commands
that are of this sort (and don't have other bits of business in their
completers.)

I also added some missing connections between arg types and completions
to the table, and added a RemoteFilename and RemotePath to use in places
where we were using the Remote completers. Those arguments used to say
they were "files" but they were in fact remote files.

I also added a module arg type to use where we were using the module
completer. In that case, we should call the argument module.

show more ...


Revision tags: llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init, llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4
# 92d8a28c 30-Oct-2023 Pete Lawrence <plawrence@apple.com>

[lldb] Part 2 of 2 - Refactor `CommandObject::DoExecute(...)` return `void` (not `bool`) (#69991)

[lldb] Part 2 of 2 - Refactor `CommandObject::DoExecute(...)` to return
`void` instead of ~~`bool`~

[lldb] Part 2 of 2 - Refactor `CommandObject::DoExecute(...)` return `void` (not `bool`) (#69991)

[lldb] Part 2 of 2 - Refactor `CommandObject::DoExecute(...)` to return
`void` instead of ~~`bool`~~

Justifications:
- The code doesn't ultimately apply the `true`/`false` return values.
- The methods already pass around a `CommandReturnObject`, typically
with a `result` parameter.
- Each command return object already contains:
- A more precise status
- The error code(s) that apply to that status

Part 1 refactors the `CommandObject::Execute(...)` method.
- See
[https://github.com/llvm/llvm-project/pull/69989](https://github.com/llvm/llvm-project/pull/69989)

rdar://117378957

show more ...


Revision tags: llvmorg-17.0.3
# 8e2bd05c 13-Oct-2023 Pete Lawrence <plawrence@apple.com>

[lldb] Fix `po` alias by printing fix-its to the console. (#68755)

The `po` alias now matches the behavior of the `expression` command when
the it can apply a Fix-It to an expression.
Modification

[lldb] Fix `po` alias by printing fix-its to the console. (#68755)

The `po` alias now matches the behavior of the `expression` command when
the it can apply a Fix-It to an expression.
Modifications

- Add has `m_fixed_expression` to the `CommandObjectDWIMPrint` class a
`protected` member that stores the post Fix-It expression, just like the
`CommandObjectExpression` class.
- Converted messages to present tense.
- Add test cases that confirms a Fix-It for a C++ expression for both
`po` and `expressions`

rdar://115317419

show more ...


# 2e59b755 10-Oct-2023 Adrian Prantl <aprantl@apple.com>

Revert "[lldb] Fix `po` alias by printing fix-its to the console. (#68452)"

This reverts commit 606f89ab7d537ca068fb1be9fd89d96a30de38f8 while investigating bot failures.


# 606f89ab 10-Oct-2023 Pete Lawrence <34425917+PortalPete@users.noreply.github.com>

[lldb] Fix `po` alias by printing fix-its to the console. (#68452)

The `po` alias now matches the behavior of the `expression` command when
the it can apply a Fix-It to an expression.
Modification

[lldb] Fix `po` alias by printing fix-its to the console. (#68452)

The `po` alias now matches the behavior of the `expression` command when
the it can apply a Fix-It to an expression.
Modifications

- Add has `m_fixed_expression` to the `CommandObjectDWIMPrint` class a
`protected` member that stores the post Fix-It expression, just like the
`CommandObjectExpression` class.
- Converted messages to present tense.
- Add test cases that confirms a Fix-It for a C++ expression for both
`po` and `expressions`

rdar://115317419

Co-authored-by: Pete Lawrence <plawrence@apple.com>

show more ...


Revision tags: llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init
# 5f45a87b 28-Jun-2023 Augusto Noronha <augusto2112@me.com>

[lldb] Print hint if object description is requested but not implemented

Lots of users use "po" as their default print command. If the type
doesn't implement the description function the output is o

[lldb] Print hint if object description is requested but not implemented

Lots of users use "po" as their default print command. If the type
doesn't implement the description function the output is often not what
the user wants. Print a hint telling the user that they might prefer
using "p" instead.

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

show more ...


Revision tags: llvmorg-16.0.6
# 6a9c3e61 06-Jun-2023 Med Ismail Bennani <ismail@bennani.ma>

[lldb/Commands] Add support to auto-completion for user commands

This patch should allow the user to set specific auto-completion type
for their custom commands.

To do so, we had to hoist the `Comp

[lldb/Commands] Add support to auto-completion for user commands

This patch should allow the user to set specific auto-completion type
for their custom commands.

To do so, we had to hoist the `CompletionType` enum so the user can
access it and add a new completion type flag to the CommandScriptAdd
Command Object.

So now, the user can specify which completion type will be used with
their custom command, when they register it.

This also makes the `crashlog` custom commands use disk-file completion
type, to browse through the user file system and load the report.

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

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>

show more ...


Revision tags: llvmorg-16.0.5
# 061a8390 24-May-2023 Dave Lee <davelee.com@gmail.com>

[lldb] Prevent dwim-print from showing kNoResult error

Expression evaluation for `void` valued expressions sets an error using the `kNoResult`
code. Like the `expression` command, `dwim-print` shoul

[lldb] Prevent dwim-print from showing kNoResult error

Expression evaluation for `void` valued expressions sets an error using the `kNoResult`
code. Like the `expression` command, `dwim-print` should also not print such errors.

Before:

```
(lldb) dwim-print (void)printf("hi\n")
hi
Error: 'unknown error'
```

After:

```
(lldb) dwim-print (void)printf("hi\n")
hi
```

rdar://109746544

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

show more ...


Revision tags: llvmorg-16.0.4
# db814552 15-May-2023 Dave Lee <davelee.com@gmail.com>

[lldb] Delay removal of persistent results

Follow up to "Suppress persistent result when running po" (D144044).

This change delays removal of the persistent result until after `Dump` has been calle

[lldb] Delay removal of persistent results

Follow up to "Suppress persistent result when running po" (D144044).

This change delays removal of the persistent result until after `Dump` has been called.
In doing so, the persistent result is available for the purpose of getting its object
description.

In the original change, the persistent result removal happens indirectly, by setting
`EvaluateExpressionOptions::SetSuppressPersistentResult`. In practice this has worked,
however this exposed a latent bug in swift-lldb. The subtlety, and the bug, depend on
when the persisteted result variable is removed.

When the result is removed via `SetSuppressPersistentResult`, it happens within the call
to `Target::EvaluateExpression`. That is, by the time the call returns, the persistent
result is already removed.

The issue occurs shortly thereafter, when `ValueObject::Dump` is called, it cannot make
use of the persistent result variable (instead it uses the `ValueObjectConstResult`). In
swift-lldb, this causes an additional expression evaluation to happen. It first tries an
expression that reference `$R0` etc, but that always fails because `$R0` is removed. The
fallback to this failure does work most of the time, but there's at least one bug
involving imported Clang types.

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

show more ...


12