blob: f4d99a4b4d620b3596c70bd3c16d8d8654374285 [file] [log] [blame]
Chris Lattner30fdc8d2010-06-08 16:52:24 +00001//===-- CommandObjectDisassemble.h ------------------------------*- C++ -*-===//
2//
Chandler Carruth2946cd72019-01-19 08:50:56 +00003// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Chris Lattner30fdc8d2010-06-08 16:52:24 +00006//
7//===----------------------------------------------------------------------===//
8
9#ifndef liblldb_CommandObjectDisassemble_h_
10#define liblldb_CommandObjectDisassemble_h_
11
Chris Lattner30fdc8d2010-06-08 16:52:24 +000012#include "lldb/Interpreter/CommandObject.h"
Jim Ingham40af72e2010-06-15 19:49:27 +000013#include "lldb/Interpreter/Options.h"
Pavel Labath5f19b902017-11-13 16:16:33 +000014#include "lldb/Utility/ArchSpec.h"
Chris Lattner30fdc8d2010-06-08 16:52:24 +000015
16namespace lldb_private {
17
18//-------------------------------------------------------------------------
19// CommandObjectDisassemble
20//-------------------------------------------------------------------------
21
Kate Stoneb9c1b512016-09-06 20:57:50 +000022class CommandObjectDisassemble : public CommandObjectParsed {
Chris Lattner30fdc8d2010-06-08 16:52:24 +000023public:
Kate Stoneb9c1b512016-09-06 20:57:50 +000024 class CommandOptions : public Options {
25 public:
26 CommandOptions();
Chris Lattner30fdc8d2010-06-08 16:52:24 +000027
Kate Stoneb9c1b512016-09-06 20:57:50 +000028 ~CommandOptions() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000029
Zachary Turner97206d52017-05-12 04:51:55 +000030 Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
31 ExecutionContext *execution_context) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000032
Kate Stoneb9c1b512016-09-06 20:57:50 +000033 void OptionParsingStarting(ExecutionContext *execution_context) override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000034
Zachary Turner1f0f5b52016-09-22 20:22:55 +000035 llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000036
Kate Stoneb9c1b512016-09-06 20:57:50 +000037 const char *GetPluginName() {
38 return (plugin_name.empty() ? nullptr : plugin_name.c_str());
Chris Lattner30fdc8d2010-06-08 16:52:24 +000039 }
40
Kate Stoneb9c1b512016-09-06 20:57:50 +000041 const char *GetFlavorString() {
42 if (flavor_string.empty() || flavor_string == "default")
43 return nullptr;
44 return flavor_string.c_str();
45 }
Chris Lattner30fdc8d2010-06-08 16:52:24 +000046
Zachary Turner97206d52017-05-12 04:51:55 +000047 Status OptionParsingFinished(ExecutionContext *execution_context) override;
Kate Stoneb9c1b512016-09-06 20:57:50 +000048
49 bool show_mixed; // Show mixed source/assembly
50 bool show_bytes;
51 uint32_t num_lines_context;
52 uint32_t num_instructions;
53 bool raw;
54 std::string func_name;
55 bool current_function;
56 lldb::addr_t start_addr;
57 lldb::addr_t end_addr;
58 bool at_pc;
59 bool frame_line;
60 std::string plugin_name;
61 std::string flavor_string;
62 ArchSpec arch;
63 bool some_location_specified; // If no location was specified, we'll select
64 // "at_pc". This should be set
65 // in SetOptionValue if anything the selects a location is set.
66 lldb::addr_t symbol_containing_addr;
Kate Stoneb9c1b512016-09-06 20:57:50 +000067 };
68
69 CommandObjectDisassemble(CommandInterpreter &interpreter);
70
71 ~CommandObjectDisassemble() override;
72
73 Options *GetOptions() override { return &m_options; }
74
75protected:
76 bool DoExecute(Args &command, CommandReturnObject &result) override;
77
78 CommandOptions m_options;
Chris Lattner30fdc8d2010-06-08 16:52:24 +000079};
80
81} // namespace lldb_private
82
Pavel Labath1fb7e202015-09-02 09:33:09 +000083#endif // liblldb_CommandObjectDisassemble_h_