blob: ef19b3cf316a16b263606e75a2675b0cdd321a36 [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
Jim Ingham5a988412012-06-08 21:56:10 +000027class CommandObjectDisassemble : public CommandObjectParsed
Chris Lattner30fdc8d2010-06-08 16:52:24 +000028{
29public:
30 class CommandOptions : public Options
31 {
32 public:
Greg Claytoneb0103f2011-04-07 22:46:35 +000033 CommandOptions (CommandInterpreter &interpreter);
Chris Lattner30fdc8d2010-06-08 16:52:24 +000034
Pavel Labath1fb7e202015-09-02 09:33:09 +000035 ~CommandOptions() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000036
Pavel Labath1fb7e202015-09-02 09:33:09 +000037 Error
38 SetOptionValue(uint32_t option_idx, const char *option_arg) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000039
40 void
Pavel Labath1fb7e202015-09-02 09:33:09 +000041 OptionParsingStarting() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000042
Greg Claytone0d378b2011-03-24 21:19:54 +000043 const OptionDefinition*
Pavel Labath1fb7e202015-09-02 09:33:09 +000044 GetDefinitions() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000045
Greg Clayton1080edbc2011-03-25 18:03:16 +000046 const char *
47 GetPluginName ()
48 {
Eugene Zelenko26cac3a2016-02-20 00:58:29 +000049 return (plugin_name.empty() ? nullptr : plugin_name.c_str());
Greg Clayton1080edbc2011-03-25 18:03:16 +000050 }
51
Jim Ingham0f063ba2013-03-02 00:26:47 +000052 const char *
53 GetFlavorString ()
54 {
55 if (flavor_string.empty() || flavor_string == "default")
Eugene Zelenko26cac3a2016-02-20 00:58:29 +000056 return nullptr;
Jim Ingham0f063ba2013-03-02 00:26:47 +000057 return flavor_string.c_str();
58 }
59
Pavel Labath1fb7e202015-09-02 09:33:09 +000060 Error
61 OptionParsingFinished() override;
Greg Clayton1080edbc2011-03-25 18:03:16 +000062
Chris Lattner30fdc8d2010-06-08 16:52:24 +000063 bool show_mixed; // Show mixed source/assembly
64 bool show_bytes;
65 uint32_t num_lines_context;
Jim Ingham37023b02011-03-22 01:48:42 +000066 uint32_t num_instructions;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000067 bool raw;
Greg Clayton32e0a752011-03-30 18:16:51 +000068 std::string func_name;
Greg Clayton1fb2e7d2012-12-14 22:36:35 +000069 bool current_function;
Greg Clayton32e0a752011-03-30 18:16:51 +000070 lldb::addr_t start_addr;
71 lldb::addr_t end_addr;
72 bool at_pc;
73 bool frame_line;
74 std::string plugin_name;
Jim Ingham0f063ba2013-03-02 00:26:47 +000075 std::string flavor_string;
Greg Clayton32e0a752011-03-30 18:16:51 +000076 ArchSpec arch;
Jim Ingham3555b5d2011-09-01 01:11:04 +000077 bool some_location_specified; // If no location was specified, we'll select "at_pc". This should be set
78 // in SetOptionValue if anything the selects a location is set.
Jason Molenda801237a2013-04-11 03:14:01 +000079 lldb::addr_t symbol_containing_addr;
Greg Claytone0d378b2011-03-24 21:19:54 +000080 static OptionDefinition g_option_table[];
Chris Lattner30fdc8d2010-06-08 16:52:24 +000081 };
82
Greg Claytona7015092010-09-18 01:14:36 +000083 CommandObjectDisassemble (CommandInterpreter &interpreter);
Chris Lattner30fdc8d2010-06-08 16:52:24 +000084
Pavel Labath1fb7e202015-09-02 09:33:09 +000085 ~CommandObjectDisassemble() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000086
Chris Lattner30fdc8d2010-06-08 16:52:24 +000087 Options *
Pavel Labath1fb7e202015-09-02 09:33:09 +000088 GetOptions() override
Chris Lattner30fdc8d2010-06-08 16:52:24 +000089 {
90 return &m_options;
91 }
92
Jim Ingham5a988412012-06-08 21:56:10 +000093protected:
Pavel Labath1fb7e202015-09-02 09:33:09 +000094 bool
95 DoExecute(Args& command,
96 CommandReturnObject &result) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000097
Chris Lattner30fdc8d2010-06-08 16:52:24 +000098 CommandOptions m_options;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000099};
100
101} // namespace lldb_private
102
Pavel Labath1fb7e202015-09-02 09:33:09 +0000103#endif // liblldb_CommandObjectDisassemble_h_