blob: d892824d017de81c3548b06de4f0a9c012ba5e3f [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:
33
Greg Claytoneb0103f2011-04-07 22:46:35 +000034 CommandOptions (CommandInterpreter &interpreter);
Chris Lattner30fdc8d2010-06-08 16:52:24 +000035
Pavel Labath1fb7e202015-09-02 09:33:09 +000036 ~CommandOptions() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000037
Pavel Labath1fb7e202015-09-02 09:33:09 +000038 Error
39 SetOptionValue(uint32_t option_idx, const char *option_arg) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000040
41 void
Pavel Labath1fb7e202015-09-02 09:33:09 +000042 OptionParsingStarting() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000043
Greg Claytone0d378b2011-03-24 21:19:54 +000044 const OptionDefinition*
Pavel Labath1fb7e202015-09-02 09:33:09 +000045 GetDefinitions() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000046
Greg Clayton1080edbc2011-03-25 18:03:16 +000047 const char *
48 GetPluginName ()
49 {
Greg Clayton32e0a752011-03-30 18:16:51 +000050 if (plugin_name.empty())
Greg Clayton1080edbc2011-03-25 18:03:16 +000051 return NULL;
Greg Clayton32e0a752011-03-30 18:16:51 +000052 return plugin_name.c_str();
Greg Clayton1080edbc2011-03-25 18:03:16 +000053 }
54
Jim Ingham0f063ba2013-03-02 00:26:47 +000055 const char *
56 GetFlavorString ()
57 {
58 if (flavor_string.empty() || flavor_string == "default")
59 return NULL;
60 return flavor_string.c_str();
61 }
62
Pavel Labath1fb7e202015-09-02 09:33:09 +000063 Error
64 OptionParsingFinished() override;
Greg Clayton1080edbc2011-03-25 18:03:16 +000065
Chris Lattner30fdc8d2010-06-08 16:52:24 +000066 bool show_mixed; // Show mixed source/assembly
67 bool show_bytes;
68 uint32_t num_lines_context;
Jim Ingham37023b02011-03-22 01:48:42 +000069 uint32_t num_instructions;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000070 bool raw;
Greg Clayton32e0a752011-03-30 18:16:51 +000071 std::string func_name;
Greg Clayton1fb2e7d2012-12-14 22:36:35 +000072 bool current_function;
Greg Clayton32e0a752011-03-30 18:16:51 +000073 lldb::addr_t start_addr;
74 lldb::addr_t end_addr;
75 bool at_pc;
76 bool frame_line;
77 std::string plugin_name;
Jim Ingham0f063ba2013-03-02 00:26:47 +000078 std::string flavor_string;
Greg Clayton32e0a752011-03-30 18:16:51 +000079 ArchSpec arch;
Jim Ingham3555b5d2011-09-01 01:11:04 +000080 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.
Jason Molenda801237a2013-04-11 03:14:01 +000082 lldb::addr_t symbol_containing_addr;
Greg Claytone0d378b2011-03-24 21:19:54 +000083 static OptionDefinition g_option_table[];
Chris Lattner30fdc8d2010-06-08 16:52:24 +000084 };
85
Greg Claytona7015092010-09-18 01:14:36 +000086 CommandObjectDisassemble (CommandInterpreter &interpreter);
Chris Lattner30fdc8d2010-06-08 16:52:24 +000087
Pavel Labath1fb7e202015-09-02 09:33:09 +000088 ~CommandObjectDisassemble() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000089
Chris Lattner30fdc8d2010-06-08 16:52:24 +000090 Options *
Pavel Labath1fb7e202015-09-02 09:33:09 +000091 GetOptions() override
Chris Lattner30fdc8d2010-06-08 16:52:24 +000092 {
93 return &m_options;
94 }
95
Jim Ingham5a988412012-06-08 21:56:10 +000096protected:
Pavel Labath1fb7e202015-09-02 09:33:09 +000097 bool
98 DoExecute(Args& command,
99 CommandReturnObject &result) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000100
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000101 CommandOptions m_options;
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000102};
103
104} // namespace lldb_private
105
Pavel Labath1fb7e202015-09-02 09:33:09 +0000106#endif // liblldb_CommandObjectDisassemble_h_