blob: 7a7509858b985ef09b8cf60b793964b46b41d3ee [file] [log] [blame]
Chris Lattner24943d22010-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 Clayton49ce8962012-08-29 21:13:06 +000017#include "lldb/Core/ArchSpec.h"
Chris Lattner24943d22010-06-08 16:52:24 +000018#include "lldb/Interpreter/CommandObject.h"
Jim Ingham84cdc152010-06-15 19:49:27 +000019#include "lldb/Interpreter/Options.h"
Chris Lattner24943d22010-06-08 16:52:24 +000020
21namespace lldb_private {
22
23//-------------------------------------------------------------------------
24// CommandObjectDisassemble
25//-------------------------------------------------------------------------
26
Jim Inghamda26bd22012-06-08 21:56:10 +000027class CommandObjectDisassemble : public CommandObjectParsed
Chris Lattner24943d22010-06-08 16:52:24 +000028{
29public:
30 class CommandOptions : public Options
31 {
32 public:
33
Greg Claytonf15996e2011-04-07 22:46:35 +000034 CommandOptions (CommandInterpreter &interpreter);
Chris Lattner24943d22010-06-08 16:52:24 +000035
36 virtual
37 ~CommandOptions ();
38
39 virtual Error
Greg Clayton143fcc32011-04-13 00:18:08 +000040 SetOptionValue (uint32_t option_idx, const char *option_arg);
Chris Lattner24943d22010-06-08 16:52:24 +000041
42 void
Greg Clayton143fcc32011-04-13 00:18:08 +000043 OptionParsingStarting ();
Chris Lattner24943d22010-06-08 16:52:24 +000044
Greg Claytonb3448432011-03-24 21:19:54 +000045 const OptionDefinition*
Chris Lattner24943d22010-06-08 16:52:24 +000046 GetDefinitions ();
47
Greg Clayton149731c2011-03-25 18:03:16 +000048 const char *
49 GetPluginName ()
50 {
Greg Clayton24bc5d92011-03-30 18:16:51 +000051 if (plugin_name.empty())
Greg Clayton149731c2011-03-25 18:03:16 +000052 return NULL;
Greg Clayton24bc5d92011-03-30 18:16:51 +000053 return plugin_name.c_str();
Greg Clayton149731c2011-03-25 18:03:16 +000054 }
55
Jim Ingham7d408382013-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 Inghamd2ad7fd2011-09-01 01:11:04 +000064 virtual Error
65 OptionParsingFinished ();
Greg Clayton149731c2011-03-25 18:03:16 +000066
Chris Lattner24943d22010-06-08 16:52:24 +000067 bool show_mixed; // Show mixed source/assembly
68 bool show_bytes;
69 uint32_t num_lines_context;
Jim Inghamaa3e3e12011-03-22 01:48:42 +000070 uint32_t num_instructions;
Chris Lattner24943d22010-06-08 16:52:24 +000071 bool raw;
Greg Clayton24bc5d92011-03-30 18:16:51 +000072 std::string func_name;
Greg Clayton8d646f22012-12-14 22:36:35 +000073 bool current_function;
Greg Clayton24bc5d92011-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 Ingham7d408382013-03-02 00:26:47 +000079 std::string flavor_string;
Greg Clayton24bc5d92011-03-30 18:16:51 +000080 ArchSpec arch;
Jim Inghamd2ad7fd2011-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 Molenda9afae622013-04-11 03:14:01 +000083 lldb::addr_t symbol_containing_addr;
Greg Claytonb3448432011-03-24 21:19:54 +000084 static OptionDefinition g_option_table[];
Chris Lattner24943d22010-06-08 16:52:24 +000085 };
86
Greg Clayton238c0a12010-09-18 01:14:36 +000087 CommandObjectDisassemble (CommandInterpreter &interpreter);
Chris Lattner24943d22010-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 Inghamda26bd22012-06-08 21:56:10 +000099protected:
Chris Lattner24943d22010-06-08 16:52:24 +0000100 virtual bool
Jim Inghamda26bd22012-06-08 21:56:10 +0000101 DoExecute (Args& command,
Chris Lattner24943d22010-06-08 16:52:24 +0000102 CommandReturnObject &result);
103
Chris Lattner24943d22010-06-08 16:52:24 +0000104 CommandOptions m_options;
105
Chris Lattner24943d22010-06-08 16:52:24 +0000106};
107
108} // namespace lldb_private
109
110#endif // liblldb_CommandObjectDisassemble_h_