CommandObjectDisassemble.h revision 314564
1//===-- CommandObjectDisassemble.h ------------------------------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef liblldb_CommandObjectDisassemble_h_
11#define liblldb_CommandObjectDisassemble_h_
12
13// C Includes
14// C++ Includes
15// Other libraries and framework includes
16// Project includes
17#include "lldb/Core/ArchSpec.h"
18#include "lldb/Interpreter/CommandObject.h"
19#include "lldb/Interpreter/Options.h"
20
21namespace lldb_private {
22
23//-------------------------------------------------------------------------
24// CommandObjectDisassemble
25//-------------------------------------------------------------------------
26
27class CommandObjectDisassemble : public CommandObjectParsed {
28public:
29  class CommandOptions : public Options {
30  public:
31    CommandOptions();
32
33    ~CommandOptions() override;
34
35    Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
36                         ExecutionContext *execution_context) override;
37
38    void OptionParsingStarting(ExecutionContext *execution_context) override;
39
40    llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
41
42    const char *GetPluginName() {
43      return (plugin_name.empty() ? nullptr : plugin_name.c_str());
44    }
45
46    const char *GetFlavorString() {
47      if (flavor_string.empty() || flavor_string == "default")
48        return nullptr;
49      return flavor_string.c_str();
50    }
51
52    Error OptionParsingFinished(ExecutionContext *execution_context) override;
53
54    bool show_mixed; // Show mixed source/assembly
55    bool show_bytes;
56    uint32_t num_lines_context;
57    uint32_t num_instructions;
58    bool raw;
59    std::string func_name;
60    bool current_function;
61    lldb::addr_t start_addr;
62    lldb::addr_t end_addr;
63    bool at_pc;
64    bool frame_line;
65    std::string plugin_name;
66    std::string flavor_string;
67    ArchSpec arch;
68    bool some_location_specified; // If no location was specified, we'll select
69                                  // "at_pc".  This should be set
70    // in SetOptionValue if anything the selects a location is set.
71    lldb::addr_t symbol_containing_addr;
72    static OptionDefinition g_option_table[];
73  };
74
75  CommandObjectDisassemble(CommandInterpreter &interpreter);
76
77  ~CommandObjectDisassemble() override;
78
79  Options *GetOptions() override { return &m_options; }
80
81protected:
82  bool DoExecute(Args &command, CommandReturnObject &result) override;
83
84  CommandOptions m_options;
85};
86
87} // namespace lldb_private
88
89#endif // liblldb_CommandObjectDisassemble_h_
90