File tree Expand file tree Collapse file tree 3 files changed +29
-29
lines changed
lldb/test/API/functionalities/data-formatter/fake-smart-ptr Expand file tree Collapse file tree 3 files changed +29
-29
lines changed Original file line number Diff line number Diff line change @@ -16,8 +16,9 @@ class FakeSmartPtrDataFormatterTestCase(TestBase):
1616
1717 def test_frame_var (self ):
1818 self .build ()
19- lldbutil .run_to_source_breakpoint (self , "Set a breakpoint here" ,
20- lldb .SBFileSpec ("main.cpp" ))
19+ lldbutil .run_to_source_breakpoint (
20+ self , "Set a breakpoint here" , lldb .SBFileSpec ("main.cpp" )
21+ )
2122
2223 self .runCmd ("settings set target.experimental.use-DIL true" )
2324 self .runCmd ("script from smartPtrSynthProvider import *" )
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ struct NodeS;
44
55// Fake smart pointer definition.
66class smart_ptr {
7- public:
7+ public:
88 NodeS *__ptr_;
99
1010 smart_ptr (NodeS *ptr) : __ptr_(ptr) {}
@@ -14,11 +14,10 @@ struct NodeS {
1414 smart_ptr next;
1515 int value;
1616
17- NodeS (NodeS *ptr, int val) :
18- next (smart_ptr(ptr)), value(val) {}
17+ NodeS (NodeS *ptr, int val) : next(smart_ptr(ptr)), value(val) {}
1918};
2019
21- int main (int argc, char **argv) {
20+ int main (int argc, char **argv) {
2221
2322 // Make a short linked list of fake smart pointers.
2423 auto ptr_node = smart_ptr (new NodeS (new NodeS (nullptr , 2 ), 1 ));
Original file line number Diff line number Diff line change 11import lldb
22
33class smartPtrSynthProvider :
4- def __init__ (self , valobj , dict ):
5- self .valobj = valobj
4+ def __init__ (self , valobj , dict ):
5+ self .valobj = valobj
66
7- def num_children (self ):
8- return 1
7+ def num_children (self ):
8+ return 1
99
10- def get_child_at_index (self , index ):
11- if index == 0 :
12- return self .valobj .GetChildMemberWithName ("__ptr_" )
13- if index == 1 :
14- internal_child = self .valobj .GetChildMemberWithName ("__ptr_" )
15- if not internal_child :
10+ def get_child_at_index (self , index ):
11+ if index == 0 :
12+ return self .valobj .GetChildMemberWithName ("__ptr_" )
13+ if index == 1 :
14+ internal_child = self .valobj .GetChildMemberWithName ("__ptr_" )
15+ if not internal_child :
16+ return None
17+ value_type = internal_child .GetType ().GetPointerType ()
18+ cast_ptr_sp = internal_child .Cast (value_type )
19+ value = internal_child .Dereference ()
20+ return value
1621 return None
17- value_type = internal_child .GetType ().GetPointerType ()
18- cast_ptr_sp = internal_child .Cast (value_type )
19- value = internal_child .Dereference ()
20- return value
21- return None
2222
23- def get_child_index (self , name ):
24- if name == "__ptr_" :
25- return 0
26- if name == "$$dereference$$" :
27- return 1
28- return - 1
23+ def get_child_index (self , name ):
24+ if name == "__ptr_" :
25+ return 0
26+ if name == "$$dereference$$" :
27+ return 1
28+ return - 1
2929
30- def update (self ):
31- return True
30+ def update (self ):
31+ return True
You can’t perform that action at this time.
0 commit comments