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