@@ -32,6 +32,40 @@ using namespace lldb_private;
32
32
33
33
static uint32_t g_initialize_count = 0 ;
34
34
35
+ namespace
36
+ {
37
+ class SupportedArchList
38
+ {
39
+ public:
40
+ SupportedArchList ()
41
+ {
42
+ AddArch (ArchSpec (" i686-pc-windows" ));
43
+ AddArch (Host::GetArchitecture (Host::eSystemDefaultArchitecture));
44
+ AddArch (Host::GetArchitecture (Host::eSystemDefaultArchitecture32));
45
+ AddArch (Host::GetArchitecture (Host::eSystemDefaultArchitecture64));
46
+ AddArch (ArchSpec (" i386-pc-windows" ));
47
+ }
48
+
49
+ size_t Count () const { return m_archs.size (); }
50
+
51
+ const ArchSpec& operator [](int idx) { return m_archs[idx]; }
52
+
53
+ private:
54
+ void AddArch (const ArchSpec& spec)
55
+ {
56
+ auto iter = std::find_if (
57
+ m_archs.begin (), m_archs.end (),
58
+ [spec](const ArchSpec& rhs) { return spec.IsExactMatch (rhs); });
59
+ if (iter != m_archs.end ())
60
+ return ;
61
+ if (spec.IsValid ())
62
+ m_archs.push_back (spec);
63
+ }
64
+
65
+ std::vector<ArchSpec> m_archs;
66
+ };
67
+ }
68
+
35
69
Platform *
36
70
PlatformWindows::CreateInstance (bool force, const lldb_private::ArchSpec *arch)
37
71
{
@@ -605,26 +639,12 @@ PlatformWindows::GetSharedModule (const ModuleSpec &module_spec,
605
639
bool
606
640
PlatformWindows::GetSupportedArchitectureAtIndex (uint32_t idx, ArchSpec &arch)
607
641
{
608
- // From macosx;s plugin code. For FreeBSD we may want to support more archs.
609
- if (idx == 0 )
610
- {
611
- arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture);
612
- return arch.IsValid ();
613
- }
614
- else if (idx == 1 )
615
- {
616
- ArchSpec platform_arch (Host::GetArchitecture (Host::eSystemDefaultArchitecture));
617
- ArchSpec platform_arch64 (Host::GetArchitecture (Host::eSystemDefaultArchitecture64));
618
- if (platform_arch.IsExactMatch (platform_arch64))
619
- {
620
- // This freebsd platform supports both 32 and 64 bit. Since we already
621
- // returned the 64 bit arch for idx == 0, return the 32 bit arch
622
- // for idx == 1
623
- arch = Host::GetArchitecture (Host::eSystemDefaultArchitecture32);
624
- return arch.IsValid ();
625
- }
626
- }
627
- return false ;
642
+ static SupportedArchList architectures;
643
+
644
+ if (idx >= architectures.Count ())
645
+ return false ;
646
+ arch = architectures[idx];
647
+ return true ;
628
648
}
629
649
630
650
void
0 commit comments