jingham added a comment.

In D141425#4044280 <https://reviews.llvm.org/D141425#4044280>, @kastiglione 
wrote:

> @jingham The brief answer is that decisions have been based on compatibility 
> with the behavior of `p`.
>
> 1. `expression` (also `p`) and `frame variable`, only support the the format 
> part of gdb options. Neither support `--count` or `--size` and so don't 
> support the equivalent gdb options.
> 2. `p` takes no flags (other than the gdb-format), and `dwim-print` matches 
> that behavior.
>
> Taking the example of `dwim-print -fA variable`, if the user were to do the 
> same but with an expression, they'd have to write `dwim-print -fA -- 
> expression`. Will there be users who know and want the printing options you 
> mentioned (synthetic/raw, depth, etc) but who try to use those with 
> `dwim-print` instead of directly using `v` or `e`?
>
> My expectation has been that `dwim-print` would (1) generally not be used 
> directly, but be via an alias (either `p` or another choice) and that (2) for 
> compatibility, the alias would be `dwim-print --`.
>
> Thoughts?



1. I guess that sort of makes sense - since the results of `expr` & `frame var` 
are always typed, specifying sizes and counts doesn't make sense.  Those fields 
only make sense for `memory read`.  It makes the rationale for using gdb-format 
in the `/` accelerator a little less well motivated, but that's not on you...

2. To me the analogy between `p` and `dwim-print` is not the right one.  
`dwim-print` is parallel with `expr`: both are full featured commands from the 
standpoint of configuring the output printing.  `p` is the alias that we offer 
for user-convenience - it picks the defaults for the presentation.  This 
separation is nice because then if a user has a different set of default 
printing expectations (they always want to print pointers one level deep or 
something) they can re-alias `p` to fit their needs, or even make two variants 
that serve different purposes.

So I was expecting at first we'd add a `dp` or something alias, that was 
`dwim-print --` and in the fullness of time we would switch to it as the "first 
choice expression printer" by replacing the `p` -> `expr --` alias with 
`p`->`dwim-print --`, thus getting the same convenience AND configurability we 
got with `expr`...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141425/new/

https://reviews.llvm.org/D141425

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to