llvm-project/lldb/source/Commands/CMakeLists.txt
Dave Lee 185d4964a1 [lldb] Introduce dwim-print command
Implements `dwim-print`, a printing command that chooses the most direct,
efficient, and resilient means of printing a given expression.

DWIM is an acronym for Do What I Mean. From Wikipedia, DWIM is described as:

  > attempt to anticipate what users intend to do, correcting trivial errors
  > automatically rather than blindly executing users' explicit but
  > potentially incorrect input

The `dwim-print` command serves as a single print command for users who don't
yet know, or prefer not to know, the various lldb commands that can be used to
print, and when to use them.

This initial implementation is the base foundation for `dwim-print`. It accepts
no flags, only an expression. If the expression is the name of a variable in
the frame, then effectively `frame variable` is used to get, and print, its
value. Otherwise, printing falls back to using `expression` evaluation. In this
initial version, frame variable paths will be handled with `expression`.

Following this, there are a number of improvements that can be made. Some
improvements include supporting `frame variable` expressions or registers.

To provide transparency, especially as the `dwim-print` command evolves, a new
setting is also introduced: `dwim-print-verbosity`. This setting instructs
`dwim-print` to optionally print a message showing the effective command being
run. For example `dwim-print var.meth()` can print a message such as: "note:
ran `expression var.meth()`".

See https://discourse.llvm.org/t/dwim-print-command/66078 for the proposal and
discussion.

Differential Revision: https://reviews.llvm.org/D138315
2022-11-29 12:46:20 -08:00

62 lines
1.4 KiB
CMake

lldb_tablegen(CommandOptions.inc -gen-lldb-option-defs
SOURCE Options.td
TARGET LLDBOptionsGen)
add_lldb_library(lldbCommands
CommandCompletions.cpp
CommandObjectApropos.cpp
CommandObjectBreakpoint.cpp
CommandObjectBreakpointCommand.cpp
CommandObjectCommands.cpp
CommandObjectDiagnostics.cpp
CommandObjectDisassemble.cpp
CommandObjectDWIMPrint.cpp
CommandObjectExpression.cpp
CommandObjectFrame.cpp
CommandObjectGUI.cpp
CommandObjectHelp.cpp
CommandObjectLanguage.cpp
CommandObjectLog.cpp
CommandObjectMemory.cpp
CommandObjectMemoryTag.cpp
CommandObjectMultiword.cpp
CommandObjectPlatform.cpp
CommandObjectPlugin.cpp
CommandObjectProcess.cpp
CommandObjectQuit.cpp
CommandObjectRegexCommand.cpp
CommandObjectRegister.cpp
CommandObjectScript.cpp
CommandObjectSession.cpp
CommandObjectSettings.cpp
CommandObjectSource.cpp
CommandObjectStats.cpp
CommandObjectTarget.cpp
CommandObjectThread.cpp
CommandObjectThreadUtil.cpp
CommandObjectTrace.cpp
CommandObjectType.cpp
CommandObjectVersion.cpp
CommandObjectWatchpoint.cpp
CommandObjectWatchpointCommand.cpp
CommandOptionArgumentTable.cpp
CommandOptionsProcessLaunch.cpp
LINK_LIBS
lldbBreakpoint
lldbCore
lldbDataFormatters
lldbExpression
lldbHost
lldbInterpreter
lldbSymbol
lldbTarget
lldbUtility
lldbVersion
LINK_COMPONENTS
Support
)
add_dependencies(lldbCommands LLDBOptionsGen)