1 | //===-- CommandObjectDWIMPrint.h --------------------------------*- C++ -*-===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #ifndef LLDB_SOURCE_COMMANDS_COMMANDOBJECTDWIMPRINT_H |
10 | #define LLDB_SOURCE_COMMANDS_COMMANDOBJECTDWIMPRINT_H |
11 | |
12 | #include "CommandObjectExpression.h" |
13 | #include "lldb/Interpreter/CommandObject.h" |
14 | #include "lldb/Interpreter/OptionGroupFormat.h" |
15 | #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h" |
16 | #include "lldb/Interpreter/OptionValueFormat.h" |
17 | |
18 | namespace lldb_private { |
19 | |
20 | /// Implements `dwim-print`, a printing command that chooses the most direct, |
21 | /// efficient, and resilient means of printing a given expression. |
22 | /// |
23 | /// DWIM is an acronym for Do What I Mean. From Wikipedia, DWIM is described as: |
24 | /// |
25 | /// > attempt to anticipate what users intend to do, correcting trivial errors |
26 | /// > automatically rather than blindly executing users' explicit but |
27 | /// > potentially incorrect input |
28 | /// |
29 | /// The `dwim-print` command serves as a single print command for users who |
30 | /// don't yet know, or perfer not to know, the various lldb commands that can be |
31 | /// used to print, and when to use them. |
32 | class CommandObjectDWIMPrint : public CommandObjectRaw { |
33 | public: |
34 | CommandObjectDWIMPrint(CommandInterpreter &interpreter); |
35 | |
36 | ~CommandObjectDWIMPrint() override = default; |
37 | |
38 | Options *GetOptions() override; |
39 | |
40 | bool WantsCompletion() override { return true; } |
41 | |
42 | private: |
43 | void DoExecute(llvm::StringRef command, CommandReturnObject &result) override; |
44 | |
45 | OptionGroupOptions m_option_group; |
46 | OptionGroupFormat m_format_options = lldb::eFormatDefault; |
47 | OptionGroupValueObjectDisplay m_varobj_options; |
48 | CommandObjectExpression::CommandOptions m_expr_options; |
49 | }; |
50 | |
51 | } // namespace lldb_private |
52 | |
53 | #endif |
54 | |