blob: af15d45eb76bcddc0a6e77a1615d86005503ef08 [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;
68 static OptionDefinition g_option_table[];
69 };
70
71 CommandObjectDisassemble(CommandInterpreter &interpreter);
72
73 ~CommandObjectDisassemble() override;
74
75 Options *GetOptions() override { return &m_options; }
76
77protected:
78 bool DoExecute(Args &command, CommandReturnObject &result) override;
79
80 CommandOptions m_options;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000081};
82
83} // namespace lldb_private
84
Pavel Labath1fb7e202015-09-02 09:33:09 +000085#endif // liblldb_CommandObjectDisassemble_h_