blob: 7a7509858b985ef09b8cf60b793964b46b41d3ee [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
36 virtual
37 ~CommandOptions ();
38
39 virtual Error
Greg Claytonf6b8b582011-04-13 00:18:08 +000040 SetOptionValue (uint32_t option_idx, const char *option_arg);
Chris Lattner30fdc8d2010-06-08 16:52:24 +000041
42 void
Greg Claytonf6b8b582011-04-13 00:18:08 +000043 OptionParsingStarting ();
Chris Lattner30fdc8d2010-06-08 16:52:24 +000044
Greg Claytone0d378b2011-03-24 21:19:54 +000045 const OptionDefinition*
Chris Lattner30fdc8d2010-06-08 16:52:24 +000046 GetDefinitions ();
47
Greg Clayton1080edbc2011-03-25 18:03:16 +000048 const char *
49 GetPluginName ()
50 {
Greg Clayton32e0a752011-03-30 18:16:51 +000051 if (plugin_name.empty())
Greg Clayton1080edbc2011-03-25 18:03:16 +000052 return NULL;
Greg Clayton32e0a752011-03-30 18:16:51 +000053 return plugin_name.c_str();
Greg Clayton1080edbc2011-03-25 18:03:16 +000054 }
55
Jim Ingham0f063ba2013-03-02 00:26:47 +000056 const char *
57 GetFlavorString ()
58 {
59 if (flavor_string.empty() || flavor_string == "default")
60 return NULL;
61 return flavor_string.c_str();
62 }
63
Jim Ingham3555b5d2011-09-01 01:11:04 +000064 virtual Error
65 OptionParsingFinished ();
Greg Clayton1080edbc2011-03-25 18:03:16 +000066
Chris Lattner30fdc8d2010-06-08 16:52:24 +000067 bool show_mixed; // Show mixed source/assembly
68 bool show_bytes;
69 uint32_t num_lines_context;
Jim Ingham37023b02011-03-22 01:48:42 +000070 uint32_t num_instructions;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000071 bool raw;
Greg Clayton32e0a752011-03-30 18:16:51 +000072 std::string func_name;
Greg Clayton1fb2e7d2012-12-14 22:36:35 +000073 bool current_function;
Greg Clayton32e0a752011-03-30 18:16:51 +000074 lldb::addr_t start_addr;
75 lldb::addr_t end_addr;
76 bool at_pc;
77 bool frame_line;
78 std::string plugin_name;
Jim Ingham0f063ba2013-03-02 00:26:47 +000079 std::string flavor_string;
Greg Clayton32e0a752011-03-30 18:16:51 +000080 ArchSpec arch;
Jim Ingham3555b5d2011-09-01 01:11:04 +000081 bool some_location_specified; // If no location was specified, we'll select "at_pc". This should be set
82 // in SetOptionValue if anything the selects a location is set.
Jason Molenda801237a2013-04-11 03:14:01 +000083 lldb::addr_t symbol_containing_addr;
Greg Claytone0d378b2011-03-24 21:19:54 +000084 static OptionDefinition g_option_table[];
Chris Lattner30fdc8d2010-06-08 16:52:24 +000085 };
86
Greg Claytona7015092010-09-18 01:14:36 +000087 CommandObjectDisassemble (CommandInterpreter &interpreter);
Chris Lattner30fdc8d2010-06-08 16:52:24 +000088
89 virtual
90 ~CommandObjectDisassemble ();
91
92 virtual
93 Options *
94 GetOptions ()
95 {
96 return &m_options;
97 }
98
Jim Ingham5a988412012-06-08 21:56:10 +000099protected:
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000100 virtual bool
Jim Ingham5a988412012-06-08 21:56:10 +0000101 DoExecute (Args& command,
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000102 CommandReturnObject &result);
103
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000104 CommandOptions m_options;
105
Chris Lattner30fdc8d2010-06-08 16:52:24 +0000106};
107
108} // namespace lldb_private
109
110#endif // liblldb_CommandObjectDisassemble_h_