blob: 04c4cc247ee98d098f0ff39eb7ddfe1b74d690ae [file] [log] [blame]
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001//===-- 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
Chris Lattner30fdc8d2010-06-08 16:52:24 +000013#include "lldb/Interpreter/CommandObject.h"
Jim Ingham40af72e2010-06-15 19:49:27 +000014#include "lldb/Interpreter/Options.h"
Pavel Labath5f19b902017-11-13 16:16:33 +000015#include "lldb/Utility/ArchSpec.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000016
17namespace lldb_private {
18
19//-------------------------------------------------------------------------
20// CommandObjectDisassemble
21//-------------------------------------------------------------------------
22
Kate Stoneb9c1b512016-09-06 20:57:50 +000023class CommandObjectDisassemble : public CommandObjectParsed {
Chris Lattner30fdc8d2010-06-08 16:52:24 +000024public:
Kate Stoneb9c1b512016-09-06 20:57:50 +000025 class CommandOptions : public Options {
26 public:
27 CommandOptions();
Chris Lattner30fdc8d2010-06-08 16:52:24 +000028
Kate Stoneb9c1b512016-09-06 20:57:50 +000029 ~CommandOptions() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000030
Zachary Turner97206d52017-05-12 04:51:55 +000031 Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
32 ExecutionContext *execution_context) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000033
Kate Stoneb9c1b512016-09-06 20:57:50 +000034 void OptionParsingStarting(ExecutionContext *execution_context) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000035
Zachary Turner1f0f5b52016-09-22 20:22:55 +000036 llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000037
Kate Stoneb9c1b512016-09-06 20:57:50 +000038 const char *GetPluginName() {
39 return (plugin_name.empty() ? nullptr : plugin_name.c_str());
Chris Lattner30fdc8d2010-06-08 16:52:24 +000040 }
41
Kate Stoneb9c1b512016-09-06 20:57:50 +000042 const char *GetFlavorString() {
43 if (flavor_string.empty() || flavor_string == "default")
44 return nullptr;
45 return flavor_string.c_str();
46 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +000047
Zachary Turner97206d52017-05-12 04:51:55 +000048 Status OptionParsingFinished(ExecutionContext *execution_context) override;
Kate Stoneb9c1b512016-09-06 20:57:50 +000049
50 bool show_mixed; // Show mixed source/assembly
51 bool show_bytes;
52 uint32_t num_lines_context;
53 uint32_t num_instructions;
54 bool raw;
55 std::string func_name;
56 bool current_function;
57 lldb::addr_t start_addr;
58 lldb::addr_t end_addr;
59 bool at_pc;
60 bool frame_line;
61 std::string plugin_name;
62 std::string flavor_string;
63 ArchSpec arch;
64 bool some_location_specified; // If no location was specified, we'll select
65 // "at_pc". This should be set
66 // in SetOptionValue if anything the selects a location is set.
67 lldb::addr_t symbol_containing_addr;
Kate Stoneb9c1b512016-09-06 20:57:50 +000068 };
69
70 CommandObjectDisassemble(CommandInterpreter &interpreter);
71
72 ~CommandObjectDisassemble() override;
73
74 Options *GetOptions() override { return &m_options; }
75
76protected:
77 bool DoExecute(Args &command, CommandReturnObject &result) override;
78
79 CommandOptions m_options;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000080};
81
82} // namespace lldb_private
83
Pavel Labath1fb7e202015-09-02 09:33:09 +000084#endif // liblldb_CommandObjectDisassemble_h_