31
31
#include " lldb/lldb-public.h"
32
32
#include " lldb/lldb-enumerations.h"
33
33
34
- #include " lldb/API/SBValue.h"
35
34
#include " lldb/Core/ValueObject.h"
36
35
#include " lldb/Interpreter/ScriptInterpreterPython.h"
37
- #include " lldb/Symbol/SymbolContext.h"
38
36
39
37
namespace lldb_private {
40
38
@@ -48,13 +46,7 @@ struct ValueFormat
48
46
ValueFormat (lldb::Format f = lldb::eFormatInvalid,
49
47
bool casc = false ,
50
48
bool skipptr = false ,
51
- bool skipref = false ) :
52
- m_cascades (casc),
53
- m_skip_pointers (skipptr),
54
- m_skip_references (skipref),
55
- m_format (f)
56
- {
57
- }
49
+ bool skipref = false );
58
50
59
51
typedef lldb::SharedPtr<ValueFormat>::Type SharedPointer;
60
52
typedef bool (*ValueCallback)(void *, ConstString, const lldb::ValueFormatSP&);
@@ -335,25 +327,7 @@ class SyntheticScriptProvider : public SyntheticChildren
335
327
}
336
328
337
329
virtual lldb::ValueObjectSP
338
- GetChildAtIndex (uint32_t idx, bool can_create)
339
- {
340
- if (m_wrapper == NULL || m_interpreter == NULL )
341
- return lldb::ValueObjectSP ();
342
-
343
- PyObject* py_return = (PyObject*)m_interpreter->GetChildAtIndex (m_wrapper, idx);
344
- if (py_return == NULL || py_return == Py_None)
345
- {
346
- Py_XDECREF (py_return);
347
- return lldb::ValueObjectSP ();
348
- }
349
-
350
- lldb::SBValue *sb_ptr = m_interpreter->CastPyObjectToSBValue (py_return);
351
-
352
- if (py_return == NULL || sb_ptr == NULL )
353
- return lldb::ValueObjectSP ();
354
-
355
- return sb_ptr->m_opaque_sp ;
356
- }
330
+ GetChildAtIndex (uint32_t idx, bool can_create);
357
331
358
332
virtual void
359
333
Update ()
@@ -383,122 +357,121 @@ class SyntheticScriptProvider : public SyntheticChildren
383
357
}
384
358
385
359
};
386
-
387
- struct SyntheticArrayRange
388
- {
389
- private:
390
- int m_low;
391
- int m_high;
392
- SyntheticArrayRange* m_next;
393
360
361
+ class SyntheticArrayView : public SyntheticChildren
362
+ {
394
363
public:
395
364
396
- SyntheticArrayRange () :
365
+ struct SyntheticArrayRange
366
+ {
367
+ private:
368
+ int m_low;
369
+ int m_high;
370
+ SyntheticArrayRange* m_next;
371
+
372
+ public:
373
+
374
+ SyntheticArrayRange () :
397
375
m_low (-1 ),
398
376
m_high (-2 ),
399
377
m_next (NULL )
400
- {}
401
-
402
- SyntheticArrayRange (int L) :
378
+ {}
379
+
380
+ SyntheticArrayRange (int L) :
403
381
m_low (L),
404
382
m_high (L),
405
383
m_next (NULL )
406
- {}
407
-
408
- SyntheticArrayRange (int L, int H) :
384
+ {}
385
+
386
+ SyntheticArrayRange (int L, int H) :
409
387
m_low (L),
410
388
m_high (H),
411
389
m_next (NULL )
412
- {}
413
-
414
- SyntheticArrayRange (int L, int H, SyntheticArrayRange* N) :
390
+ {}
391
+
392
+ SyntheticArrayRange (int L, int H, SyntheticArrayRange* N) :
415
393
m_low (L),
416
394
m_high (H),
417
395
m_next (N)
418
- {}
419
-
420
- inline int
421
- GetLow ()
422
- {
423
- return m_low;
424
- }
425
-
426
- inline int
427
- GetHigh ()
428
- {
429
- return m_high;
430
- }
431
-
432
- inline void
433
- SetLow (int L)
434
- {
435
- m_low = L;
436
- }
437
-
438
- inline void
439
- SetHigh (int H)
440
- {
441
- m_high = H;
442
- }
443
-
444
- inline int
445
- GetSelfCount ()
446
- {
447
- return GetHigh () - GetLow () + 1 ;
448
- }
449
-
450
- int
451
- GetCount ()
452
- {
453
- int count = GetSelfCount ();
454
- if (m_next)
455
- count += m_next->GetCount ();
456
- return count;
457
- }
458
-
459
- inline SyntheticArrayRange*
460
- GetNext ()
461
- {
462
- return m_next;
463
- }
464
-
465
- void
466
- SetNext (SyntheticArrayRange* N)
467
- {
468
- if (m_next)
469
- delete m_next;
470
- m_next = N;
471
- }
472
-
473
- void
474
- SetNext (int L, int H)
475
- {
476
- if (m_next)
477
- delete m_next;
478
- m_next = new SyntheticArrayRange (L, H);
479
- }
480
-
481
- void
482
- SetNext (int L)
483
- {
484
- if (m_next)
396
+ {}
397
+
398
+ inline int
399
+ GetLow ()
400
+ {
401
+ return m_low;
402
+ }
403
+
404
+ inline int
405
+ GetHigh ()
406
+ {
407
+ return m_high;
408
+ }
409
+
410
+ inline void
411
+ SetLow (int L)
412
+ {
413
+ m_low = L;
414
+ }
415
+
416
+ inline void
417
+ SetHigh (int H)
418
+ {
419
+ m_high = H;
420
+ }
421
+
422
+ inline int
423
+ GetSelfCount ()
424
+ {
425
+ return GetHigh () - GetLow () + 1 ;
426
+ }
427
+
428
+ int
429
+ GetCount ()
430
+ {
431
+ int count = GetSelfCount ();
432
+ if (m_next)
433
+ count += m_next->GetCount ();
434
+ return count;
435
+ }
436
+
437
+ inline SyntheticArrayRange*
438
+ GetNext ()
439
+ {
440
+ return m_next;
441
+ }
442
+
443
+ void
444
+ SetNext (SyntheticArrayRange* N)
445
+ {
446
+ if (m_next)
447
+ delete m_next;
448
+ m_next = N;
449
+ }
450
+
451
+ void
452
+ SetNext (int L, int H)
453
+ {
454
+ if (m_next)
455
+ delete m_next;
456
+ m_next = new SyntheticArrayRange (L, H);
457
+ }
458
+
459
+ void
460
+ SetNext (int L)
461
+ {
462
+ if (m_next)
463
+ delete m_next;
464
+ m_next = new SyntheticArrayRange (L);
465
+ }
466
+
467
+ ~SyntheticArrayRange ()
468
+ {
485
469
delete m_next;
486
- m_next = new SyntheticArrayRange (L);
487
- }
488
-
489
- ~SyntheticArrayRange ()
490
- {
491
- delete m_next;
492
- m_next = NULL ;
493
- }
494
-
495
- };
470
+ m_next = NULL ;
471
+ }
472
+
473
+ };
496
474
497
- class SyntheticArrayView : public SyntheticChildren
498
- {
499
- SyntheticArrayRange m_head;
500
- SyntheticArrayRange *m_tail;
501
- public:
502
475
SyntheticArrayView (bool casc = false ,
503
476
bool skipptr = false ,
504
477
bool skipref = false ) :
@@ -524,29 +497,7 @@ class SyntheticArrayView : public SyntheticChildren
524
497
}
525
498
526
499
const int
527
- GetRealIndexForIndex (int i)
528
- {
529
- if (i >= GetCount ())
530
- return -1 ;
531
-
532
- SyntheticArrayRange* ptr = &m_head;
533
-
534
- int residual = i;
535
-
536
- while (ptr && ptr != m_tail)
537
- {
538
- if (residual >= ptr->GetSelfCount ())
539
- {
540
- residual -= ptr->GetSelfCount ();
541
- ptr = ptr->GetNext ();
542
- }
543
-
544
- return ptr->GetLow () + residual;
545
- }
546
-
547
- return -1 ;
548
-
549
- }
500
+ GetRealIndexForIndex (int i);
550
501
551
502
bool
552
503
IsScripted ()
@@ -592,20 +543,7 @@ class SyntheticArrayView : public SyntheticChildren
592
543
Update () {}
593
544
594
545
virtual uint32_t
595
- GetIndexOfChildWithName (const ConstString &name_cs)
596
- {
597
- const char * name_cstr = name_cs.GetCString ();
598
- if (*name_cstr != ' [' )
599
- return UINT32_MAX;
600
- std::string name (name_cstr+1 );
601
- if (name[name.size ()-1 ] != ' ]' )
602
- return UINT32_MAX;
603
- name = name.erase (name.size ()-1 ,1 );
604
- int index = Args::StringToSInt32 (name.c_str (), -1 );
605
- if (index < 0 )
606
- return UINT32_MAX;
607
- return index;
608
- }
546
+ GetIndexOfChildWithName (const ConstString &name_cs);
609
547
610
548
typedef lldb::SharedPtr<SyntheticChildrenFrontEnd>::Type SharedPointer;
611
549
@@ -616,6 +554,9 @@ class SyntheticArrayView : public SyntheticChildren
616
554
{
617
555
return SyntheticChildrenFrontEnd::SharedPointer (new FrontEnd (this , backend));
618
556
}
557
+ private:
558
+ SyntheticArrayRange m_head;
559
+ SyntheticArrayRange *m_tail;
619
560
620
561
};
621
562
@@ -635,15 +576,7 @@ struct SummaryFormat
635
576
bool skipref = false ,
636
577
bool nochildren = true ,
637
578
bool novalue = true ,
638
- bool oneliner = false ) :
639
- m_cascades (casc),
640
- m_skip_pointers (skipptr),
641
- m_skip_references (skipref),
642
- m_dont_show_children (nochildren),
643
- m_dont_show_value (novalue),
644
- m_show_members_oneliner (oneliner)
645
- {
646
- }
579
+ bool oneliner = false );
647
580
648
581
bool
649
582
Cascades () const
@@ -707,11 +640,7 @@ struct StringSummaryFormat : public SummaryFormat
707
640
bool nochildren = true ,
708
641
bool novalue = true ,
709
642
bool oneliner = false ,
710
- std::string f = " " ) :
711
- SummaryFormat (casc,skipptr,skipref,nochildren,novalue,oneliner),
712
- m_format (f)
713
- {
714
- }
643
+ std::string f = " " );
715
644
716
645
std::string
717
646
GetFormat () const
@@ -745,12 +674,7 @@ struct ScriptSummaryFormat : public SummaryFormat
745
674
bool novalue = true ,
746
675
bool oneliner = false ,
747
676
std::string fname = " " ,
748
- std::string pscri = " " ) :
749
- SummaryFormat (casc,skipptr,skipref,nochildren,novalue,oneliner),
750
- m_function_name (fname),
751
- m_python_script (pscri)
752
- {
753
- }
677
+ std::string pscri = " " );
754
678
755
679
std::string
756
680
GetFunctionName () const
0 commit comments