aboutsummaryrefslogtreecommitdiff
path: root/include/lldb/Interpreter/OptionGroupPlatform.h
blob: f7de50c86a56329e2817d1c85006a4cc95ea9563 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
//===-- OptionGroupPlatform.h -----------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef liblldb_OptionGroupPlatform_h_
#define liblldb_OptionGroupPlatform_h_

// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/ConstString.h"
#include "lldb/Interpreter/Options.h"

namespace lldb_private {

//-------------------------------------------------------------------------
// PlatformOptionGroup
//
// Make platform options available to any commands that need the settings.
//-------------------------------------------------------------------------
class OptionGroupPlatform : public OptionGroup
{
public:
    
    OptionGroupPlatform (bool include_platform_option) :
        OptionGroup(),
        m_platform_name (),
        m_sdk_sysroot (),
        m_os_version_major (UINT32_MAX),
        m_os_version_minor (UINT32_MAX),
        m_os_version_update (UINT32_MAX),
        m_include_platform_option (include_platform_option)
    {
    }

    virtual
    ~OptionGroupPlatform ()
    {
    }
    
    virtual uint32_t
    GetNumDefinitions ();
    
    virtual const OptionDefinition*
    GetDefinitions ();
    
    virtual Error
    SetOptionValue (CommandInterpreter &interpreter,
                    uint32_t option_idx,
                    const char *option_value);
    
    virtual void
    OptionParsingStarting (CommandInterpreter &interpreter);
    
    lldb::PlatformSP 
    CreatePlatformWithOptions (CommandInterpreter &interpreter,
                               const ArchSpec &arch,
                               bool make_selected, 
                               Error& error,
                               ArchSpec &platform_arch) const;

    bool
    PlatformWasSpecified () const
    {
        return !m_platform_name.empty();
    }
    
    void
    SetPlatformName (const char *platform_name)
    {
        if (platform_name && platform_name[0])
            m_platform_name.assign (platform_name);
        else
            m_platform_name.clear();
    }
    
    const ConstString &
    GetSDKRootDirectory () const
    {
        return m_sdk_sysroot;
    }
    
    void
    SetSDKRootDirectory (const ConstString &sdk_root_directory)
    {
        m_sdk_sysroot = sdk_root_directory;
    }    

    const ConstString &
    GetSDKBuild () const
    {
        return m_sdk_build;
    }
    
    void
    SetSDKBuild (const ConstString &sdk_build)
    {
        m_sdk_build = sdk_build;
    }

    bool
    PlatformMatches(const lldb::PlatformSP &platform_sp) const;

protected:
    std::string m_platform_name;
    ConstString m_sdk_sysroot;
    ConstString m_sdk_build;
    uint32_t m_os_version_major;
    uint32_t m_os_version_minor;
    uint32_t m_os_version_update;
    bool m_include_platform_option;
};

} // namespace lldb_private

#endif  // liblldb_OptionGroupPlatform_h_