Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / source / Commands / CommandObjectDisassemble.h
blob2e4d46dd0ec5868d0baa65124eaaa327ff7e281c
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 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SOURCE_COMMANDS_COMMANDOBJECTDISASSEMBLE_H
10 #define LLDB_SOURCE_COMMANDS_COMMANDOBJECTDISASSEMBLE_H
12 #include "lldb/Interpreter/CommandObject.h"
13 #include "lldb/Interpreter/Options.h"
14 #include "lldb/Utility/ArchSpec.h"
16 namespace lldb_private {
18 // CommandObjectDisassemble
20 class CommandObjectDisassemble : public CommandObjectParsed {
21 public:
22 class CommandOptions : public Options {
23 public:
24 CommandOptions();
26 ~CommandOptions() override;
28 Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
29 ExecutionContext *execution_context) override;
31 void OptionParsingStarting(ExecutionContext *execution_context) override;
33 llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
35 const char *GetPluginName() {
36 return (plugin_name.empty() ? nullptr : plugin_name.c_str());
39 const char *GetFlavorString() {
40 if (flavor_string.empty() || flavor_string == "default")
41 return nullptr;
42 return flavor_string.c_str();
45 Status OptionParsingFinished(ExecutionContext *execution_context) override;
47 bool show_mixed; // Show mixed source/assembly
48 bool show_bytes;
49 bool show_control_flow_kind;
50 uint32_t num_lines_context = 0;
51 uint32_t num_instructions = 0;
52 bool raw;
53 std::string func_name;
54 bool current_function = false;
55 lldb::addr_t start_addr = 0;
56 lldb::addr_t end_addr = 0;
57 bool at_pc = false;
58 bool frame_line = false;
59 std::string plugin_name;
60 std::string flavor_string;
61 ArchSpec arch;
62 bool some_location_specified = false; // If no location was specified, we'll
63 // select "at_pc". This should be set
64 // in SetOptionValue if anything the selects a location is set.
65 lldb::addr_t symbol_containing_addr = 0;
66 bool force = false;
69 CommandObjectDisassemble(CommandInterpreter &interpreter);
71 ~CommandObjectDisassemble() override;
73 Options *GetOptions() override { return &m_options; }
75 protected:
76 void DoExecute(Args &command, CommandReturnObject &result) override;
78 llvm::Expected<std::vector<AddressRange>>
79 GetRangesForSelectedMode(CommandReturnObject &result);
81 llvm::Expected<std::vector<AddressRange>> GetContainingAddressRanges();
82 llvm::Expected<std::vector<AddressRange>> GetCurrentFunctionRanges();
83 llvm::Expected<std::vector<AddressRange>> GetCurrentLineRanges();
84 llvm::Expected<std::vector<AddressRange>>
85 GetNameRanges(CommandReturnObject &result);
86 llvm::Expected<std::vector<AddressRange>> GetPCRanges();
87 llvm::Expected<std::vector<AddressRange>> GetStartEndAddressRanges();
89 llvm::Error CheckRangeSize(const AddressRange &range, llvm::StringRef what);
91 CommandOptions m_options;
94 } // namespace lldb_private
96 #endif // LLDB_SOURCE_COMMANDS_COMMANDOBJECTDISASSEMBLE_H