blob: c60f70a3afee31e45ab7492fc2be58e0fb700600 [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
13// C Includes
14// C++ Includes
15// Other libraries and framework includes
16// Project includes
Greg Clayton1f746072012-08-29 21:13:06 +000017#include "lldb/Core/ArchSpec.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000018#include "lldb/Interpreter/CommandObject.h"
Jim Ingham40af72e2010-06-15 19:49:27 +000019#include "lldb/Interpreter/Options.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000020
21namespace lldb_private {
22
23//-------------------------------------------------------------------------
24// CommandObjectDisassemble
25//-------------------------------------------------------------------------
26
Kate Stoneb9c1b512016-09-06 20:57:50 +000027class CommandObjectDisassemble : public CommandObjectParsed {
Chris Lattner30fdc8d2010-06-08 16:52:24 +000028public:
Kate Stoneb9c1b512016-09-06 20:57:50 +000029 class CommandOptions : public Options {
30 public:
31 CommandOptions();
Chris Lattner30fdc8d2010-06-08 16:52:24 +000032
Kate Stoneb9c1b512016-09-06 20:57:50 +000033 ~CommandOptions() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000034
Kate Stoneb9c1b512016-09-06 20:57:50 +000035 Error SetOptionValue(uint32_t option_idx, const char *option_arg,
36 ExecutionContext *execution_context) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000037
Kate Stoneb9c1b512016-09-06 20:57:50 +000038 void OptionParsingStarting(ExecutionContext *execution_context) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000039
Zachary Turner1f0f5b52016-09-22 20:22:55 +000040 llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000041
Kate Stoneb9c1b512016-09-06 20:57:50 +000042 const char *GetPluginName() {
43 return (plugin_name.empty() ? nullptr : plugin_name.c_str());
Chris Lattner30fdc8d2010-06-08 16:52:24 +000044 }
45
Kate Stoneb9c1b512016-09-06 20:57:50 +000046 const char *GetFlavorString() {
47 if (flavor_string.empty() || flavor_string == "default")
48 return nullptr;
49 return flavor_string.c_str();
50 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +000051
Kate Stoneb9c1b512016-09-06 20:57:50 +000052 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;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000085};
86
87} // namespace lldb_private
88
Pavel Labath1fb7e202015-09-02 09:33:09 +000089#endif // liblldb_CommandObjectDisassemble_h_