summaryrefslogtreecommitdiffstats
path: root/lldb/include/lldb/Core/FormatManager.h
blob: 5bf544d4ebde129836b09511fbdca541b048b3dc (plain)
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
//===-- FormatManager.h -------------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef lldb_FormatManager_h_
#define lldb_FormatManager_h_

// C Includes
// C++ Includes

// Other libraries and framework includes
// Project includes
#include "lldb/lldb-public.h"
#include "lldb/lldb-enumerations.h"

#include "lldb/Core/FormatNavigator.h"
#include "lldb/Interpreter/ScriptInterpreterPython.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Platform.h"

using lldb::LogSP;

namespace lldb_private {
    
// this file (and its. cpp) contain the low-level implementation of LLDB Data Visualization
// class DataVisualization is the high-level front-end of this feature
// clients should refer to that class as the entry-point into the data formatters
// unless they have a good reason to bypass it and prefer to use this file's objects directly
    
class CategoryMap;
    
class TypeCategoryImpl
{
private:
    
    typedef FormatNavigator<ConstString, TypeSummaryImpl> SummaryNavigator;
    typedef FormatNavigator<lldb::RegularExpressionSP, TypeSummaryImpl> RegexSummaryNavigator;
    
    typedef FormatNavigator<ConstString, TypeFilterImpl> FilterNavigator;
    typedef FormatNavigator<lldb::RegularExpressionSP, TypeFilterImpl> RegexFilterNavigator;
    
#ifndef LLDB_DISABLE_PYTHON
    typedef FormatNavigator<ConstString, TypeSyntheticImpl> SynthNavigator;
    typedef FormatNavigator<lldb::RegularExpressionSP, TypeSyntheticImpl> RegexSynthNavigator;
#endif // #ifndef LLDB_DISABLE_PYTHON

    typedef SummaryNavigator::MapType SummaryMap;
    typedef RegexSummaryNavigator::MapType RegexSummaryMap;
    typedef FilterNavigator::MapType FilterMap;
    typedef RegexFilterNavigator::MapType RegexFilterMap;
#ifndef LLDB_DISABLE_PYTHON
    typedef SynthNavigator::MapType SynthMap;
    typedef RegexSynthNavigator::MapType RegexSynthMap;
#endif // #ifndef LLDB_DISABLE_PYTHON

public:
        
    typedef uint16_t FormatCategoryItems;
    static const uint16_t ALL_ITEM_TYPES = UINT16_MAX;
    
    typedef SummaryNavigator::SharedPointer SummaryNavigatorSP;
    typedef RegexSummaryNavigator::SharedPointer RegexSummaryNavigatorSP;
    typedef FilterNavigator::SharedPointer FilterNavigatorSP;
    typedef RegexFilterNavigator::SharedPointer RegexFilterNavigatorSP;
#ifndef LLDB_DISABLE_PYTHON
    typedef SynthNavigator::SharedPointer SynthNavigatorSP;
    typedef RegexSynthNavigator::SharedPointer RegexSynthNavigatorSP;
#endif // #ifndef LLDB_DISABLE_PYTHON

    TypeCategoryImpl (IFormatChangeListener* clist,
                      ConstString name);
    
    SummaryNavigatorSP
    GetSummaryNavigator ()
    {
        return SummaryNavigatorSP(m_summary_nav);
    }
    
    RegexSummaryNavigatorSP
    GetRegexSummaryNavigator ()
    {
        return RegexSummaryNavigatorSP(m_regex_summary_nav);
    }
    
    FilterNavigatorSP
    GetFilterNavigator ()
    {
        return FilterNavigatorSP(m_filter_nav);
    }
    
    RegexFilterNavigatorSP
    GetRegexFilterNavigator ()
    {
        return RegexFilterNavigatorSP(m_regex_filter_nav);
    }
    
    SummaryNavigator::MapValueType
    GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp)
    {
        SummaryNavigator::MapValueType retval;
        
        if (type_sp)
        {
            if (type_sp->IsRegex())
                m_regex_summary_nav->GetExact(ConstString(type_sp->GetName()),retval);
            else
                m_summary_nav->GetExact(ConstString(type_sp->GetName()),retval);
        }

        return retval;
    }
    
    FilterNavigator::MapValueType
    GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp)
    {
        FilterNavigator::MapValueType retval;
        
        if (type_sp)
        {
            if (type_sp->IsRegex())
                m_regex_filter_nav->GetExact(ConstString(type_sp->GetName()),retval);
            else
                m_filter_nav->GetExact(ConstString(type_sp->GetName()),retval);
        }
        
        return retval;
    }
    
#ifndef LLDB_DISABLE_PYTHON
    SynthNavigator::MapValueType
    GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp)
    {
        SynthNavigator::MapValueType retval;
        
        if (type_sp)
        {
            if (type_sp->IsRegex())
                m_regex_synth_nav->GetExact(ConstString(type_sp->GetName()),retval);
            else
                m_synth_nav->GetExact(ConstString(type_sp->GetName()),retval);
        }
        
        return retval;
    }
#endif
    
    lldb::TypeNameSpecifierImplSP
    GetTypeNameSpecifierForSummaryAtIndex (uint32_t index)
    {
        if (index < m_summary_nav->GetCount())
            return m_summary_nav->GetTypeNameSpecifierAtIndex(index);
        else
            return m_regex_summary_nav->GetTypeNameSpecifierAtIndex(index-m_summary_nav->GetCount());
    }
    
    SummaryNavigator::MapValueType
    GetSummaryAtIndex (uint32_t index)
    {
        if (index < m_summary_nav->GetCount())
            return m_summary_nav->GetAtIndex(index);
        else
            return m_regex_summary_nav->GetAtIndex(index-m_summary_nav->GetCount());
    }

    FilterNavigator::MapValueType
    GetFilterAtIndex (uint32_t index)
    {
        if (index < m_filter_nav->GetCount())
            return m_filter_nav->GetAtIndex(index);
        else
            return m_regex_filter_nav->GetAtIndex(index-m_filter_nav->GetCount());
    }
    
    lldb::TypeNameSpecifierImplSP
    GetTypeNameSpecifierForFilterAtIndex (uint32_t index)
    {
        if (index < m_filter_nav->GetCount())
            return m_filter_nav->GetTypeNameSpecifierAtIndex(index);
        else
            return m_regex_filter_nav->GetTypeNameSpecifierAtIndex(index-m_filter_nav->GetCount());
    }

#ifndef LLDB_DISABLE_PYTHON
    SynthNavigatorSP
    GetSyntheticNavigator ()
    {
        return SynthNavigatorSP(m_synth_nav);
    }
    
    RegexSynthNavigatorSP
    GetRegexSyntheticNavigator ()
    {
        return RegexSynthNavigatorSP(m_regex_synth_nav);
    }
    
    SynthNavigator::MapValueType
    GetSyntheticAtIndex (uint32_t index)
    {
        if (index < m_synth_nav->GetCount())
            return m_synth_nav->GetAtIndex(index);
        else
            return m_regex_synth_nav->GetAtIndex(index-m_synth_nav->GetCount());
    }
    
    lldb::TypeNameSpecifierImplSP
    GetTypeNameSpecifierForSyntheticAtIndex (uint32_t index)
    {
        if (index < m_synth_nav->GetCount())
            return m_synth_nav->GetTypeNameSpecifierAtIndex(index);
        else
            return m_regex_synth_nav->GetTypeNameSpecifierAtIndex(index - m_synth_nav->GetCount());
    }
    
#endif // #ifndef LLDB_DISABLE_PYTHON

    bool
    IsEnabled () const
    {
        return m_enabled;
    }
    
    uint32_t
    GetEnabledPosition()
    {
        if (m_enabled == false)
            return UINT32_MAX;
        else
            return m_enabled_position;
    }
    
    bool
    Get (ValueObject& valobj,
         lldb::TypeSummaryImplSP& entry,
         lldb::DynamicValueType use_dynamic,
         uint32_t* reason = NULL);
    
    bool
    Get (ValueObject& valobj,
         lldb::SyntheticChildrenSP& entry,
         lldb::DynamicValueType use_dynamic,
         uint32_t* reason = NULL);
        
    void
    Clear (FormatCategoryItems items = ALL_ITEM_TYPES);
    
    bool
    Delete (ConstString name,
            FormatCategoryItems items = ALL_ITEM_TYPES);
    
    uint32_t
    GetCount (FormatCategoryItems items = ALL_ITEM_TYPES);
    
    const char*
    GetName ()
    {
        return m_name.GetCString();
    }
    
    bool
    AnyMatches (ConstString type_name,
                FormatCategoryItems items = ALL_ITEM_TYPES,
                bool only_enabled = true,
                const char** matching_category = NULL,
                FormatCategoryItems* matching_type = NULL);
    
    typedef STD_SHARED_PTR(TypeCategoryImpl) SharedPointer;
    
private:
    SummaryNavigator::SharedPointer m_summary_nav;
    RegexSummaryNavigator::SharedPointer m_regex_summary_nav;
    FilterNavigator::SharedPointer m_filter_nav;
    RegexFilterNavigator::SharedPointer m_regex_filter_nav;
#ifndef LLDB_DISABLE_PYTHON
    SynthNavigator::SharedPointer m_synth_nav;
    RegexSynthNavigator::SharedPointer m_regex_synth_nav;
#endif // #ifndef LLDB_DISABLE_PYTHON
    
    bool m_enabled;
    
    IFormatChangeListener* m_change_listener;
    
    Mutex m_mutex;
    
    ConstString m_name;
    
    uint32_t m_enabled_position;
    
    void
    Enable (bool value,
            uint32_t position)
    {
        Mutex::Locker locker(m_mutex);
        m_enabled = value;
        m_enabled_position = position;
        if (m_change_listener)
            m_change_listener->Changed();
    }
    
    void
    Disable ()
    {
        Enable(false, UINT32_MAX);
    }
    
    friend class CategoryMap;
    
    friend class FormatNavigator<ConstString, TypeSummaryImpl>;
    friend class FormatNavigator<lldb::RegularExpressionSP, TypeSummaryImpl>;
    
    friend class FormatNavigator<ConstString, TypeFilterImpl>;
    friend class FormatNavigator<lldb::RegularExpressionSP, TypeFilterImpl>;
    
#ifndef LLDB_DISABLE_PYTHON
    friend class FormatNavigator<ConstString, TypeSyntheticImpl>;
    friend class FormatNavigator<lldb::RegularExpressionSP, TypeSyntheticImpl>;
#endif // #ifndef LLDB_DISABLE_PYTHON
    

};

class CategoryMap
{
private:
    typedef ConstString KeyType;
    typedef TypeCategoryImpl ValueType;
    typedef ValueType::SharedPointer ValueSP;
    typedef std::list<lldb::TypeCategoryImplSP> ActiveCategoriesList;
    typedef ActiveCategoriesList::iterator ActiveCategoriesIterator;
        
public:
    typedef std::map<KeyType, ValueSP> MapType;
    typedef MapType::iterator MapIterator;
    typedef bool(*CallbackType)(void*, const ValueSP&);
    typedef uint32_t Position;
    
    static const Position First = 0;
    static const Position Default = 1;
    static const Position Last = UINT32_MAX;
    
    CategoryMap (IFormatChangeListener* lst) :
        m_map_mutex(Mutex::eMutexTypeRecursive),
        listener(lst),
        m_map(),
        m_active_categories()
    {
        ConstString default_cs("default");
        lldb::TypeCategoryImplSP default_sp = lldb::TypeCategoryImplSP(new TypeCategoryImpl(listener, default_cs));
        Add(default_cs,default_sp);
        Enable(default_cs,First);
    }
    
    void
    Add (KeyType name,
         const ValueSP& entry)
    {
        Mutex::Locker locker(m_map_mutex);
        m_map[name] = entry;
        if (listener)
            listener->Changed();
    }
    
    bool
    Delete (KeyType name)
    {
        Mutex::Locker locker(m_map_mutex);
        MapIterator iter = m_map.find(name);
        if (iter == m_map.end())
            return false;
        m_map.erase(name);
        Disable(name);
        if (listener)
            listener->Changed();
        return true;
    }
    
    bool
    Enable (KeyType category_name,
            Position pos = Default)
    {
        Mutex::Locker locker(m_map_mutex);
        ValueSP category;
        if (!Get(category_name,category))
            return false;
        return Enable(category, pos);
    }
    
    bool
    Disable (KeyType category_name)
    {
        Mutex::Locker locker(m_map_mutex);
        ValueSP category;
        if (!Get(category_name,category))
            return false;
        return Disable(category);
    }
    
    bool
    Enable (ValueSP category,
            Position pos = Default)
    {
        Mutex::Locker locker(m_map_mutex);
        if (category.get())
        {
            Position pos_w = pos;
            if (pos == First || m_active_categories.size() == 0)
                m_active_categories.push_front(category);
            else if (pos == Last || pos == m_active_categories.size())
                m_active_categories.push_back(category);
            else if (pos < m_active_categories.size())
            {
                ActiveCategoriesList::iterator iter = m_active_categories.begin();
                while (pos_w)
                {
                    pos_w--,iter++;
                }
                m_active_categories.insert(iter,category);
            }
            else
                return false;
            category->Enable(true,
                             pos);
            return true;
        }
        return false;
    }
    
    bool
    Disable (ValueSP category)
    {
        Mutex::Locker locker(m_map_mutex);
        if (category.get())
        {
            m_active_categories.remove_if(delete_matching_categories(category));
            category->Disable();
            return true;
        }
        return false;
    }
    
    void
    Clear ()
    {
        Mutex::Locker locker(m_map_mutex);
        m_map.clear();
        m_active_categories.clear();
        if (listener)
            listener->Changed();
    }
    
    bool
    Get (KeyType name,
         ValueSP& entry)
    {
        Mutex::Locker locker(m_map_mutex);
        MapIterator iter = m_map.find(name);
        if (iter == m_map.end())
            return false;
        entry = iter->second;
        return true;
    }
    
    bool
    Get (uint32_t pos,
         ValueSP& entry)
    {
        Mutex::Locker locker(m_map_mutex);
        MapIterator iter = m_map.begin();
        MapIterator end = m_map.end();
        while (pos > 0)
        {
            iter++;
            pos--;
            if (iter == end)
                return false;
        }
        entry = iter->second;
        return false;
    }
    
    void
    LoopThrough (CallbackType callback, void* param);
    
    lldb::TypeCategoryImplSP
    GetAtIndex (uint32_t);
    
    bool
    AnyMatches (ConstString type_name,
                TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
                bool only_enabled = true,
                const char** matching_category = NULL,
                TypeCategoryImpl::FormatCategoryItems* matching_type = NULL);
    
    uint32_t
    GetCount ()
    {
        return m_map.size();
    }
    
    lldb::TypeSummaryImplSP
    GetSummaryFormat (ValueObject& valobj,
         lldb::DynamicValueType use_dynamic);
    
#ifndef LLDB_DISABLE_PYTHON
    lldb::SyntheticChildrenSP
    GetSyntheticChildren (ValueObject& valobj,
                          lldb::DynamicValueType use_dynamic);
#endif
    
private:
    
    class delete_matching_categories
    {
        lldb::TypeCategoryImplSP ptr;
    public:
        delete_matching_categories(lldb::TypeCategoryImplSP p) : ptr(p)
        {}
        
        bool operator()(const lldb::TypeCategoryImplSP& other)
        {
            return ptr.get() == other.get();
        }
    };
    
    Mutex m_map_mutex;
    IFormatChangeListener* listener;
    
    MapType m_map;
    ActiveCategoriesList m_active_categories;
    
    MapType& map ()
    {
        return m_map;
    }
    
    ActiveCategoriesList& active_list ()
    {
        return m_active_categories;
    }
    
    Mutex& mutex ()
    {
        return m_map_mutex;
    }
    
    friend class FormatNavigator<KeyType, ValueType>;
    friend class FormatManager;
};

class FormatManager : public IFormatChangeListener
{
    typedef FormatNavigator<ConstString, TypeFormatImpl> ValueNavigator;
    typedef ValueNavigator::MapType ValueMap;
    typedef FormatMap<ConstString, TypeSummaryImpl> NamedSummariesMap;
    typedef CategoryMap::MapType::iterator CategoryMapIterator;
public:
    
    typedef CategoryMap::CallbackType CategoryCallback;
    
    FormatManager ();
    
    ValueNavigator&
    GetValueNavigator ()
    {
        return m_value_nav;
    }
    
    NamedSummariesMap&
    GetNamedSummaryNavigator ()
    {
        return m_named_summaries_map;
    }
    
    void
    EnableCategory (const ConstString& category_name,
                    CategoryMap::Position pos = CategoryMap::Default)
    {
        m_categories_map.Enable(category_name,
                                pos);
    }
    
    void
    DisableCategory (const ConstString& category_name)
    {
        m_categories_map.Disable(category_name);
    }
    
    void
    EnableCategory (const lldb::TypeCategoryImplSP& category,
                    CategoryMap::Position pos = CategoryMap::Default)
    {
        m_categories_map.Enable(category,
                                pos);
    }
    
    void
    DisableCategory (const lldb::TypeCategoryImplSP& category)
    {
        m_categories_map.Disable(category);
    }
    
    bool
    DeleteCategory (const ConstString& category_name)
    {
        return m_categories_map.Delete(category_name);
    }
    
    void
    ClearCategories ()
    {
        return m_categories_map.Clear();
    }
    
    uint32_t
    GetCategoriesCount ()
    {
        return m_categories_map.GetCount();
    }
    
    lldb::TypeCategoryImplSP
    GetCategoryAtIndex (uint32_t index)
    {
        return m_categories_map.GetAtIndex(index);
    }
    
    void
    LoopThroughCategories (CategoryCallback callback, void* param)
    {
        m_categories_map.LoopThrough(callback, param);
    }
    
    lldb::TypeCategoryImplSP
    GetCategory (const char* category_name = NULL,
                 bool can_create = true)
    {
        if (!category_name)
            return GetCategory(m_default_category_name);
        return GetCategory(ConstString(category_name));
    }
    
    lldb::TypeCategoryImplSP
    GetCategory (const ConstString& category_name,
                 bool can_create = true);
    
    lldb::TypeSummaryImplSP
    GetSummaryFormat (ValueObject& valobj,
                      lldb::DynamicValueType use_dynamic)
    {
        return m_categories_map.GetSummaryFormat(valobj, use_dynamic);
    }
    
    lldb::TypeSummaryImplSP
    GetSummaryForType (lldb::TypeNameSpecifierImplSP type_sp);

    lldb::TypeFilterImplSP
    GetFilterForType (lldb::TypeNameSpecifierImplSP type_sp);

#ifndef LLDB_DISABLE_PYTHON
    lldb::TypeSyntheticImplSP
    GetSyntheticForType (lldb::TypeNameSpecifierImplSP type_sp);
#endif
    
#ifndef LLDB_DISABLE_PYTHON
    lldb::SyntheticChildrenSP
    GetSyntheticChildrenForType (lldb::TypeNameSpecifierImplSP type_sp);
#endif
    
#ifndef LLDB_DISABLE_PYTHON
    lldb::SyntheticChildrenSP
    GetSyntheticChildren (ValueObject& valobj,
                          lldb::DynamicValueType use_dynamic)
    {
        return m_categories_map.GetSyntheticChildren(valobj, use_dynamic);
    }
#endif
    
    bool
    AnyMatches (ConstString type_name,
                TypeCategoryImpl::FormatCategoryItems items = TypeCategoryImpl::ALL_ITEM_TYPES,
                bool only_enabled = true,
                const char** matching_category = NULL,
                TypeCategoryImpl::FormatCategoryItems* matching_type = NULL)
    {
        return m_categories_map.AnyMatches(type_name,
                                           items,
                                           only_enabled,
                                           matching_category,
                                           matching_type);
    }

    static bool
    GetFormatFromCString (const char *format_cstr,
                          bool partial_match_ok,
                          lldb::Format &format);

    static char
    GetFormatAsFormatChar (lldb::Format format);

    static const char *
    GetFormatAsCString (lldb::Format format);
    
    // if the user tries to add formatters for, say, "struct Foo"
    // those will not match any type because of the way we strip qualifiers from typenames
    // this method looks for the case where the user is adding a "class","struct","enum" or "union" Foo
    // and strips the unnecessary qualifier
    static ConstString
    GetValidTypeName (const ConstString& type);
    
    // when DataExtractor dumps a vectorOfT, it uses a predefined format for each item
    // this method returns it, or eFormatInvalid if vector_format is not a vectorOf
    static lldb::Format
    GetSingleItemFormat (lldb::Format vector_format);
    
    void
    Changed ()
    {
        __sync_add_and_fetch(&m_last_revision, +1);
    }
    
    uint32_t
    GetCurrentRevision ()
    {
        return m_last_revision;
    }
    
    ~FormatManager ()
    {
    }
    
private:    
    ValueNavigator m_value_nav;
    NamedSummariesMap m_named_summaries_map;
    uint32_t m_last_revision;
    CategoryMap m_categories_map;
    
    ConstString m_default_category_name;
    ConstString m_system_category_name;
    ConstString m_gnu_cpp_category_name;
    ConstString m_libcxx_category_name;
    ConstString m_objc_category_name;
    ConstString m_corefoundation_category_name;
    ConstString m_coregraphics_category_name;
    ConstString m_coreservices_category_name;
    ConstString m_vectortypes_category_name;
    ConstString m_appkit_category_name;
    
    CategoryMap&
    GetCategories ()
    {
        return m_categories_map;
    }
    
    // WARNING: these are temporary functions that setup formatters
    // while a few of these actually should be globally available and setup by LLDB itself
    // most would actually belong to the users' lldbinit file or to some other form of configurable
    // storage
    void
    LoadLibStdcppFormatters ();
    
    void
    LoadLibcxxFormatters ();
    
    void
    LoadSystemFormatters ();
    
    void
    LoadObjCFormatters ();
};
    
} // namespace lldb_private

#endif	// lldb_FormatManager_h_
OpenPOWER on IntegriCloud