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 
21 namespace lldb_private {
22 
23 //-------------------------------------------------------------------------
24 // CommandObjectDisassemble
25 //-------------------------------------------------------------------------
26 
27 class CommandObjectDisassemble : public CommandObjectParsed
28 {
29 public:
30     class CommandOptions : public Options
31     {
32     public:
33 
34         CommandOptions (CommandInterpreter &interpreter);
35 
36         ~CommandOptions() override;
37 
38         Error
39         SetOptionValue(uint32_t option_idx, const char *option_arg) override;
40 
41         void
42         OptionParsingStarting() override;
43 
44         const OptionDefinition*
45         GetDefinitions() override;
46 
47         const char *
48         GetPluginName ()
49         {
50             if (plugin_name.empty())
51                 return NULL;
52             return plugin_name.c_str();
53         }
54 
55         const char *
56         GetFlavorString ()
57         {
58             if (flavor_string.empty() || flavor_string == "default")
59                 return NULL;
60             return flavor_string.c_str();
61         }
62 
63         Error
64         OptionParsingFinished() override;
65 
66         bool show_mixed; // Show mixed source/assembly
67         bool show_bytes;
68         uint32_t num_lines_context;
69         uint32_t num_instructions;
70         bool raw;
71         std::string func_name;
72         bool current_function;
73         lldb::addr_t start_addr;
74         lldb::addr_t end_addr;
75         bool at_pc;
76         bool frame_line;
77         std::string plugin_name;
78         std::string flavor_string;
79         ArchSpec arch;
80         bool some_location_specified; // If no location was specified, we'll select "at_pc".  This should be set
81                                       // in SetOptionValue if anything the selects a location is set.
82         lldb::addr_t symbol_containing_addr;
83         static OptionDefinition g_option_table[];
84     };
85 
86     CommandObjectDisassemble (CommandInterpreter &interpreter);
87 
88     ~CommandObjectDisassemble() override;
89 
90     Options *
91     GetOptions() override
92     {
93         return &m_options;
94     }
95 
96 protected:
97     bool
98     DoExecute(Args& command,
99 	      CommandReturnObject &result) override;
100 
101     CommandOptions m_options;
102 };
103 
104 } // namespace lldb_private
105 
106 #endif // liblldb_CommandObjectDisassemble_h_
107