LLDB mainline
OptionGroupPlatform.h
Go to the documentation of this file.
1//===-- OptionGroupPlatform.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_INTERPRETER_OPTIONGROUPPLATFORM_H
10#define LLDB_INTERPRETER_OPTIONGROUPPLATFORM_H
11
14#include "llvm/Support/VersionTuple.h"
15
16namespace lldb_private {
17
18// PlatformOptionGroup
19//
20// Make platform options available to any commands that need the settings.
22public:
23 OptionGroupPlatform(bool include_platform_option)
24 : m_include_platform_option(include_platform_option) {}
25
26 ~OptionGroupPlatform() override = default;
27
28 llvm::ArrayRef<OptionDefinition> GetDefinitions() override;
29
30 Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value,
31 ExecutionContext *execution_context) override;
32 Status SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete;
33
34 void OptionParsingStarting(ExecutionContext *execution_context) override;
35
37 const ArchSpec &arch,
38 bool make_selected, Status &error,
39 ArchSpec &platform_arch) const;
40
41 bool PlatformWasSpecified() const { return !m_platform_name.empty(); }
42
43 void SetPlatformName(const char *platform_name) {
44 if (platform_name && platform_name[0])
45 m_platform_name.assign(platform_name);
46 else
47 m_platform_name.clear();
48 }
49
50 const std::string &GetSDKRootDirectory() const { return m_sdk_sysroot; }
51
52 void SetSDKRootDirectory(std::string sdk_root_directory) {
53 m_sdk_sysroot = std::move(sdk_root_directory);
54 }
55
56 const std::string &GetSDKBuild() const { return m_sdk_build; }
57
58 void SetSDKBuild(std::string sdk_build) {
59 m_sdk_build = std::move(sdk_build);
60 }
61
62 bool PlatformMatches(const lldb::PlatformSP &platform_sp) const;
63
64protected:
65 std::string m_platform_name;
66 std::string m_sdk_sysroot;
67 std::string m_sdk_build;
68 llvm::VersionTuple m_os_version;
70};
71
72} // namespace lldb_private
73
74#endif // LLDB_INTERPRETER_OPTIONGROUPPLATFORM_H
static llvm::raw_ostream & error(Stream &strm)
An architecture specification class.
Definition: ArchSpec.h:31
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
~OptionGroupPlatform() override=default
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override
void SetSDKBuild(std::string sdk_build)
Status SetOptionValue(uint32_t, const char *, ExecutionContext *)=delete
bool PlatformMatches(const lldb::PlatformSP &platform_sp) const
const std::string & GetSDKBuild() const
void SetPlatformName(const char *platform_name)
OptionGroupPlatform(bool include_platform_option)
lldb::PlatformSP CreatePlatformWithOptions(CommandInterpreter &interpreter, const ArchSpec &arch, bool make_selected, Status &error, ArchSpec &platform_arch) const
void OptionParsingStarting(ExecutionContext *execution_context) override
void SetSDKRootDirectory(std::string sdk_root_directory)
const std::string & GetSDKRootDirectory() const
llvm::ArrayRef< OptionDefinition > GetDefinitions() override
An error handling class.
Definition: Status.h:44
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::Platform > PlatformSP
Definition: lldb-forward.h:385