LLDB  mainline
CommandObjectDisassemble.h
Go to the documentation of this file.
1 //===-- CommandObjectDisassemble.h ------------------------------*- C++ -*-===//
2 //
3 // 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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_SOURCE_COMMANDS_COMMANDOBJECTDISASSEMBLE_H
10 #define LLDB_SOURCE_COMMANDS_COMMANDOBJECTDISASSEMBLE_H
11 
14 #include "lldb/Utility/ArchSpec.h"
15 
16 namespace lldb_private {
17 
18 // CommandObjectDisassemble
19 
21 public:
22  class CommandOptions : public Options {
23  public:
25 
26  ~CommandOptions() override;
27 
28  Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
29  ExecutionContext *execution_context) override;
30 
31  void OptionParsingStarting(ExecutionContext *execution_context) override;
32 
33  llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
34 
35  const char *GetPluginName() {
36  return (plugin_name.empty() ? nullptr : plugin_name.c_str());
37  }
38 
39  const char *GetFlavorString() {
40  if (flavor_string.empty() || flavor_string == "default")
41  return nullptr;
42  return flavor_string.c_str();
43  }
44 
45  Status OptionParsingFinished(ExecutionContext *execution_context) override;
46 
47  bool show_mixed; // Show mixed source/assembly
48  bool show_bytes;
51  bool raw;
53  bool current_function = false;
56  bool at_pc = false;
57  bool frame_line = false;
61  bool some_location_specified = false; // If no location was specified, we'll
62  // select "at_pc". This should be set
63  // in SetOptionValue if anything the selects a location is set.
65  bool force = false;
66  };
67 
69 
70  ~CommandObjectDisassemble() override;
71 
72  Options *GetOptions() override { return &m_options; }
73 
74 protected:
75  bool DoExecute(Args &command, CommandReturnObject &result) override;
76 
77  llvm::Expected<std::vector<AddressRange>>
79 
80  llvm::Expected<std::vector<AddressRange>> GetContainingAddressRanges();
81  llvm::Expected<std::vector<AddressRange>> GetCurrentFunctionRanges();
82  llvm::Expected<std::vector<AddressRange>> GetCurrentLineRanges();
83  llvm::Expected<std::vector<AddressRange>>
85  llvm::Expected<std::vector<AddressRange>> GetPCRanges();
86  llvm::Expected<std::vector<AddressRange>> GetStartEndAddressRanges();
87 
88  llvm::Error CheckRangeSize(const AddressRange &range, llvm::StringRef what);
89 
91 };
92 
93 } // namespace lldb_private
94 
95 #endif // LLDB_SOURCE_COMMANDS_COMMANDOBJECTDISASSEMBLE_H
lldb_private::CommandObjectParsed
Definition: CommandObject.h:378
lldb_private::ExecutionContext
Definition: ExecutionContext.h:292
lldb_private::CommandObjectDisassemble::CommandOptions::OptionParsingStarting
void OptionParsingStarting(ExecutionContext *execution_context) override
Definition: CommandObjectDisassemble.cpp:154
lldb_private::CommandObjectDisassemble::CommandOptions::end_addr
lldb::addr_t end_addr
Definition: CommandObjectDisassemble.h:55
lldb_private::ArchSpec
Definition: ArchSpec.h:33
lldb_private::CommandObjectDisassemble::CommandOptions::OptionParsingFinished
Status OptionParsingFinished(ExecutionContext *execution_context) override
Definition: CommandObjectDisassemble.cpp:193
lldb_private::CommandObjectDisassemble::CommandOptions::num_instructions
uint32_t num_instructions
Definition: CommandObjectDisassemble.h:50
lldb_private::CommandObjectDisassemble::CommandObjectDisassemble
CommandObjectDisassemble(CommandInterpreter &interpreter)
Definition: CommandObjectDisassemble.cpp:207
lldb_private::CommandObjectDisassemble::GetOptions
Options * GetOptions() override
Definition: CommandObjectDisassemble.h:72
lldb_private::CommandObjectDisassemble::CommandOptions::frame_line
bool frame_line
Definition: CommandObjectDisassemble.h:57
lldb_private::CommandObjectDisassemble
Definition: CommandObjectDisassemble.h:20
lldb_private::CommandObjectDisassemble::CommandOptions::func_name
std::string func_name
Definition: CommandObjectDisassemble.h:52
lldb_private::CommandObjectDisassemble::CommandOptions::arch
ArchSpec arch
Definition: CommandObjectDisassemble.h:60
lldb_private::CommandObjectDisassemble::CommandOptions::SetOptionValue
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override
Set the value of an option.
Definition: CommandObjectDisassemble.cpp:40
lldb_private::Args
Definition: Args.h:33
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::CommandObjectDisassemble::GetCurrentFunctionRanges
llvm::Expected< std::vector< AddressRange > > GetCurrentFunctionRanges()
Definition: CommandObjectDisassemble.cpp:281
lldb_private::CommandObjectDisassemble::CommandOptions::GetFlavorString
const char * GetFlavorString()
Definition: CommandObjectDisassemble.h:39
lldb_private::CommandObjectDisassemble::GetCurrentLineRanges
llvm::Expected< std::vector< AddressRange > > GetCurrentLineRanges()
Definition: CommandObjectDisassemble.cpp:304
lldb_private::CommandObjectDisassemble::GetStartEndAddressRanges
llvm::Expected< std::vector< AddressRange > > GetStartEndAddressRanges()
Definition: CommandObjectDisassemble.cpp:381
lldb_private::CommandObjectDisassemble::CommandOptions::show_mixed
bool show_mixed
Definition: CommandObjectDisassemble.h:47
Options.h
lldb_private::Options
Definition: Options.h:57
lldb_private::CommandObjectDisassemble::CommandOptions::force
bool force
Definition: CommandObjectDisassemble.h:65
lldb_private::CommandObjectDisassemble::GetContainingAddressRanges
llvm::Expected< std::vector< AddressRange > > GetContainingAddressRanges()
Definition: CommandObjectDisassemble.cpp:235
lldb_private::CommandObjectDisassemble::~CommandObjectDisassemble
~CommandObjectDisassemble() override
lldb_private::CommandObjectDisassemble::CommandOptions::at_pc
bool at_pc
Definition: CommandObjectDisassemble.h:56
lldb_private::AddressRange
Definition: AddressRange.h:25
lldb_private::CommandObjectDisassemble::CommandOptions::plugin_name
std::string plugin_name
Definition: CommandObjectDisassemble.h:58
lldb_private::CommandInterpreter
Definition: CommandInterpreter.h:214
lldb_private::CommandObjectDisassemble::CommandOptions::symbol_containing_addr
lldb::addr_t symbol_containing_addr
Definition: CommandObjectDisassemble.h:64
lldb_private::CommandObjectDisassemble::CommandOptions::CommandOptions
CommandOptions()
Definition: CommandObjectDisassemble.cpp:33
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:39
lldb_private::CommandObjectDisassemble::GetPCRanges
llvm::Expected< std::vector< AddressRange > > GetPCRanges()
Definition: CommandObjectDisassemble.cpp:364
lldb_private::CommandObjectDisassemble::GetRangesForSelectedMode
llvm::Expected< std::vector< AddressRange > > GetRangesForSelectedMode(CommandReturnObject &result)
Definition: CommandObjectDisassemble.cpp:394
lldb_private::CommandObjectDisassemble::CommandOptions::num_lines_context
uint32_t num_lines_context
Definition: CommandObjectDisassemble.h:49
lldb_private::CommandObjectDisassemble::GetNameRanges
llvm::Expected< std::vector< AddressRange > > GetNameRanges(CommandReturnObject &result)
Definition: CommandObjectDisassemble.cpp:323
lldb_private::Status
Definition: Status.h:44
lldb_private::CommandReturnObject
Definition: CommandReturnObject.h:25
uint32_t
lldb_private::CommandObjectDisassemble::CommandOptions::GetDefinitions
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
Definition: CommandObjectDisassemble.cpp:201
lldb_private::CommandObjectDisassemble::DoExecute
bool DoExecute(Args &command, CommandReturnObject &result) override
Definition: CommandObjectDisassemble.cpp:409
CommandObject.h
lldb_private::CommandObjectDisassemble::CheckRangeSize
llvm::Error CheckRangeSize(const AddressRange &range, llvm::StringRef what)
Definition: CommandObjectDisassemble.cpp:219
ArchSpec.h
lldb_private::CommandObjectDisassemble::CommandOptions::flavor_string
std::string flavor_string
Definition: CommandObjectDisassemble.h:59
lldb_private::CommandObjectDisassemble::CommandOptions::show_bytes
bool show_bytes
Definition: CommandObjectDisassemble.h:48
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::CommandObjectDisassemble::CommandOptions::GetPluginName
const char * GetPluginName()
Definition: CommandObjectDisassemble.h:35
Error
llvm::Error Error
Definition: UdtRecordCompleter.cpp:29
lldb_private::CommandObjectDisassemble::CommandOptions::~CommandOptions
~CommandOptions() override
lldb_private::CommandObjectDisassemble::CommandOptions::raw
bool raw
Definition: CommandObjectDisassemble.h:51
lldb_private::CommandObjectDisassemble::CommandOptions::start_addr
lldb::addr_t start_addr
Definition: CommandObjectDisassemble.h:54
lldb_private::CommandObjectDisassemble::m_options
CommandOptions m_options
Definition: CommandObjectDisassemble.h:90
lldb_private::CommandObjectDisassemble::CommandOptions::current_function
bool current_function
Definition: CommandObjectDisassemble.h:53
lldb_private::CommandObjectDisassemble::CommandOptions
Definition: CommandObjectDisassemble.h:22
lldb_private::CommandObjectDisassemble::CommandOptions::some_location_specified
bool some_location_specified
Definition: CommandObjectDisassemble.h:61