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 12*06c3fb27SDimitry Andric #include "CommandObjectExpression.h" 13bdd1243dSDimitry Andric #include "lldb/Interpreter/CommandObject.h" 14*06c3fb27SDimitry Andric #include "lldb/Interpreter/OptionGroupFormat.h" 15*06c3fb27SDimitry Andric #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h" 16*06c3fb27SDimitry 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 38*06c3fb27SDimitry Andric Options *GetOptions() override; 39*06c3fb27SDimitry Andric 40*06c3fb27SDimitry Andric bool WantsCompletion() override { return true; } 41*06c3fb27SDimitry Andric 42*06c3fb27SDimitry Andric void 43*06c3fb27SDimitry Andric HandleArgumentCompletion(CompletionRequest &request, 44*06c3fb27SDimitry Andric OptionElementVector &opt_element_vector) override; 45*06c3fb27SDimitry Andric 46bdd1243dSDimitry Andric private: 47bdd1243dSDimitry Andric bool DoExecute(llvm::StringRef command, CommandReturnObject &result) override; 48*06c3fb27SDimitry Andric 49*06c3fb27SDimitry Andric OptionGroupOptions m_option_group; 50*06c3fb27SDimitry Andric OptionGroupFormat m_format_options = lldb::eFormatDefault; 51*06c3fb27SDimitry Andric OptionGroupValueObjectDisplay m_varobj_options; 52*06c3fb27SDimitry Andric CommandObjectExpression::CommandOptions m_expr_options; 53bdd1243dSDimitry Andric }; 54bdd1243dSDimitry Andric 55bdd1243dSDimitry Andric } // namespace lldb_private 56bdd1243dSDimitry Andric 57bdd1243dSDimitry Andric #endif 58