2010-06-09 00:52:24 +08:00
|
|
|
//===-- CommandObjectExpression.h -------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef liblldb_CommandObjectExpression_h_
|
|
|
|
#define liblldb_CommandObjectExpression_h_
|
|
|
|
|
|
|
|
// C Includes
|
|
|
|
// C++ Includes
|
|
|
|
// Other libraries and framework includes
|
|
|
|
// Project includes
|
2016-03-25 09:57:14 +08:00
|
|
|
#include "lldb/lldb-private-enumerations.h"
|
2014-01-28 07:43:24 +08:00
|
|
|
#include "lldb/Core/IOHandler.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Interpreter/CommandObject.h"
|
2015-10-20 08:55:21 +08:00
|
|
|
#include "lldb/Interpreter/OptionGroupBoolean.h"
|
2011-10-25 14:44:01 +08:00
|
|
|
#include "lldb/Interpreter/OptionGroupFormat.h"
|
2013-01-10 04:12:53 +08:00
|
|
|
#include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Target/ExecutionContext.h"
|
|
|
|
namespace lldb_private {
|
|
|
|
|
2014-01-28 07:43:24 +08:00
|
|
|
class CommandObjectExpression :
|
|
|
|
public CommandObjectRaw,
|
|
|
|
public IOHandlerDelegate
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2011-10-25 14:44:01 +08:00
|
|
|
class CommandOptions : public OptionGroup
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2011-10-25 14:44:01 +08:00
|
|
|
CommandOptions ();
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2015-09-02 17:33:09 +08:00
|
|
|
~CommandOptions() override;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2015-09-02 17:33:09 +08:00
|
|
|
uint32_t
|
|
|
|
GetNumDefinitions() override;
|
2011-10-25 14:44:01 +08:00
|
|
|
|
2015-09-02 17:33:09 +08:00
|
|
|
const OptionDefinition*
|
|
|
|
GetDefinitions() override;
|
2011-10-25 14:44:01 +08:00
|
|
|
|
2015-09-02 17:33:09 +08:00
|
|
|
Error
|
2016-08-12 07:51:28 +08:00
|
|
|
SetOptionValue(uint32_t option_idx,
|
|
|
|
const char *option_value,
|
|
|
|
ExecutionContext *execution_context) override;
|
2011-10-25 14:44:01 +08:00
|
|
|
|
2015-09-02 17:33:09 +08:00
|
|
|
void
|
2016-08-12 07:51:28 +08:00
|
|
|
OptionParsingStarting(ExecutionContext *execution_context) override;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
// Options table: Required for subclasses of Options.
|
|
|
|
|
2011-03-25 05:19:54 +08:00
|
|
|
static OptionDefinition g_option_table[];
|
2016-03-29 05:20:05 +08:00
|
|
|
bool top_level;
|
2010-11-06 03:25:48 +08:00
|
|
|
bool unwind_on_error;
|
2013-01-15 10:47:48 +08:00
|
|
|
bool ignore_breakpoints;
|
2016-05-13 04:00:53 +08:00
|
|
|
bool allow_jit;
|
2010-06-09 00:52:24 +08:00
|
|
|
bool show_types;
|
|
|
|
bool show_summary;
|
2013-11-05 03:35:17 +08:00
|
|
|
bool debug;
|
2012-10-17 05:41:58 +08:00
|
|
|
uint32_t timeout;
|
|
|
|
bool try_all_threads;
|
2015-07-25 08:19:39 +08:00
|
|
|
lldb::LanguageType language;
|
<rdar://problem/14393032>
DumpValueObject() 2.0
This checkin restores pre-Xcode5 functionality to the "po" (expr -O) command:
- expr now has a new --description-verbosity (-v) argument, which takes either compact or full as a value (-v is the same as -vfull)
When the full mode is on, "po" will show the extended output with type name, persistent variable name and value, as in
(lldb) expr -O -v -- foo
(id) $0 = 0x000000010010baf0 {
1 = 2;
2 = 3;
}
When -v is omitted, or -vcompact is passed, the Xcode5-style output will be shown, as in
(lldb) expr -O -- foo
{
1 = 2;
2 = 3;
}
- for a non-ObjectiveC object, LLDB will still try to retrieve a summary and/or value to display
(lldb) po 5
5
-v also works in this mode
(lldb) expr -O -vfull -- 5
(int) $4 = 5
On top of that, this is a major refactoring of the ValueObject printing code. The functionality is now factored into a ValueObjectPrinter class for easier maintenance in the future
DumpValueObject() was turned into an instance method ValueObject::Dump() which simply calls through to the printer code, Dump_Impl has been removed
Test case to follow
llvm-svn: 191694
2013-10-01 03:11:51 +08:00
|
|
|
LanguageRuntimeDescriptionDisplayVerbosity m_verbosity;
|
2016-03-25 09:57:14 +08:00
|
|
|
LazyBool auto_apply_fixits;
|
2010-06-09 00:52:24 +08:00
|
|
|
};
|
|
|
|
|
2010-09-18 09:14:36 +08:00
|
|
|
CommandObjectExpression (CommandInterpreter &interpreter);
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2015-09-02 17:33:09 +08:00
|
|
|
~CommandObjectExpression() override;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
Options *
|
2015-09-02 17:33:09 +08:00
|
|
|
GetOptions() override;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
protected:
|
2014-01-28 07:43:24 +08:00
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
// IOHandler::Delegate functions
|
|
|
|
//------------------------------------------------------------------
|
2015-09-02 17:33:09 +08:00
|
|
|
void
|
|
|
|
IOHandlerInputComplete(IOHandler &io_handler,
|
|
|
|
std::string &line) override;
|
2016-05-10 05:13:27 +08:00
|
|
|
|
|
|
|
bool
|
|
|
|
IOHandlerIsInputComplete (IOHandler &io_handler,
|
|
|
|
StringList &lines) override;
|
|
|
|
|
2015-09-02 17:33:09 +08:00
|
|
|
bool
|
|
|
|
DoExecute(const char *command,
|
|
|
|
CommandReturnObject &result) override;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
bool
|
2010-08-13 08:42:30 +08:00
|
|
|
EvaluateExpression (const char *expr,
|
2011-06-14 04:20:29 +08:00
|
|
|
Stream *output_stream,
|
|
|
|
Stream *error_stream,
|
2010-08-13 08:42:30 +08:00
|
|
|
CommandReturnObject *result = NULL);
|
2014-03-14 07:42:30 +08:00
|
|
|
|
|
|
|
void
|
|
|
|
GetMultilineExpression ();
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2011-10-25 14:44:01 +08:00
|
|
|
OptionGroupOptions m_option_group;
|
|
|
|
OptionGroupFormat m_format_options;
|
2013-01-10 04:12:53 +08:00
|
|
|
OptionGroupValueObjectDisplay m_varobj_options;
|
2015-10-20 08:55:21 +08:00
|
|
|
OptionGroupBoolean m_repl_option;
|
2011-10-25 14:44:01 +08:00
|
|
|
CommandOptions m_command_options;
|
2010-06-09 00:52:24 +08:00
|
|
|
uint32_t m_expr_line_count;
|
|
|
|
std::string m_expr_lines; // Multi-line expression support
|
2016-03-30 06:00:08 +08:00
|
|
|
std::string m_fixed_expression; // Holds the current expression's fixed text.
|
2010-06-09 00:52:24 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace lldb_private
|
|
|
|
|
2015-09-02 17:33:09 +08:00
|
|
|
#endif // liblldb_CommandObjectExpression_h_
|