[Lldb-commits] [lldb] r137289 - in /lldb/trunk: scripts/Python/modify-python-lldb.py test/python_api/value/linked_list/main.cpp
Johnny Chen
johnny.chen at apple.com
Wed Aug 10 17:49:03 PDT 2011
Author: johnny
Date: Wed Aug 10 19:49:03 2011
New Revision: 137289
URL: http://llvm.org/viewvc/llvm-project?rev=137289&view=rev
Log:
Change the SBValue.linked_list_iter() to treat the value object as a homogeneous linked list data structure
where an empty linked list is represented as a value object with a NULL value, instead of a special value
object which 'points' to NULL.
Also modifies the test case to comply.
rdar://problem/9933692
Modified:
lldb/trunk/scripts/Python/modify-python-lldb.py
lldb/trunk/test/python_api/value/linked_list/main.cpp
Modified: lldb/trunk/scripts/Python/modify-python-lldb.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/modify-python-lldb.py?rev=137289&r1=137288&r2=137289&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/modify-python-lldb.py (original)
+++ lldb/trunk/scripts/Python/modify-python-lldb.py Wed Aug 10 19:49:03 2011
@@ -95,7 +95,7 @@
Return True if val is invalid or it corresponds to a null pointer.
Otherwise, return False.
"""
- if not val or int(val.GetValue(), 0) == 0:
+ if not val or val.GetValueAsUnsigned() == 0:
return True
else:
return False
@@ -127,8 +127,10 @@
for t in task_head.linked_list_iter('next'):
print t
"""
+ if end_of_list_test(self):
+ return
+ item = self
try:
- item = self.GetChildMemberWithName(next_item_name)
while not end_of_list_test(item):
yield item
# Prepare for the next iteration.
Modified: lldb/trunk/test/python_api/value/linked_list/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/value/linked_list/main.cpp?rev=137289&r1=137288&r2=137289&view=diff
==============================================================================
--- lldb/trunk/test/python_api/value/linked_list/main.cpp (original)
+++ lldb/trunk/test/python_api/value/linked_list/main.cpp Wed Aug 10 19:49:03 2011
@@ -21,14 +21,14 @@
int main (int argc, char const *argv[])
{
- Task *task_head = new Task(-1, NULL);
+ Task *task_head = NULL;
Task *task1 = new Task(1, NULL);
Task *task2 = new Task(2, NULL);
Task *task3 = new Task(3, NULL); // Orphaned.
Task *task4 = new Task(4, NULL);
Task *task5 = new Task(5, NULL);
- task_head->next = task1;
+ task_head = task1;
task1->next = task2;
task2->next = task4;
task4->next = task5;
@@ -43,7 +43,7 @@
printf("We have a total number of %d tasks\n", total);
// This corresponds to an empty task list.
- Task *empty_task_head = new Task(-1, NULL);
+ Task *empty_task_head = NULL;
return 0; // Break at this line
}
More information about the lldb-commits
mailing list